dariomanesku / cmft

Cross-platform open-source command-line cubemap filtering tool.
Other
826 stars 94 forks source link

osx build failed #35

Open velkyel opened 7 years ago

velkyel commented 7 years ago
$ make osx-release64
./dependency/bx/tools/bin/darwin/genie --file=scripts/main.lua --gcc=osx gmake
Building configurations...
Running action 'gmake'...
Generating _projects/gmake-osx/Makefile...
Generating _projects/gmake-osx/cmft_cli.make...
Generating _projects/gmake-osx/cmft.make...
Done.
make -R -C _projects/gmake-osx config=release64
==== Building cmft_cli (release64) ====
Creating ../../_build/osx64_clang/bin
Creating ../../_build/osx64_clang/obj/x64/Release/cmft_cli
allocator.cpp
clcontext.cpp
cubemapfilter.cpp
../../src/cmft/cubemapfilter.cpp:2150:54: fatal error: no matching constructor for initialization of 'std::thread'
                    cpuThreads[activeCpuThreads++] = std::thread(radianceFilterCpu, (void*)&taskList);
                                                     ^           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/include/c++/v1/thread:391:9: note: candidate constructor template not viable: requires single argument '__f', but 2 arguments
      were provided
thread::thread(_Fp __f)
        ^
/Library/Developer/CommandLineTools/usr/include/c++/v1/thread:286:5: note: candidate constructor not viable: requires 1 argument, but 2 were provided
    thread(const thread&);
    ^
/Library/Developer/CommandLineTools/usr/include/c++/v1/thread:293:5: note: candidate constructor not viable: requires 0 arguments, but 2 were provided
    thread() _NOEXCEPT : __t_(0) {}
    ^
1 error generated.
make[2]: *** [../../_build/osx64_clang/obj/x64/Release/cmft_cli/src/cmft/cubemapfilter.o] Error 1
make[1]: *** [cmft_cli] Error 2
make: *** [osx-release64] Error 2

g++ --version

Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 9.0.0 (clang-900.0.38)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

Do I need brew gnu g++?

dariomanesku commented 7 years ago

Hmm... I'm not sure, I don't have an OSX at hand at the moment. I guess specifying --std=c++11 will help. Try adding this:

    configuration { "osx" }
        buildoptions
        {
            "-std=c++11",
        }

to scripts/cmft.lua and see if it helps.

velkyel commented 7 years ago

It helps when I put this build option in cmft.lua and cmft_cli.lua too. Thank you.

velkyel commented 7 years ago

FYI: I have to use --useOpenCL false otherwise it crash.

hw info:

./cmft --printCLDevices
CMFT info: Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz --clVendor Apple  --deviceIndex 0 --deviceType cpu
CMFT info: HD Graphics 4000                         --clVendor Apple  --deviceIndex 1 --deviceType gpu

lldb session and backtrace on --useOpenCL true:

(lldb) target create "./cmft"
Current executable set to './cmft' (x86_64).
(lldb) settings set -- target.run-args  "--useOpenCL" "true" "--input" "../../textures/garage_environment.png" "--filter" "radiance" "--srcFaceSize" "256" "--excludeBase" "true" "--mipCount" "7" "--glossScale" "10" "--glossBias" "2" "--dstFaceSize" "256" "--generateMipChain" "false" "--outputNum" "1" "--output0" "a" "--output0params" "dds,bgra8,cubemap"
(lldb) r
Process 8343 launched: './cmft' (x86_64)
CMFT info: Converting cube cross to cubemap.
CMFT info: Resizing source image from 1024x1024 to 256x256.
CMFT info: Running radiance filter for:
    [srcFaceSize=256]
    [lightingModel=phong]
    [excludeBase=true]
    [mipCount=7]
    [glossScale=10]
    [glossBias=2]
    [dstFaceSize=256]
CMFT info: Radiance -> Excluding base image.
CMFT info: Radiance -> Starting filter...
CMFT info: Radiance -> Utilizing 64 CPU processing threads and HD Graphics 4000.
CMFT info: Radiance -> ------------------------------------
CMFT info: Radiance ->  Device / Face /     Time /    Total
CMFT info: Radiance -> ------------------------------------
2017-11-09 17:41:17.435656+0100 cmft[8343:101328] [CL_INVALID_EVENT] : OpenCL Error : Failed to retrieve event information! Given event is invalid!
libc++abi.dylib: terminating
Process 8343 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
    frame #0: 0x00007fffc2ebdd42 libsystem_kernel.dylib`__pthread_kill + 10
libsystem_kernel.dylib`__pthread_kill:
->  0x7fffc2ebdd42 <+10>: jae    0x7fffc2ebdd4c            ; <+20>
    0x7fffc2ebdd44 <+12>: movq   %rax, %rdi
    0x7fffc2ebdd47 <+15>: jmp    0x7fffc2eb6caf            ; cerror_nocancel
    0x7fffc2ebdd4c <+20>: retq   
Target 0: (cmft) stopped.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
  * frame #0: 0x00007fffc2ebdd42 libsystem_kernel.dylib`__pthread_kill + 10
    frame #1: 0x00007fffc2fab457 libsystem_pthread.dylib`pthread_kill + 90
    frame #2: 0x00007fffc2e23420 libsystem_c.dylib`abort + 129
    frame #3: 0x00007fffc197b94a libc++abi.dylib`abort_message + 266
    frame #4: 0x00007fffc19a0b52 libc++abi.dylib`default_terminate_handler() + 46
    frame #5: 0x00007fffc199dd49 libc++abi.dylib`std::__terminate(void (*)()) + 8
    frame #6: 0x00007fffc199ddd0 libc++abi.dylib`std::terminate() + 64
    frame #7: 0x0000000100008aa7 cmft`cmft::imageRadianceFilter(cmft::Image&, unsigned int, cmft::LightingModel::Enum, bool, unsigned char, unsigned char, unsigned char, cmft::Image const&, cmft::EdgeFixup::Enum, unsigned char, cmft::ClContext*, cmft::AllocatorI*) [inlined] std::__1::thread::operator=(this=0x00007fff5fbe6d90, __t=0x00007fff5fbe4c20) at thread:413
    frame #8: 0x0000000100008a91 cmft`cmft::imageRadianceFilter(_dst=0x00007fff5fbe6e10, _dstFaceSize=256, _lightingModel=Phong, _excludeBase=true, _mipCount='\a', _glossScale='\n', _glossBias='\x02', _src=0x00007fff5fbe7090, _edgeFixup=None, _numCpuProcessingThreads='?', _clContext=0x0000000100056e88, _allocator=0x000000010004b638) at cubemapfilter.cpp:2156
    frame #9: 0x0000000100009ee8 cmft`cmft::imageRadianceFilter(_image=0x00007fff5fbe7090, _dstFaceSize=256, _lightingModel=Phong, _excludeBase=true, _mipCount='\a', _glossScale='\n', _glossBias='\x02', _edgeFixup=None, _numCpuProcessingThreads='?', _clContext=0x0000000100056e88, _allocator=0x000000010004b638) at cubemapfilter.cpp:2265
    frame #10: 0x000000010003e402 cmft`cmftMain(_argc=27, _argv=0x00007fff5fbff988) at cmft_cli.h:1020
    frame #11: 0x000000010003e9c2 cmft`main(_argc=27, _argv=0x00007fff5fbff988) at main.cpp:22
    frame #12: 0x00007fffc2d8f235 libdyld.dylib`start + 1
    frame #13: 0x00007fffc2d8f235 libdyld.dylib`start + 1
(lldb)