aras-p / ClangBuildAnalyzer

Clang build analysis tool using -ftime-trace
The Unlicense
970 stars 61 forks source link

Compilation on CentOS6 fails at link time with undefined reference errors #44

Closed cpierret closed 4 years ago

cpierret commented 4 years ago

I know CentOS6 is not very current, but I needed to add the -lrt flag to linker in projects/make/Makefile otherwise I would get undefined reference to `clock_gettime' errors.

As in:

diff --git a/projects/make/Makefile b/projects/make/Makefile
index f7b14dd..2e79ff2 100644
--- a/projects/make/Makefile
+++ b/projects/make/Makefile
@@ -30,7 +30,7 @@ clean:
        rm -f build/ClangBuildAnalyzer $(C_OBJS) $(CPP_OBJS)

 build/ClangBuildAnalyzer: $(C_OBJS) $(CPP_OBJS)
-       $(CXX) -o $@ $(C_OBJS) $(CPP_OBJS) $(LDFLAGS) -lpthread
+       $(CXX) -o $@ $(C_OBJS) $(CPP_OBJS) $(LDFLAGS) -lrt -lpthread

 build/%.o: %.c
        mkdir -p $(dir $@)
aras-p commented 4 years ago

Thanks! Added link to rt to both the makefile & cmake script