ETL test hangs when linking benchmark if CXX is non-FSF g++

On OS X 10.7, where the default compiler is clang (also ships with llvm-g++), running ‘make check’ hangs when linking benchmark (from benchmark.o).

This is the compiler line:

g++ -W -Wall -DNDEBUG -O2 -I.. -I../ETL -W -Wall -DNDEBUG -O2  -L/sw/lib -o benchmark benchmark.o  -lpthread

I’ve let ‘make check’ run for over 90 minutes with the clang process stuck in the same place and running at 100%. If I change the compiler to to llvm-g++ (the other compiler included with OS X but removed in the upcoming OS X 10.9 release), the build process also hangs. The tests only finish building if I use an actual FSF g++ (v4.8) compiler for the tests (in this case, g+±4.8 comes from Fink). Depending on FSF g++ is suboptimal since it is a large program that users must first install, so it would be nice to fix it to build with clang.

What can I do to try and trace the hang location in benchmark.c?

I currently have OSX 10.8 so I’m unsure to be able to reproduce your test. Anyway I’ll try to do it exactly with you command to see what happens.

Compiling shouldn’t take that long unless your make command execute the tests an for some reason those tests hang.

I don’t understand exactly which are the commands you use to produce the hang. Can you write down the recipe starting from grabbing the source code?

Also, why do you enable debug for the tests? Shouldn’t they be used on release mode?


I’m not doing anything fancy to cause the hang:

cd /src tar xf /src/ETL-0.04.16.tar.gz cd ETL-0.04.16 ./configure make make check

All the flags for the compiler are picked automatically. I’m not setting anything in the environment to modify them. Here’s the configuration summary that I get after ./configure:

[code]Configuration Summary

Install Prefix -------------------> /usr/local
Target Platform ------------------> x86_64-apple-darwin11.4.2
Debug Mode -----------------------> no

$CXX ------------------------------> ‘g++’
$CXXFLAGS -------------------------> ’ -W -Wall -DNDEBUG -O2’[/code]

I did a test, and using the ./configure flag ‘–enable-optimization’, the hang happens whenever optimization is set to 1 or higher (2 is the default). At -O0, the tests programs all compile and the tests finish.

Correction: the problem is with compiling fixed.o, NOT with linking benchmark as I had originally thought (there was a -j8 kicking in that I hadn’t seen). When I use -j1, the hang is clear:

g++ -DHAVE_CONFIG_H -I.. -I../ETL   -I/sw/include -W -Wall -DNDEBUG -O2 -I.. -I../ETL -W -Wall -DNDEBUG -O2 -MT fixed.o -MD -MP -MF .deps/fixed.Tpo -c -o fixed.o fixed.cpp

I am currently working around it with this patch to force -O0 for fixed.o only:

[code]diff -ruN ETL-0.04.16-orig/test/ ETL-0.04.16/test/
— ETL-0.04.16-orig/test/ 2013-05-09 12:32:44.000000000 -0400
+++ ETL-0.04.16/test/ 2013-08-01 15:29:08.000000000 -0400
@@ -381,6 +381,10 @@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/surface.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/value.Po@am__quote@

+@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -O0 -MT $@ -MD -MP -MF $(DEPDIR)/$.Tpo -c -o $@ $(fixed_SOURCES)
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$
.Tpo $(DEPDIR)/$.Po
@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$
.Tpo -c -o $@ $<
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$.Tpo $(DEPDIR)/$.Po[/code]