If you use -s USE_ZLIB=1, then no need to link libz.a manually

ср, 8 февр. 2023 г. в 20:06, Brion Vibber <br...@pobox.com>:

> > emcc: warning: /opt/local/lib/libz.a: archive is missing an index; Use
> emar when creating libraries to ensure an index is created [-Wemcc]
> > emcc: warning: /opt/local/lib/libz.a: adding index [-Wemcc]
> > ...
> > -L/opt/local/lib
> > ...
> > /opt/local/lib/libz.a
>
> It looks like you're trying to link a native macOS library? You need to
> build everything to wasm.
>
> -- brion
>
> On Wed, Feb 8, 2023 at 9:03 AM Ilya Kantor <ilia...@gmail.com> wrote:
>
>> Hello,
>>
>> I'm building git with emscripten ;)
>> Not libgit2, but the actual git.
>>
>> Everything compiled, but at the linking stage, seems it can't find zlib.
>>
>> Here's the command that I use on the (almost unpatched) fork
>> https://github.com/iliakan/git:
>>
>> emmake make all CXX=em++ CC=emcc NO_REGEX=NeedsStartEnd NO_NSEC=1
>> NO_APPLE_COMMON_CRYPTO=1 AR=emar CSPRNG_METHOD=getentropy NO_PTHREADS=1
>> NO_UNIX_SOCKETS=1 NO_PERL=1 NO_GETTEXT=1 NO_PYTHON=1 NO_IPV6=1
>> RANLIB=emranlib NO_INITGROUPS=1 NO_ICONV=1 -s USE_ZLIB=1
>>
>> This is the output
>> ==========================
>> ...
>> emcc: warning: /opt/local/lib/libz.a: archive is missing an index; Use
>> emar when creating libraries to ensure an index is created [-Wemcc]
>> emcc: warning: /opt/local/lib/libz.a: adding index [-Wemcc]
>> wasm-ld: error: libgit.a(csum-file.o): undefined symbol: crc32
>> wasm-ld: error: libgit.a(csum-file.o): undefined symbol: crc32
>> wasm-ld: error: libgit.a(csum-file.o): undefined symbol: crc32
>> wasm-ld: error: libgit.a(csum-file.o): undefined symbol: crc32
>> wasm-ld: error: libgit.a(zlib.o): undefined symbol: inflateInit_
>> wasm-ld: error: libgit.a(zlib.o): undefined symbol: inflateEnd
>> wasm-ld: error: libgit.a(zlib.o): undefined symbol: inflate
>> wasm-ld: error: libgit.a(zlib.o): undefined symbol: deflateInit_
>> wasm-ld: error: libgit.a(zlib.o): undefined symbol: deflateEnd
>> wasm-ld: error: libgit.a(zlib.o): undefined symbol: deflateEnd
>> wasm-ld: error: libgit.a(zlib.o): undefined symbol: deflate
>> emcc: error: '/opt/local/libexec/llvm-devel/bin/wasm-ld -o
>> git-daemon.wasm -L/opt/local/lib daemon.o common-main.o libgit.a
>> xdiff/lib.a reftable/libreftable.a libgit.a /opt/local/lib/libz.a
>> -L/opt/local/libexec/emscripten/cache/sysroot/lib/wasm32-emscripten -lGL
>> -lal -lhtml5 -lstubs -lnoexit -lc -ldlmalloc -lcompiler_rt -lc++-noexcept
>> -lc++abi-noexcept -lsockets -mllvm -combiner-global-alias-analysis=false
>> -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr
>> --allow-undefined-file=/var/folders/8c/z0mt42s97yz4ts2sxkbt_zv40000gn/T/tmpnnm6g2pg.undefined
>> --export-if-defined=main --export-if-defined=__start_em_asm
>> --export-if-defined=__stop_em_asm --export-if-defined=__start_em_lib_deps
>> --export-if-defined=__stop_em_lib_deps --export-if-defined=__start_em_js
>> --export-if-defined=__stop_em_js --export-if-defined=__main_argc_argv
>> --export=stackSave --export=stackRestore --export=stackAlloc
>> --export=__wasm_call_ctors --export=__errno_location
>> --export=__get_temp_ret --export=__set_temp_ret
>> --export=_emscripten_timeout --export=ntohs --export=htons --export=malloc
>> --export=emscripten_builtin_memalign --export-table -z stack-size=65536
>> --initial-memory=16777216 --no-entry --max-memory=16777216
>> --global-base=1024' failed (returned 1)
>> make: *** [git-daemon] Error 1
>> emmake: error: 'make all CXX=em++ CC=emcc NO_REGEX=NeedsStartEnd
>> NO_NSEC=1 NO_APPLE_COMMON_CRYPTO=1 AR=emar CSPRNG_METHOD=getentropy
>> NO_PTHREADS=1 NO_UNIX_SOCKETS=1 NO_PERL=1 NO_GETTEXT=1 NO_PYTHON=1
>> NO_IPV6=1 RANLIB=emranlib NO_INITGROUPS=1 NO_ICONV=1 -s USE_ZLIB=1' failed
>> (returned 2)
>> =====================
>>
>> I googled around, tried some solutions, but nothing helped so far.
>> My host machine is MacOs Ventura.
>>
>> As you can see, just adding "-s USE_ZLIB=1" doesn't work.
>> Please advise, how to solve this?
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "emscripten-discuss" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to emscripten-discuss+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/emscripten-discuss/7ed7c0bf-2dc2-4f1f-91c3-0e4d70f219fbn%40googlegroups.com
>> <https://groups.google.com/d/msgid/emscripten-discuss/7ed7c0bf-2dc2-4f1f-91c3-0e4d70f219fbn%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "emscripten-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to emscripten-discuss+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/emscripten-discuss/CAFnWYTntKH3Yh5UPCJVQ1aBKFzxwn7RR_xe41b-JjfmV7MtZPA%40mail.gmail.com
> <https://groups.google.com/d/msgid/emscripten-discuss/CAFnWYTntKH3Yh5UPCJVQ1aBKFzxwn7RR_xe41b-JjfmV7MtZPA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to emscripten-discuss+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/emscripten-discuss/CAKOm%3DVFvsBKgBYew3eh_suF-HdSNneqn0RuzuHy1s5Oy0XkKYQ%40mail.gmail.com.

Reply via email to