[cfe-dev] Using Clang -O4 with CMake

Eric Christopher echristo at apple.com
Fri Jun 18 20:07:33 PDT 2010


On Jun 18, 2010, at 8:01 PM, Clark Gaebel wrote:

> When trying out -O4 instead of my usual -O3 on my C++ code using CMake,
> I got this error...
> 
> Linking CXX executable test_memory
> cd /home/clark/dev/cpp/GoGo/build/util/test && /usr/bin/cmake -E
> cmake_link_script CMakeFiles/test_memory.dir/link.txt --verbose=1
> /usr/local/bin/clang++     
> CMakeFiles/test_memory.dir/test_memory.cpp.o  -o test_memory -rdynamic
> -lboost_filesystem-mt-1_42 -lboost_iostreams-mt-1_42
> -lboost_program_options-mt-1_42 -lboost_regex-mt-1_42
> -lboost_serialization-mt-1_42 -lboost_signals-mt-1_42
> -lboost_thread-mt-1_42 -lboost_wave-mt-1_42
> CMakeFiles/test_memory.dir/test_memory.cpp.o: file not recognized: File
> format not recognized
> collect2: ld returned 1 exit status
> 
> What am I doing wrong? This works fine on every other optimization
> setting. Literally, the only thing I did differently was -O4 instead of -O3.

O4 means use lto.  What platform are you on? Does it support llvm lto? :)

And I have no idea if the cmake files are set up for that either.

-eric



More information about the cfe-dev mailing list