You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Library symbols added DEFAULT_LIBRARY_FUNCS_TO_INCLUDE don't pull in their native dependencies. #19759
When the native code itself depends on a library function the stub object that we pass to the linker allows the linker to know which symbols it needs to export.
However if we simply add the symbol DEFAULT_LIBRARY_FUNCS_TO_INCLUDE the linker has no visibility of this.
e.g.
$ ./emcc ~/test/hello.c -sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE=gethostbyname_r
error: undefined symbol: malloc (referenced by $getHostByName, referenced by gethostbyname, referenced by gethostbyname_r, referenced by root reference (e.g. compiled C/C++ code))
warning: To disable errors for undefined symbols use `-sERROR_ON_UNDEFINED_SYMBOLS=0`
warning: _malloc may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: htons (referenced by $inetPton6, referenced by $DNS, referenced by $getHostByName, referenced by gethostbyname, referenced by gethostbyname_r, referenced by root reference (e.g. compiled C/C++ code))
warning: _htons may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: memcpy (referenced by gethostbyname_r, referenced by root reference (e.g. compiled C/C++ code))
warning: _memcpy may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: free (referenced by gethostbyname_r, referenced by root reference (e.g. compiled C/C++ code))
warning: _free may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
Error: Aborting compilation due to previous errors
emcc: error: '/usr/local/google/home/sbc/dev/wasm/emsdk/node/16.20.0_64bit/bin/node /usr/local/google/home/sbc/dev/wasm/emscripten/src/compiler.js /tmp/tmp5ae7rmz_.json' failed (returned 1)
Activity
Allow DEFAULT_LIBRARY_FUNCS_TO_INCLUDE to have native deps. NFC
Allow DEFAULT_LIBRARY_FUNCS_TO_INCLUDE to have native deps. NFC
Allow DEFAULT_LIBRARY_FUNCS_TO_INCLUDE to have native deps. NFC
Allow DEFAULT_LIBRARY_FUNCS_TO_INCLUDE to have native deps. NFC
Allow DEFAULT_LIBRARY_FUNCS_TO_INCLUDE to have native deps. NFC
Allow DEFAULT_LIBRARY_FUNCS_TO_INCLUDE to have native deps. NFC
Allow DEFAULT_LIBRARY_FUNCS_TO_INCLUDE to have native deps. NFC (#19843)