-
Notifications
You must be signed in to change notification settings - Fork 448
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
Vcpkg port or manual install does not work when cross compiling to Emscripten #520
Comments
Hi, this is something I have to look into. AFAIK you're the first to attempt to use the vcpkg packages on Emscripten, so far vcpkg users were mostly on Windows and a few on Linux/macOS.
diff --git a/modules/Platform/Emscripten.cmake b/modules/Platform/Emscripten.cmake
index 890e8b0..503d06e 100644
--- a/modules/Platform/Emscripten.cmake
+++ b/modules/Platform/Emscripten.cmake
@@ -21,9 +21,11 @@ set(CMAKE_STATIC_LIBRARY_PREFIX "")
set(CMAKE_STATIC_LIBRARY_SUFFIX ".bc")
set(CMAKE_EXECUTABLE_SUFFIX ".js")
-# Prefixes/suffixes for finding libraries
-set(CMAKE_FIND_LIBRARY_PREFIXES "")
-set(CMAKE_FIND_LIBRARY_SUFFIXES ".bc")
+# Prefixes/suffixes for finding libraries. Magnum's own Emscripten toolchain
+# uses Foo.bc, but external toolchains (such as libraries built with vcpkg) use
+# the classical libFoo.a, so check for both.
+set(CMAKE_FIND_LIBRARY_PREFIXES ";lib")
+set(CMAKE_FIND_LIBRARY_SUFFIXES ".bc;.a")
# Disable annoying warning about absolute includes
string(APPEND CMAKE_CXX_FLAGS " -Wno-warn-absolute-paths") Sorry that it's just a hasty untested patch, but maybe it's enough to fix this part :) What's the timeframe you'd like to have this solved? By the end of the week or early next week I could have more time to look into this and ensure the Emscripten port of the vcpkg package works. Besides that, I feel that I have a responsibility to warn you before you get too dependent on vcpkg for serious work (production builds, ...) — I know of at least three teams that relied heavily on vcpkg for Magnum and other dependencies and ultimately had to switch away or fork it entirely. Basically every vcpkg upgrade broke some package for them and it was just an endless time sink of submitting vcpkg patches, fighting to get them merged, and then discovering that some sweeping change caused the fixes to get reverted again. (Emscripten itself is another unpredictable source of entropy, some versions simply do not work or are backwards incompatible, and I'm not sure if vcpkg can be told to stay on a particular Emscripten version.)
|
Hi, thanks for the fast answer. We can continue to use vcpkg for other dependencies and submodules for magnum for the future, it's not a big deal, but if we're able to standardize just one system for deps in the long term it would be better. So no big time constraint, it's not a critical issue, we can take all the time needed to find and test the best solution. Thanks |
The above patch that makes Updating the vcpkg port to include Emscripten-specific libraries is tracked in #607. I don't think there's anything else to do here, so closing as resolved. |
If you try to use the Vcpkg port of Magnum to cross compile to emscripten there are a lot of roadblocks.
I don't think this can be 100% solved only in the vcpkg port file, it seems there's something strange in the cross compilation itself.
If i use the project as a submodule (without installing) everything works, but cross compiling it as a library to later include in another project manually or with vcpkg always fails.
The text was updated successfully, but these errors were encountered: