ymd-h / exodide

Build & Install custom C/C++ extension package for Pyodide
MIT License
20 stars 4 forks source link

wasm-ld: error: unknown argument: -Bsymbolic-functions #26

Closed nyckmaia closed 2 years ago

nyckmaia commented 2 years ago

Hi, I'm trying to build the exodide example, but I got some compilation errors.

My steps were:

1- I'm using Ubuntu 20.04 LTS on Windows WSL 2 2- I ran the source ~/emsdk/emsdk_env.sh to set the Emscripten environment variables 3a- I tried to ran CC=emcc CXX=em++ python3 setup.py bdist_whell but I got this error:

nyck@GS65:~/exodide/example$ CC=emcc CXX=em++ python3 setup.py bdist_whell
Include: /home/nyck/exodide/example/pybind11/include
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: setup.py --help [cmd1 cmd2 ...]
   or: setup.py --help-commands
   or: setup.py cmd --help

error: invalid command 'bdist_whell'

3b- If I change python3 to python it starts to compile, but I got another error:

nyck@GS65:~/exodide/example$ CC=emcc CXX=em++ python setup.py bdist_wheel
Include: /home/nyck/exodide/example/pybind11/include
running bdist_wheel
running build
running build_py
running build_ext
building 'exodide_example.example' extension
emcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/nyck/.local/lib/python3.10/site-packages/exodide/cpython -I/home/nyck/.local/lib/python3.10/site-packages/exodide/numpy -I/home/nyck/.local/lib/python3.10/site-packages/exodide/cpython -I/home/nyck/.local/lib/python3.10/site-packages/exodide/numpy -I/usr/local/include/python3.10 -c exodide_example/example.cc -o build/temp.emscripten-wasm32-3.10/exodide_example/example.o -std=c++17 -I/home/nyck/exodide/example/pybind11/include
em++ -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -g -fwrapv -O2 -Wl,-Bsymbolic-functions -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC build/temp.emscripten-wasm32-3.10/exodide_example/example.o -o build/lib.emscripten-wasm32-3.10/exodide_example/example.cpython-310-wasm32-emscripten.so -s MODULARIZE=1 -s LINKABLE=1 -s EXPORT_ALL=1 -s WASM=1 -s LZ4=1 -s WASM_BIGINT -s SIDE_MODULE=1
wasm-ld: error: unknown argument: -Bsymbolic-functions
wasm-ld: error: unknown argument: -Bsymbolic-functions
wasm-ld: error: unknown argument: -Bsymbolic-functions
em++: error: '/home/nyck/emsdk/upstream/bin/wasm-ld -o build/lib.emscripten-wasm32-3.10/exodide_example/example.cpython-310-wasm32-emscripten.so --whole-archive -O1 -Bsymbolic-functions -Bsymbolic-functions -Bsymbolic-functions build/temp.emscripten-wasm32-3.10/exodide_example/example.o -L/home/nyck/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/pic --no-whole-archive -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr --import-undefined --import-memory --export-dynamic --export-if-defined=main --export-if-defined=__start_em_asm --export-if-defined=__stop_em_asm --export-if-defined=__main_argc_argv --export-if-defined=setThrew --export-if-defined=stackSave --export-if-defined=stackRestore --export-if-defined=stackAlloc --export-if-defined=__wasm_call_ctors --export-if-defined=__errno_location --export-if-defined=malloc --export-if-defined=free --export-if-defined=__cxa_is_pointer_type --experimental-pic -shared' failed (returned 1)
error: command '/home/nyck/emsdk/upstream/emscripten/em++' failed with exit code 1

Obs.: Both python and python3 are pointing to python3.10, as you can see in the image below: image

Question

So, how can I fix it and compile the exodide example?

My Setup

ymd-h commented 2 years ago

@nyckmaia Thank you for your feedback.

3a

3a- I tried to ran CC=emcc CXX=em++ python3 setup.py bdist_whell but I got this error:

bdist_wheel is correct, not bdist_whell. Actually, I found our README is wrong. We will fix it.

3b

wasm-ld: error: unknown argument: -Bsymbolic-functions

I've never encountered that option, but maybe we have to remove -Bsymbolic-functions, too. We will investigate it.

Thank you for your reporting.

FYI

We also provide docker image at ghcr.io/ymd-h/exodide:latest. While we are fixing the above issue, you can use it if possible.

ymd-h commented 2 years ago

@nyckmaia We released exodide v1.0.3, which trims unsupported -Wl,-Bsymbolic-functions, too.

We don't have appropriate environment (WSL) to test, however, I hope it will work.

If you try and still have any problems, please let us know.

nyckmaia commented 2 years ago

Great! Thank you @ymd-h

I will try it latter, but any problems I will re-open this issue, ok?

Thank you again!