Link error with TOOLLINKOPTS=-ldbghelp on MinGW

Hi LLVM'ers

When linking tblgen tool I get below error message on MinGW.

I have put TOOLLINKOPTS=-ldbghelp in Makefile.config.

However, when rearranging library dbghelp to the end of the g++
line, tblgen gets linked.

Henrik Bach wrote:

Hi LLVM'ers

When linking tblgen tool I get below error message on MinGW.

I have put TOOLLINKOPTS=-ldbghelp in Makefile.config.

However, when rearranging library dbghelp to the end of the g++
line, tblgen gets linked.

It seems that the -L path options are specified before the LLVM libraries (libSystem and libsupport) are linked in. I think g++ may only search linker paths that are specified before a library is specified.

Perhaps you need to make sure that all library paths are specified before listing the libraries to link in.

In other words,

g++ -Lpath1 -Lpath2 -ldbghelp -lSystem

...instead of...

g++ -ldbghelp -lSystem -Lpath1 -Lpath2

Just a guess; can anyone verify this?

-- John T.

John Criswell wrote:

It seems that the -L path options are specified before the LLVM libraries (libSystem and libsupport) are linked in. I think g++ may only search linker paths that are specified before a library is specified.

Perhaps you need to make sure that all library paths are specified before listing the libraries to link in.

In other words,

g++ -Lpath1 -Lpath2 -ldbghelp -lSystem

...instead of...

g++ -ldbghelp -lSystem -Lpath1 -Lpath2

Just a guess; can anyone verify this?

That's my understanding too.

REid.