mitsuba-renderer / mitsuba

Mitsuba renderer main repository
GNU General Public License v3.0
1.05k stars 321 forks source link

【MAC】build failed #156

Closed dandingol03 closed 2 years ago

dandingol03 commented 2 years ago

OS: Mac big sur python version: 2.7.16

log as below:

Checking for Qt 5.x... yes
Checking for clang++ ...no
Could not compile a simple C++ fragment, verify that clang++ is installed! This could also mean that the Boost libraries are missing. The file "config.log" should contain more information.

In file included from .sconf_temp/conftest_0.cpp:1:
In file included from /usr/local/opt/llvm@9/bin/../include/c++/v1/sstream:173:
In file included from /usr/local/opt/llvm@9/bin/../include/c++/v1/ostream:138:
In file included from /usr/local/opt/llvm@9/bin/../include/c++/v1/ios:215:
In file included from /usr/local/opt/llvm@9/bin/../include/c++/v1/__locale:14:
In file included from /usr/local/opt/llvm@9/bin/../include/c++/v1/string:504:
In file included from /usr/local/opt/llvm@9/bin/../include/c++/v1/string_view:175:
In file included from /usr/local/opt/llvm@9/bin/../include/c++/v1/__string:56:
In file included from /usr/local/opt/llvm@9/bin/../include/c++/v1/algorithm:643:
In file included from /usr/local/opt/llvm@9/bin/../include/c++/v1/memory:667:
In file included from /usr/local/opt/llvm@9/bin/../include/c++/v1/atomic:553:
dependencies/version:1:1: error: expected unqualified-id
0.6.0
^
In file included from .sconf_temp/conftest_0.cpp:1:
In file included from /usr/local/opt/llvm@9/bin/../include/c++/v1/sstream:173:
In file included from /usr/local/opt/llvm@9/bin/../include/c++/v1/ostream:138:
In file included from /usr/local/opt/llvm@9/bin/../include/c++/v1/ios:215:
In file included from /usr/local/opt/llvm@9/bin/../include/c++/v1/__locale:14:
In file included from /usr/local/opt/llvm@9/bin/../include/c++/v1/string:504:
In file included from /usr/local/opt/llvm@9/bin/../include/c++/v1/string_view:175:
In file included from /usr/local/opt/llvm@9/bin/../include/c++/v1/__string:56:
In file included from /usr/local/opt/llvm@9/bin/../include/c++/v1/algorithm:643:
In file included from /usr/local/opt/llvm@9/bin/../include/c++/v1/memory:667:
/usr/local/opt/llvm@9/bin/../include/c++/v1/atomic:1019:73: error: unknown type name 'ptrdiff_t'
_Tp* __cxx_atomic_fetch_add(__cxx_atomic_base_impl<_Tp*> volatile* __a, ptrdiff_t __delta, memory_order __order) _NOEXCEPT {
                                                                        ^
/usr/local/opt/llvm@9/bin/../include/c++/v1/atomic:1024:65: error: unknown type name 'ptrdiff_t'
_Tp* __cxx_atomic_fetch_add(__cxx_atomic_base_impl<_Tp*> * __a, ptrdiff_t __delta, memory_order __order) _NOEXCEPT {
                                                                ^
/usr/local/opt/llvm@9/bin/../include/c++/v1/atomic:1040:73: error: unknown type name 'ptrdiff_t'
_Tp* __cxx_atomic_fetch_sub(__cxx_atomic_base_impl<_Tp*> volatile* __a, ptrdiff_t __delta, memory_order __order) _NOEXCEPT {
                                                                        ^
/usr/local/opt/llvm@9/bin/../include/c++/v1/atomic:1045:65: error: unknown type name 'ptrdiff_t'
_Tp* __cxx_atomic_fetch_sub(__cxx_atomic_base_impl<_Tp*> * __a, ptrdiff_t __delta, memory_order __order) _NOEXCEPT {
                                                                ^
/usr/local/opt/llvm@9/bin/../include/c++/v1/atomic:1679:20: error: unknown type name 'ptrdiff_t'
    _Tp* fetch_add(ptrdiff_t __op, memory_order __m = memory_order_seq_cst)
                   ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
scons: Configure: no
wenjian-zhou commented 2 years ago

I have the same problem like you, did you fix it?

merlinND commented 2 years ago

Hi,

After digging a little, it seems that on macOS, the following header include:

#include <version>

accidentally resolves to dependencies/version. A quick workaround is to rename it to dependencies/version.txt, and update SConscript.configure to refer to the new filename:

diff --git a/build/SConscript.configure b/build/SConscript.configure
index baca8b74..c98f0345 100644
--- a/build/SConscript.configure
+++ b/build/SConscript.configure
@@ -281,7 +281,7 @@ else:
 Export('MTS_VERSION')

 if needsBuildDependencies:
-        versionFilename = GetBuildPath('#dependencies/version')
+        versionFilename = GetBuildPath('#dependencies/version.txt')
         versionMismatch = False

         if not os.path.exists(versionFilename):

I'm opening a couple of PRs to integrate those changes.

By the way, in case you're using the scons-python3 branch, I've just updated it to stop using has_key method which was removed. I tested it with SCons 4.3.0.