mosra / magnum

Lightweight and modular C++11 graphics middleware for games and data visualization
https://magnum.graphics/
Other
4.74k stars 439 forks source link

emsdk compile error: typedef redefinition with different types #631

Closed linuxaged closed 7 months ago

linuxaged commented 7 months ago

emsdk version 3.1.50

C:\workspace\emsdk\upstream\emscripten\cache\sysroot/include\emscripten/html5_webgl.h:17:18: error: typedef redefinition with different types ('intptr_t' (aka 'long') vs 'int')
   17 | typedef intptr_t EMSCRIPTEN_WEBGL_CONTEXT_HANDLE;
      |                  ^
C:/workspace/BonViewer/magnum/src/Magnum/Platform\EmscriptenApplication.h:65:13: note: previous definition is here
   65 | typedef int EMSCRIPTEN_WEBGL_CONTEXT_HANDLE;
      |             ^
1 error generated
mosra commented 7 months ago

This changed in 3.1.49 and I already have a fix pending (8048b65964e1bb171b637c6edd2699b43f45e2ea, in the next branch), unfortunately on ArchLinux I still only have 3.1.48 in the repos so I can't easily test myself.

Is it possible for you to try with the next branch and confirm that the fix works? If you confirm, I'll push that commit to master. Thank you! :)

linuxaged commented 7 months ago

try next branch and get the Configuring error:

C:\workspace\BonViewer\build-emscripten>cmake .. -G Ninja ^
More? -DCMAKE_MAKE_PROGRAM="C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja\ninja.exe" ^
More? -DCMAKE_TOOLCHAIN_FILE="../toolchains/generic/Emscripten-wasm.cmake" ^
More? -DCMAKE_BUILD_TYPE=Release ^
More? -DWITH_EMSCRIPTENAPPLICATION=ON ^
More? -DTARGET_GLES2=OFF ^
More? -DWITH_STBIMAGEIMPORTER=ON ^
More? -DWITH_IMGUI=ON ^
More? -DIMGUI_DIR="C:/workspace/imgui" ^
More? -DEMSCRIPTEN_PREFIX="C:/workspace/emsdk/upstream/emscripten" ^
More? -DMAGNUM_DEPLOY_PREFIX="C:/http/magnum" ^
More? -DCMAKE_FIND_ROOT_PATH="C:/lib/emscripten/system"
-- The C compiler identification is Clang 18.0.0
-- The CXX compiler identification is Clang 18.0.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/workspace/emsdk/upstream/emscripten/emcc.bat - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/workspace/emsdk/upstream/emscripten/em++.bat - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The LIB_SUFFIX variable is not defined. It will be autodetected now.
-- You can set it manually with -DLIB_SUFFIX=<value> (64 for example).
-- LIB_SUFFIX autodetected as '', libraries will be installed into C:/Program Files (x86)/BonViewer/lib
-- Found Git: C:/Program Files/Git/cmd/git.exe (found version "2.41.0.windows.1")
-- Found Corrade: C:/workspace/BonViewer/corrade/src  found components: Containers rc Utility
-- Found OpenGLES3: GL
CMake Error at magnum/src/Magnum/Platform/CMakeLists.txt:204 (message):
  Emscripten 1.39.5+, which enables
  DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR by default, is required to
  build EmscriptenApplication and Sdl2Application.  Found version .

-- Found Corrade: C:/workspace/BonViewer/corrade/src  found components: Containers rc Utility Main TestSuite
-- Found Corrade: C:/workspace/BonViewer/corrade/src  found components: Containers rc Utility PluginManager
-- Found Corrade: C:/workspace/BonViewer/corrade/src  found components: Containers rc Utility
-- Found Magnum: C:/workspace/BonViewer/magnum/src
-- Found Corrade: C:/workspace/BonViewer/corrade/src  found components: Containers rc Utility PluginManager
-- Found Magnum: C:/workspace/BonViewer/magnum/src  found components: Trade
CMake Warning (dev) at C:/Program Files/CMake/share/cmake-3.28/Modules/GNUInstallDirs.cmake:243 (message):
  Unable to determine default CMAKE_INSTALL_LIBDIR directory because no
  target architecture is known.  Please enable at least one language before
  including GNUInstallDirs.
Call Stack (most recent call first):
  fmt/CMakeLists.txt:67 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Module support is disabled.
-- Version: 9.1.0
-- Build type: Release
-- CXX_STANDARD: 20
-- Performing Test has_std_20_flag
-- Performing Test has_std_20_flag - Success
-- Performing Test has_std_2a_flag
-- Performing Test has_std_2a_flag - Success
-- Required features: cxx_variadic_templates
-- Performing Test HAS_NULLPTR_WARNING
-- Performing Test HAS_NULLPTR_WARNING - Success
CMAKE_PREFIX_PATH:
-- Found Corrade: C:/workspace/BonViewer/corrade/src  found components: Containers rc Utility Main
-- Found Corrade: C:/workspace/BonViewer/corrade/src  found components: Containers rc Utility PluginManager
-- Found Magnum: C:/workspace/BonViewer/magnum/src  found components: Trade GL MeshTools Primitives SceneGraph Shaders
-- Found Corrade: C:/workspace/BonViewer/corrade/src  found components: Containers rc Utility
-- Found Magnum: C:/workspace/BonViewer/magnum/src  found components: GL EmscriptenApplication
-- Configuring incomplete, errors occurred!
mosra commented 7 months ago

Is your toolchains submodule up-to-date? There were recent changes to it (querying the Emscripten version, etc) and the Found version . error happens if it's not updated.

mosra commented 7 months ago

I got 3.1.50 in Arch repos today, and can confirm the patch from 8048b65964e1bb171b637c6edd2699b43f45e2ea works. So it's in master now.

If you still have issues, comment here or just pop in the chat :)