Looks like this project is a bit overzealous with the compiler flags, so I can probably work around this. Same error occurs using CXX=clang++37. [ 3%] Building CXX object third_party/vectorGraphics/CMakeFiles/main_svgSample.dir/main.cpp.o cd /usr/wip/graphics/openmvg/work/.build/third_party/vectorGraphics && /usr/bin/c++ -DHAVE_CXX11_CHRONO -DHAVE_CXX11_THREAD -DOPENMVG_USE_CXX11 -I/usr/local/include/eigen3 -O2 -pipe -fstack-protector -fno-strict-aliasing -mno-sse2 -mno-sse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -mno-sse4a -mno-avx -mno-xop -mno-fma4 -mno-avx2 --std=c++11 -fPIC -O3 -o CMakeFiles/main_svgSample.dir/main.cpp.o -c /usr/wip/graphics/openmvg/work/openmvg-2016.09.06/src/third_party/vectorGraphics/main.cpp Stack dump: 0. Program arguments: /usr/bin/c++ -cc1 -triple x86_64-unknown-freebsd10.3 -emit-obj -disable-free -disable-llvm-verifier -main-file-name main.cpp -mrelocation-model pic -pic-level 2 -mdisable-fp-elim -relaxed-aliasing -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-feature -sse2 -target-feature -sse3 -target-feature -ssse3 -target-feature -sse4.1 -target-feature -sse4.2 -target-feature -sse4a -target-feature -avx -target-feature -xop -target-feature -fma4 -target-feature -avx2 -coverage-file /usr/wip/graphics/openmvg/work/.build/third_party/vectorGraphics/CMakeFiles/main_svgSample.dir/main.cpp.o -resource-dir /usr/bin/../lib/clang/3.4.1 -D HAVE_CXX11_CHRONO -D HAVE_CXX11_THREAD -D OPENMVG_USE_CXX11 -I /usr/local/include/eigen3 -internal-isystem /usr/include/c++/v1 -O3 --std=c++11 -fdeprecated-macro -fdebug-compilation-dir /usr/wip/graphics/openmvg/work/.build/third_party/vectorGraphics -ferror-limit 19 -fmessage-length 81 -stack-protector 1 -mstackrealign -fobjc-runtime=gnustep -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -o CMakeFiles/main_svgSample.dir/main.cpp.o -x c++ /usr/wip/graphics/openmvg/work/openmvg-2016.09.06/src/third_party/vectorGraphics/main.cpp 1. <eof> parser at end of file 2. Code generation 3. Running pass 'Function Pass Manager' on module '/usr/wip/graphics/openmvg/work/openmvg-2016.09.06/src/third_party/vectorGraphics/main.cpp'. 4. Running pass 'X86 Assembly / Object Emitter' on function '@main' c++: error: unable to execute command: Segmentation fault (core dumped) c++: error: clang frontend command failed due to signal (use -v to see invocation) FreeBSD clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512 Target: x86_64-unknown-freebsd10.3 Thread model: posix c++: note: diagnostic msg: PLEASE submit a bug report to https://bugs.freebsd.org/submit/ and include the crash backtrace, preprocessed source, and associated run script. c++: note: diagnostic msg: ******************** PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT: Preprocessed source(s) and associated run script(s) are located at: c++: note: diagnostic msg: /tmp/main-d0045f.cpp c++: note: diagnostic msg: /tmp/main-d0045f.sh c++: note: diagnostic msg: ******************** *** Error code 254 Stop. make[3]: stopped in /usr/wip/graphics/openmvg/work/.build *** Error code 1
I worked around the issue by removing their OptimizeForArchitecture CMake module. post-patch: ${REINPLACE_CMD} \ -e '/OptimizeForArchitecture/d' \ -e 's|-O3|-O2|g' \ ${WRKSRC}/src/CMakeLists.txt The port is building successfully with vanilla compiler flags. If you want to reproduce the problem, look at graphics/openmvg here: https://github.com/outpaddling/freebsd-ports-wip Disable the patch shown above and the issue should appear. I was able to reproduce it on 10.1 and 10.3 amd64. Jason
(In reply to Jason Bacon from comment #0) > PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT: > Preprocessed source(s) and associated run script(s) are located at: > c++: note: diagnostic msg: /tmp/main-d0045f.cpp > c++: note: diagnostic msg: /tmp/main-d0045f.sh Can you please attach these two files?
Created attachment 174864 [details] Debug files saved by clang crash As requested. The .cpp file was too big for an attachment, hence the tarball.
I can reproduce this with clang trunk r281149; reported upstream as PR30426 [1]. The problem seems to be caused by the openMVG build system disabling use of SSE, and this confuses llvm, because the target is x86_64. Any idea why openMVG's build system wants this? I would try to work around it by getting rid of the "-mno-sse2 -mno-sse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -mno-sse4a -mno-avx -mno-xop -mno-fma4 -mno-avx2" flags. On x86_64, at least SSE2 is always available, there is no good reason to disable it. [1] https://llvm.org/bugs/show_bug.cgi?id=30426
Thanks. Their OptimizeForArchitecture.cmake module is 473 lines long and has not been tested on many platforms, so I'm not surprised it has bugs. I've already worked around it by replacing the module with a simple -O2. That should be the default for packaging anyway. If I have time in the future I may try to fix it offer it as a port option. I mainly wanted to report the problem so the clang seg fault could be isolated. Regards, JB
Newer clang has since been imported and I don't believe this is an issue anymore.