Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't use CMake function em_link_js_library for cpp project #16135

Open
libbkmz opened this issue Jan 28, 2022 · 0 comments
Open

can't use CMake function em_link_js_library for cpp project #16135

libbkmz opened this issue Jan 28, 2022 · 0 comments

Comments

@libbkmz
Copy link

libbkmz commented Jan 28, 2022

Please include the following in your bug report:

Version of emscripten/emsdk:

emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.2-git
clang version 14.0.0 (https://github.com/llvm/llvm-project.git 782c0dd1a1c235afb09a34e7da4a1267ead14765)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /usr/local/opt/emscripten/libexec/llvm/bin

Failing command line in full:
emcmake cmake .

Full link command and output with -v appended:

~> cat CMakeLists.txt
cmake_minimum_required (VERSION 2.8.12)
project(plugin CXX)

add_executable(test test.cc)
em_link_js_library(test "lib.js")

~> emcmake cmake  . 
configure: cmake . -DCMAKE_TOOLCHAIN_FILE=/usr/local/Cellar/emscripten/3.1.2/libexec/cmake/Modules/Platform/Emscripten.cmake -DCMAKE_CROSSCOMPILING_EMULATOR=/usr/local/bin/node;--experimental-wasm-threads
-- Configuring done
CMake Error: Cannot determine link language for target "test_1_lib_js".
CMake Error: CMake can not determine linker language for target: test_1_lib_js
-- Generating done
CMake Generate step failed.  Build files cannot be regenerated correctly.
emcmake: error: 'cmake . -DCMAKE_TOOLCHAIN_FILE=/usr/local/Cellar/emscripten/3.1.2/libexec/cmake/Modules/Platform/Emscripten.cmake -DCMAKE_CROSSCOMPILING_EMULATOR=/usr/local/bin/node;--experimental-wasm-threads' failed (returned 1)

Hello! I'm trying to create a wasm module for envoy via cpp sdk. To do so, I want to use cmake instead of original advertised Makefile. In order to replicate the em++ build line I have created simple CMakeLists.txt file with empty test.cc and empty lib.js files :

cmake_minimum_required (VERSION 2.8.12)
project(plugin CXX)

add_executable(test test.cc)
em_link_js_library(test "lib.js")

I'm looking for a way to add --js-library ${PROXY_WASM_CPP_SDK}/proxy_wasm_intrinsics.js into CMake to proceed with the build... But CMake complains: Cannot determine link language for target "test_1_lib_js". Even adding

 set_target_properties(test PROPERTIES LINKER_LANGUAGE CXX)

Does not help at all...

Here is the gist example to reproduce the issue: https://gist.github.com/libbkmz/c5090b5a7274de9a18664db3fde8228c

@libbkmz libbkmz changed the title can't use CMake function em_link_js_library for cpp project can't use CMake function em_link_js_library for cpp project Feb 1, 2022
@libbkmz libbkmz changed the title can't use CMake function em_link_js_library for cpp project can't use CMake function em_link_js_library for cpp project Feb 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant