conan-center-index: [package] emsdk/3.1.23: Cannot compile if emscripten headers are required.
Description
Hi,
We been using emscritpen and the emcmake and emmake wrappers provided by emsdk manually as defined in their documentation. This worked as expected and we easily compiled our .wasm libraries.
Recently we switched to using conan and now require a build using emsdk and cmake-conan. We’ve spent alot of time trying to get this to work and have come to an impasse where we need some help.
So far we have set up the dual profile as suggested in https://github.com/conan-io/conan/issues/10259 and we are using the suggested method of using conan install from the conan-make repo:
(taken from https://github.com/Bam4d/Griddly/blob/wasm_fixies/cmake/settings/Conan.cmake)
conan_cmake_configure(
REQUIRES
glm/0.9.9.8
yaml-cpp/0.6.3
spdlog/1.9.2
OPTIONS
gtest:build_gmock=True
GENERATORS
cmake
cmake_find_package
cmake_paths
)
conan_cmake_install(
PATH_OR_REFERENCE .
CONAN_COMMAND ${CONAN}
${CONAN_EXTRA_REQUIRES}
OPTIONS
${CONAN_EXTRA_OPTIONS}
PROFILE_HOST emsdk
PROFILE_BUILD default
BUILD missing
)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup(TARGETS)
So when running this eveything installs OK and seems to build… apart from the actual emscripten bindings/embind etc…
We get an error that the emscripten/bind.h headers cannot be found. It seems as though the emsdk package itself does not actually expose these to the build process at all.
Package and Environment Details
- Package Name/Version: emsdk/3.1.23
- Operating System+version: Linux Ubuntu 22.04
- Compiler+version: GCC 11
- Conan version: conan 1.55.0
- Python version: Python 3.9.0
Conan profile
emsdk profile:
include(default)
[settings]
os=Emscripten
arch=wasm
compiler=clang
compiler.version=6.0
compiler.libcxx=libc++
[options]
[build_requires]
emsdk/3.1.23
[env]
I believe the “default” profile is autodetected with cmake.
Steps to reproduce
Firstly clone the Griddly repo and change to the wasm_fixies branch.
Then run the cmake steps in js/build.sh (If you run it directly it will complain about missing files but you can ignore this)
you can run the full build including some cleanup steps using:
cd js && ./configure.sh && ./build.sh
OR just run the cmake directly from the root directory.
cmake . -DWASM=ON && make
Logs
Everything works fine up untl this point:
-- Build files have been written to: /home/bam4d/qmul/Griddly/build_wasm
Consolidate compiler generated dependencies of target griddlyjs
[ 1%] Building CXX object CMakeFiles/griddlyjs.dir/js/bindings/GriddlyJS.cpp.o
In file included from /home/bam4d/qmul/Griddly/js/bindings/GriddlyJS.cpp:1:
/home/bam4d/qmul/Griddly/js/bindings/GriddlyJS.hpp:1:10: fatal error: emscripten/bind.h: No such file or directory
1 | #include <emscripten/bind.h>
| ^~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/griddlyjs.dir/build.make:93: CMakeFiles/griddlyjs.dir/js/bindings/GriddlyJS.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:88: CMakeFiles/griddlyjs.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 17 (7 by maintainers)
Works fine for me with commands I gave you above (conan install & cmake configuration must be called with the same build type obviously).
I guess something like this should be added to
package_info()ofemsdkrecipe, so that it can work properly in build systems not relying on CMake Toolchain file provided by emsdk:(EDIT: no actually this suggestion breaks everything :p )