conan-io / conan

Conan - The open-source C and C++ package manager
https://conan.io
MIT License
8.14k stars 970 forks source link

emscripten 1.39.13 invalid settings.arch wasm #7387

Open Arghnews opened 4 years ago

Arghnews commented 4 years ago

I am trying to follow the conan emscripten hello world example here on Ubuntu.

I run

git clone --depth 1 git@github.com:conan-io/examples.git
cd examples/features/emscripten
./build.sh

build.sh runs the commands

conan remove conan-hello-emscripten/* -f
conan create . conan/testing  -pr emscripten.profile --build missing
conan install conanfile.txt  -pr emscripten.profile

The emscripten.profile file in the current directory contains in the [build_requires] section:

[build_requires]
emsdk_installer/1.38.29@bincrafters/stable
ninja_installer/1.8.2@bincrafters/stable

This all works fine.

If I change the emsdk to emsdk_installer/1.39.6@bincrafters/stable this results in an error at link time (bigger log posted at the end) with output like wasm-ld: error: zutil_49ed71bb.o: machine type must be wasm32.

If I change the emsdk to emsdk_installer/1.39.13@bincrafters/stable however, then running build.sh produces this output and errors:

...
+ conan remove 'conan-hello-emscripten/*' -f
+ conan create . conan/testing -pr emscripten.profile --build missing
Exporting package recipe
conan-hello-emscripten/1.0@conan/testing exports_sources: Copied 1 '.txt' file: CMakeLists.txt
conan-hello-emscripten/1.0@conan/testing exports_sources: Copied 1 '.cpp' file: main.cpp
conan-hello-emscripten/1.0@conan/testing: A new conanfile.py version was exported
conan-hello-emscripten/1.0@conan/testing: Folder: /home/username/.conan/data/conan-hello-emscripten/1.0/conan/testing/export
conan-hello-emscripten/1.0@conan/testing: Exported revision: f6984cac6b69e70f11f00673968702c7
Configuration:
[settings]
arch=wasm
arch_build=x86_64
build_type=Debug
compiler=clang
compiler.libcxx=libc++
compiler.version=6.0
os=Emscripten
os_build=Linux
[options]
[build_requires]
*: emsdk_installer/1.39.13@bincrafters/stable, ninja_installer/1.8.2@bincrafters/stable
[env]

ERROR: Error while initializing settings. Invalid setting 'wasm' is not a valid 'settings.arch' value.
Possible values are ['x86']
Read "http://docs.conan.io/en/latest/faq/troubleshooting.html#error-invalid-setting"

I am unsure whether this is a bug, or not meant to work in the first place, or exactly what this means?

However it all works with emsdk_installer/1.38.29@bincrafters/stable.

Ubuntu 18.10 x64, conan 1.27.1

emsdk_installer/1.39.6@bincrafters/stable error:

[1/2] Building CXX object CMakeFiles/conan-hello-emscripten.dir/main.cpp.o
[2/2] Linking CXX executable bin/conan-hello-emscripten.html
FAILED: bin/conan-hello-emscripten.html 
: && /home/username/.conan/data/emsdk_installer/1.39.6/bincrafters/stable/package/83753ef0acbb6f750f6b8535092aae8d58e88098/upstream/emscripten/em++    --emrun CMakeFiles/conan-hello-emscripten.dir/main.cpp.o  -o bin/conan-hello-emscripten.html -L/home/username/.conan/data/zlib/1.2.11/conan/stable/package/05f762e5c704e71da2e451fecc074bbe60ae1bfc/lib   -L/home/username/.conan/data/nodejs_installer/10.15.0/bincrafters/stable/package/44fcf6b9a7fb86b2586303e3db40189d3b511830/lib -lz && :
wasm-ld: error: zutil_49ed71bb.o: machine type must be wasm32
shared:ERROR: '/home/username/.conan/data/emsdk_installer/1.39.6/bincrafters/stable/package/83753ef0acbb6f750f6b8535092aae8d58e88098/upstream/bin/wasm-ld -o /tmp/emscripten_temp_k8Oie3/conan-hello-emscripten.wasm --allow-undefined --lto-O0 CMakeFiles/conan-hello-emscripten.dir/main.cpp.o -L/home/username/.conan/data/zlib/1.2.11/conan/stable/package/05f762e5c704e71da2e451fecc074bbe60ae1bfc/lib -L/home/username/.conan/data/emsdk_installer/1.39.6/bincrafters/stable/package/83753ef0acbb6f750f6b8535092aae8d58e88098/upstream/emscripten/system/local/lib -L/home/username/.conan/data/nodejs_installer/10.15.0/bincrafters/stable/package/44fcf6b9a7fb86b2586303e3db40189d3b511830/lib /home/username/.conan/data/zlib/1.2.11/conan/stable/package/05f762e5c704e71da2e451fecc074bbe60ae1bfc/lib/libz.a -L/home/username/.conan/data/emsdk_installer/1.39.6/bincrafters/stable/package/83753ef0acbb6f750f6b8535092aae8d58e88098/.emscripten_cache/wasm-obj /home/username/.conan/data/emsdk_installer/1.39.6/bincrafters/stable/package/83753ef0acbb6f750f6b8535092aae8d58e88098/.emscripten_cache/wasm-obj/libc.a /home/username/.conan/data/emsdk_installer/1.39.6/bincrafters/stable/package/83753ef0acbb6f750f6b8535092aae8d58e88098/.emscripten_cache/wasm-obj/libcompiler_rt.a /home/username/.conan/data/emsdk_installer/1.39.6/bincrafters/stable/package/83753ef0acbb6f750f6b8535092aae8d58e88098/.emscripten_cache/wasm-obj/libc-wasm.a /home/username/.conan/data/emsdk_installer/1.39.6/bincrafters/stable/package/83753ef0acbb6f750f6b8535092aae8d58e88098/.emscripten_cache/wasm-obj/libc++-noexcept.a /home/username/.conan/data/emsdk_installer/1.39.6/bincrafters/stable/package/83753ef0acbb6f750f6b8535092aae8d58e88098/.emscripten_cache/wasm-obj/libc++abi-noexcept.a /home/username/.conan/data/emsdk_installer/1.39.6/bincrafters/stable/package/83753ef0acbb6f750f6b8535092aae8d58e88098/.emscripten_cache/wasm-obj/libdlmalloc.a /home/username/.conan/data/emsdk_installer/1.39.6/bincrafters/stable/package/83753ef0acbb6f750f6b8535092aae8d58e88098/.emscripten_cache/wasm-obj/libpthread_stub.a /home/username/.conan/data/emsdk_installer/1.39.6/bincrafters/stable/package/83753ef0acbb6f750f6b8535092aae8d58e88098/.emscripten_cache/wasm-obj/libc_rt_wasm.a /home/username/.conan/data/emsdk_installer/1.39.6/bincrafters/stable/package/83753ef0acbb6f750f6b8535092aae8d58e88098/.emscripten_cache/wasm-obj/libsockets.a --import-memory --import-table -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr --strip-debug --export __wasm_call_ctors --export __data_end --export main --export malloc --export free --export setThrew --export __errno_location --export fflush --export _ZSt18uncaught_exceptionv -z stack-size=5242880 --initial-memory=16777216 --no-entry --max-memory=16777216 --global-base=1024' failed (1)
ninja: build stopped: subcommand failed.
conan-hello-emscripten/1.0@conan/testing: 
conan-hello-emscripten/1.0@conan/testing: ERROR: Package '5bed01a63353e98dcb3a000b1f1089df5f3d8b83' build failed
conan-hello-emscripten/1.0@conan/testing: WARN: Build folder /home/username/.conan/data/conan-hello-emscripten/1.0/conan/testing/build/5bed01a63353e98dcb3a000b1f1089df5f3d8b83
ERROR: conan-hello-emscripten/1.0@conan/testing: Error in build() method, line 25
    cmake.build()
    ConanException: Error 1 while executing cmake --build '/home/username/.conan/data/conan-hello-emscripten/1.0/conan/testing/build/5bed01a63353e98dcb3a000b1f1089df5f3d8b83' '--' '-j8'
czoido commented 4 years ago

Hi @Arghnews,

Thanks a lot for reporting, yes, the documentation about emscripten is outdated, we will update it as soon as possible. I think that the error with version 1.39.13 was solved in this PR: https://github.com/bincrafters/conan-emsdk_installer/pull/8 at least for the testing version so please check if updating the recipe to that one solves your issue. It was reverting a change that arch setting could take the value asm.js or wasm that are the only supported.

If you have further issues with that recipe you can open an issue also in the bincrafters conan-emsdk_installer repo: https://github.com/bincrafters/conan-emsdk_installer

Arghnews commented 4 years ago

Hi @czoido , thanks for your reply.

I do not believe that the testing/1.39.13 branch for the conan-emsdk_installer is available yet on bincrafters - I only see the stable branches with a conan search so I'm unable to test it. It looks that PR does indeed fix this issue though.

Also the https://github.com/bincrafters/conan-emsdk_installer repo doesn't seem to allow issues to be opened so I'm unsure how I'd open one there - there is no Issue button for me at least.

I can just use emsdk_installer/1.38.29@bincrafters/stable for now as per the example page and it works so that's great.

Could I ask a related question. The build script from the [https://docs.conan.io/en/latest/integrations/cross_platform/emscripten.html](hello world emscripten) example uses this build script:

conan remove conan-hello-emscripten/* -f
conan create . conan/testing  -pr emscripten.profile --build missing
conan install conanfile.txt  -pr emscripten.profile

How would I be able to change this to do a more usual out of source cmake build like

# Change "include(conanbuildinfo.cmake)" in CMakeLists.txt to "include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)"
# From emscripten hello world root
mkdir build && cd build/
conan install .. -pr ../emscripten.profile --build missing
cmake ..
cmake --build .

This doesn't work, nor does it work if I add emcmake in front of the cmake .. call etc.

If the scope of this is too great I will make a new issue, cheers.

czoido commented 4 years ago

Hi @Arghnews

I do not believe that the testing/1.39.13 branch for the conan-emsdk_installer is available yet on bincrafters - I only see the stable branches with a conan search so I'm unable to test it. It looks that PR does indeed fix this issue though.

Yes, it is not in bincrafters conan repo, I meant that maybe you could test locally that branch from the github repo branch testing/1.39.13: https://github.com/bincrafters/conan-emsdk_installer

Also the https://github.com/bincrafters/conan-emsdk_installer repo doesn't seem to allow issues to be opened so I'm unsure how I'd open one there - there is no Issue button for me at least.

I think that the place to submit an issue is here: https://github.com/bincrafters/community/issues

This doesn't work, nor does it work if I add emcmake in front of the cmake .. call etc.

What error are you getting? For me this is working:

# Change "include(conanbuildinfo.cmake) ...
source activate.sh
mkdir build && cd build  
conan install .. -pr ../emscripten.profile --build missing
emcmake cmake ..
cmake --build .

Hope this helps.

Arghnews commented 4 years ago

Hi @czoido ,

Thanks for the information about the branch locally and the place to submit the issue.

And ahh, I didn't think to source the activate.sh script to set the environment up, yes that all seems to work perfectly.

Thanks for all your help and timely responses, I appreciate it.