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

Compiling Embree with MinGW (windows platform) #279

Open
hwangsong opened this issue Mar 21, 2020 · 6 comments
Open

Compiling Embree with MinGW (windows platform) #279

hwangsong opened this issue Mar 21, 2020 · 6 comments

Comments

@hwangsong
Copy link

Has anyone compiled embree with MinGW?

@syoyo
Copy link

syoyo commented May 1, 2020

FYI embree-aarch64 started to support compiling Embree with llvm-mingw:

https://github.com/lighttransport/embree-aarch64/blob/master/scripts/bootstrap-llvm-mingw-cross.sh

MinGW gcc compiles OK, but it seg faults at runtime(due to memory alignment issue)

https://github.com/lighttransport/embree-aarch64/blob/master/scripts/bootstrap-mingw-cross.sh

@AndreyMlashkin
Copy link

I can't build embree with mingw...

embree3/3.12.0: Applying build-requirement: mingw-w64/8.1
embree3/3.12.0: Applying build-requirement: msys2/cci.latest
embree3/3.12.0: WARN: Build folder is dirty, removing it: E:\conan_new\embree3\3.12.0__\build\15347b79d2fd32ede87f10f5f235e5a5c6d52d6a
embree3/3.12.0: Copying sources to build folder
embree3/3.12.0: Building your package in E:\conan_new\embree3\3.12.0__\build\15347b79d2fd32ede87f10f5f235e5a5c6d52d6a
embree3/3.12.0: Generator cmake created conanbuildinfo.cmake
embree3/3.12.0: Aggregating env generators
embree3/3.12.0: Calling build()
-- The C compiler identification is GNU 8.1.0
-- The CXX compiler identification is GNU 8.1.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: E:/conan_new/mingw-w64/8.1///package/6903a9d1b48b06f7fbe0929db654512c77e6cc32/bin/gcc.exe - 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: E:/conan_new/mingw-w64/8.1///package/6903a9d1b48b06f7fbe0929db654512c77e6cc32/bin/g++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Conan: called by CMake conan helper
-- Conan: called inside local cache
-- Conan: Adjusting output directories
-- Conan: Using cmake global configuration
-- Conan: Adjusting default RPATHs Conan policies
-- Conan: Adjusting language standard
-- Conan setting CPP STANDARD: 17 WITH EXTENSIONS OFF
-- Conan: Compiler GCC>=5, checking major version 8.1
-- Conan: Checking correct version: 8.1
-- Conan: C++ stdlib: libstdc++11
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Configuring done
-- Generating done
CMake Warning:
Manually-specified variables were not used by the project:

CMAKE_EXPORT_NO_PACKAGE_REGISTRY

-- Build files have been written to: E:/conan_new/embree3/3.12.0///build/15347b79d2fd32ede87f10f5f235e5a5c6d52d6a/build_subfolder
[ 1%] Building CXX object source_subfolder/common/math/CMakeFiles/math.dir/constants.cpp.obj
[ 2%] Building CXX object source_subfolder/common/simd/CMakeFiles/simd.dir/sse.cpp.obj
[ 3%] Building CXX object source_subfolder/common/sys/CMakeFiles/sys.dir/sysinfo.cpp.obj
[ 4%] Building CXX object source_subfolder/common/tasking/CMakeFiles/tasking.dir/taskschedulerinternal.cpp.obj
g++.exe:g++.exe: error: error: /EHsc: No such file or directory
/EHsc: No such file or directory
g++.exe:g++.exe: error: error: /MP: No such file or directory
/MP: No such file or directory
g++.exe: error: /GR: No such file or directory
/GR: No such file or directory
g++.exe:g++.exe: /Gy: No such file or directory
g++.exe:g++.exe:g++.exe:g++.exe: /MP: No such file or directory
/GS-: No such file or directory
g++.exe: g++.exe: error: error: error: /GR: No such file or directory
/Ox: No such file or directory
/Gy: No such file or directory
/Oi: No such file or directory
error: /GS-: No such file or directory
/D__SSE__: No such file or directory
/Ox: No such file or directory
/D__SSE2__: No such file or directory
g++.exe:g++.exe: error: error: /D__SSE__: No such file or directory
/Oi: No such file or directory
error: error: /D__SSE2__: No such file or directory
/D__SSE__: No such file or directory
mingw32-make.exe[2]: *** [source_subfolder\common\simd\CMakeFiles\simd.dir\build.make:76: source_subfolder/common/simd/CMakeFiles/simd.dir/sse.cpp.obj] Error 1
mingw32-make.exe[2]: *** [source_subfolder\common\math\CMakeFiles\math.dir\build.make:76: source_subfolder/common/math/CMakeFiles/math.dir/constants.cpp.obj] Error 1
g++.exe: error: mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:316: source_subfolder/common/simd/CMakeFiles/simd.dir/all] Error 2
mingw32-make.exe[1]: *** Waiting for unfinished jobs....
/D__SSE2__: No such file or directory
mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:290: source_subfolder/common/math/CMakeFiles/math.dir/all] Error 2
mingw32-make.exe[2]: *** [source_subfolder\common\sys\CMakeFiles\sys.dir\build.make:76: source_subfolder/common/sys/CMakeFiles/sys.dir/sysinfo.cpp.obj] Error 1
mingw32-make.exe[2]: *** Waiting for unfinished jobs....
mingw32-make.exe[2]: *** [source_subfolder\common\tasking\CMakeFiles\tasking.dir\build.make:76: source_subfolder/common/tasking/CMakeFiles/tasking.dir/taskschedulerinternal.cpp.obj] Error 1
mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:369: source_subfolder/common/tasking/CMakeFiles/tasking.dir/all] Error 2
[ 5%] Building CXX object source_subfolder/common/sys/CMakeFiles/sys.dir/alloc.cpp.obj
[ 6%] Building CXX object source_subfolder/common/sys/CMakeFiles/sys.dir/filename.cpp.obj
g++.exe: error: /EHsc: No such file or directory
g++.exe: error: /MP: No such file or directory
g++.exe: error: /GR: No such file or directory
g++.exe: error: /Gy: No such file or directory
g++.exe: error: /GS-: No such file or directory
g++.exe: error: /Ox: No such file or directory
g++.exe: error: /Oi: No such file or directory
g++.exe: error: /D__SSE__: No such file or directory
g++.exe: error: /D__SSE2__: No such file or directory
g++.exe: error: /EHsc: No such file or directory
g++.exe: error: /MP: No such file or directory
g++.exe: error: mingw32-make.exe[2]: *** [source_subfolder\common\sys\CMakeFiles\sys.dir\build.make:91: source_subfolder/common/sys/CMakeFiles/sys.dir/alloc.cpp.obj] Error 1
/GR: No such file or directory
g++.exe: error: /Gy: No such file or directory
g++.exe: error: /GS-: No such file or directory
g++.exe: error: /Ox: No such file or directory
g++.exe: error: /Oi: No such file or directory
g++.exe: error: /D__SSE__: No such file or directory
g++.exe: error: /D__SSE2__: No such file or directory
mingw32-make.exe[2]: *** [source_subfolder\common\sys\CMakeFiles\sys.dir\build.make:106: source_subfolder/common/sys/CMakeFiles/sys.dir/filename.cpp.obj] Error 1
mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:264: source_subfolder/common/sys/CMakeFiles/sys.dir/all] Error 2
mingw32-make.exe: *** [Makefile:155: all] Error 2
embree3/3.12.0:
embree3/3.12.0: ERROR: Package '15347b79d2fd32ede87f10f5f235e5a5c6d52d6a' build failed
embree3/3.12.0: WARN: Build folder E:\conan_new\embree3\3.12.0__\build\15347b79d2fd32ede87f10f5f235e5a5c6d52d6a
ERROR: embree3/3.12.0: Error in build() method, line 113
cmake.build()
ConanException: Error 2 while executing cmake --build E:\conan_new\embree3\3.12.0__\build\15347b79d2fd32ede87f10f5f235e5a5c6d52d6a\build_subfolder -- -j4

@akien-mga
Copy link
Contributor

For the record, we're building Embree with MinGW successfully in Godot Engine.

We're not using the CMake buildsystem though as we reimplement just the minimal stuff we need in our own SCons buildsystem: https://github.com/godotengine/godot/blob/master/modules/raycast/SCsub

There used to be crash issues but they have been ironed out in recent releases.

@AndreyMlashkin's issue seems to be that the CMake buildsystem still detects the configuration as being MSVC, so it tries to apply MSVC build flags instead of GCC/Clang-compatible ones. You might have better luck with a MinGW+LLVM distribution as there seems to be some code to handle it:
https://github.com/embree/embree/blob/d7157470e089098b9c7323f608835ed50453e606/CMakeLists.txt#L194-L196

But GCC isn't handled indeed (though it works well when not using CMake, but that's not a recommended workflow and a proper solution to this issue).

@syoyo
Copy link

syoyo commented Nov 22, 2021

There used to be crash issues but they have been ironed out in recent releases.

@akien-mga Awesome! Nice work!

@akien-mga
Copy link
Contributor

akien-mga commented Nov 22, 2021

Ah actually I forgot to mention/check, we do have some downstream patches: https://github.com/godotengine/godot/tree/master/thirdparty/embree/patches

Including one which does fix MinGW-related crashes IIRC: https://github.com/godotengine/godot/blob/master/thirdparty/embree/patches/godot-changes-misc.patch

Would be happy to work on upstreaming the non Godot-specific fixes if there's interest.
Edit: I PR'ed MinGW-related changes in #346.

@sean85914
Copy link

sean85914 commented Aug 15, 2022

OS: Windows 10
Mingw: x86-64 8.1.0 POSIX SEH RT V6 Rev0
CMake: 3.17.4
Embree version: Release 3.13.4 and master (489b746)

Problem:
After using CMake GUI to configure and generating Makefile, types
$ mingw32-make, it shows

[  0%] Building CXX object common/sys/CMakeFiles/sys.dir/sysinfo.cpp.obj
g++.exe: error: /D__SSE__: No such file or directory
g++.exe: error: /D__SSE2__: No such file or directory
g++.exe: error: /D__SSE3__: No such file or directory
g++.exe: error: /D__SSSE3__: No such file or directory
g++.exe: error: /D__SSE4_1__: No such file or directory
g++.exe: error: /D__SSE4_2__: No such file or directory
g++.exe: error: /arch:AVX: No such file or directory
mingw32-make[2]: *** [common\sys\CMakeFiles\sys.dir\build.make:82: common/sys/CMakeFiles/sys.dir/sysinfo.cpp.obj] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:268: common/sys/CMakeFiles/sys.dir/all] Error 2
mingw32-make: *** [Makefile:171: all] Error 2

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

5 participants