Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
Option to select the linker - auto detect mode
manuelS:
--- Quote ---Why do you need a C++ linker in the first place?
--- End quote ---
I basically still use the toolchain setup that came from the supplier of the hardware and bios libraries. Never thought about changing it.
--- Quote ---Are you linking to a C++ static library?
--- End quote ---
My own libraries are all c, but about the bios-libraries, I can't tell.
--- Quote ---What are the linker errors you have?
--- End quote ---
I just have one with one of the bios-libraries:
--- Code: ---tricore-gcc.exe -L..\libs -o ..\result\cflr25.elf ..\temp\cflr25\cflr25main.o ..\temp\cflr25\cflr25param.o ..\temp\cflr25\doha.o -mcpu=TC1796 -Wl,--relax-bdata -Wl,--relax-24rel -nostartfiles -Wl,-Map=../temp/cflr25.map -T esx3xl_link_extflash.ld -Wl,-Map=..\result\cflr25.map ..\result\cMultitr.a ..\result\esx3b06.a ..\result\esx3mbIO.a ..\result\LstdLib.a ..\result\paramCan.a ..\result\schmaCan.a ..\result\scomLib.a ..\result\SGlib.a ..\result\sx3_err.a ..\result\emr3X.a ..\result\dirBremse.a ..\libs\libeb06.a ..\libs\libesx3xl.a ..\result\X3_at68.a ..\result\vera.a ..\result\speedControl.a
..\libs\libeb06.a(eb06_pid_control.o): In function `eb06_pid_init':
eb06_pid_control.o(.text+0x12a): undefined reference to `nanf'
--- End code ---
--- Quote ---Have you done a full rebuild of all dependent libraries (they might be C only but still use the C++ linker, which means they are not C++ libs)?
--- End quote ---
I did a rebuild on all of my own libraries.
oBFusCATed:
Hm, interesting.
nanf is not a C++ symbol, so I guess the C++ linker is linking to some library you're missing.
I guess this is a bug in your project - under-specifying the required libraries.
I think this symbol is in libm, so you should be able to fix the build using -lm, but this might be different for your target.
Please inspect the manual of the compiler/linker, how to solve this.
To debug this you could probably execute the g++ and gcc commands in a terminal. Adding -v or -vv (or something similar, check the manual for the exact switch) you can see the difference in the commands executed by the two executions. I think -v make gcc to print all the commands it executes (the preprocessor, compiler, assembler and linker).
manuelS:
I tried a little more testing today. First I reduced the application to only one function call in the main function.
--- Quote ---I think this symbol is in libm, so you should be able to fix the build using -lm, but this might be different for your target
--- End quote ---
I tried it, "-lm" is the right lib, but the following happens:
- "Auto detect" or "Use C compiler", adding "-lm" to last line in "Project build options"->"Linker Settings"->"Other linker options"-> lib command order for -ld.exe becomes:"... -lm -leb06 ..." (which is wrong order)
- "Use C++ compiler", with or WITHOUT adding "-lm" to last line in "Project build options"->"Linker Settings"->"Other linker options"-> lib command order for -ld.exe becomes: "-leb06 -lstdc++ -lm" (which is the correct order)
The linking works with the "Auto detect" and "Use C compiler", if I append "libm.a" to the list of "Link libraries" (where libeb06.a is placed) and don't use "Other linker options" for it. But I guess this lib should be included via "Other linker options".
Why doesn't "-lm" go to the end of the lib list for the linker?
stahta01:
You should add "m" to the linker library list. Adding it to the other linker settings is not correct in most if not all cases. Edit: This is true for all libraries to be linked
Tim S.
manuelS:
Hello Tim, thanks a lot. It's working this way! For my understanding just, "Other linker options" is not intended to ever add any compiler libs?
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version