سؤال

I'm using gnu autotools with my project in C++ (the autotools config is automatically generated by eclipse cdt, but this does not matter i think). I'm using LLVM libs and right now I'm facing a problem with order of linker flags.

Basically, when building a project, eclipse executes "make". Make executes a lot of commands, but lastly it executes g++ compiler as follows:

g++ -DPACKAGE_NAME=\"test\" -DPACKAGE_TARNAME=\"test\" -DPACKAGE_VERSION=\"1.0\" -DPACKAGE_STRING=\"test\ 1.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"test\" -DVERSION=\"1.0\" -I.    `llvm-config --cppflags --ldflags --libs core` -g -O2 -MT test.o -MD -MP -MF .deps/test.Tpo -c -o test.o test.cpp
mv -f .deps/test.Tpo .deps/test.Po

and then the linker:

g++ `llvm-config --cppflags --ldflags --libs core` -g -O2   -o a.out test.o

The problem is, that the linker fails if the argument "test.o" is not on the beginning of line, so it should be:

g++ test.o `llvm-config --cppflags --ldflags --libs core` -g -O2   -o a.out

How to change it in Makefile.am or any config file for gnu autotools?

هل كانت مفيدة؟

المحلول

I didn't found the answer, but so far I have found out that LLVM is bundled with a project template containing custom automake system, which handles all the stuff the correct way.

If you want to access the template, you can find it in $LLVMSRC/projects/sample folder.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top