diff --git a/CMakeLists.txt b/CMakeLists.txt index 9273c5ee7..07209938b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -183,7 +183,15 @@ set(MAGNUM_INCLUDE_INSTALL_PREFIX "." CACHE STRING "Prefix where to put platform-independent include and other files") option(BUILD_STATIC "Build static libraries (default are shared)" OFF) -option(BUILD_STATIC_PIC "Build static libraries and plugins with position-independent code" ON) +# Disable PIC on Emscripten by default (but still allow it to be enabled +# explicitly if one so desires). Currently causes linker errors related to +# __memory_base etc.: https://github.com/emscripten-core/emscripten/issues/8761 +if(CORRADE_TARGET_EMSCRIPTEN) + set(ON_EXCEPT_EMSCRIPTEN OFF) +else() + set(ON_EXCEPT_EMSCRIPTEN ON) +endif() +option(BUILD_STATIC_PIC "Build static libraries and plugins with position-independent code" ${ON_EXCEPT_EMSCRIPTEN}) option(BUILD_PLUGINS_STATIC "Build static plugins (default are dynamic)" OFF) option(BUILD_TESTS "Build unit tests" OFF) cmake_dependent_option(BUILD_GL_TESTS "Build unit tests for OpenGL code" OFF "BUILD_TESTS;TARGET_GL" OFF) diff --git a/doc/changelog.dox b/doc/changelog.dox index 2da0aa543..c0ed713c9 100644 --- a/doc/changelog.dox +++ b/doc/changelog.dox @@ -377,6 +377,9 @@ See also: (see [mosra/magnum#345](https://github.com/mosra/magnum/issues/345)) - Fixed a 64-to-32-bit conversion warning on MSVC in @ref GL::Mesh internals (see [mosra/magnum#352](https://github.com/mosra/magnum/issues/352)) +- Emscripten builds now have the `-fPIC` option disabled by default as it + causes linker errors related to `__memory_base` on 1.38.36 (see also + [emscripten-core/emscripten#8761](https://github.com/emscripten-core/emscripten/issues/8761)) @subsection changelog-latest-bugfixes Bug fixes