I am using the native-maven-plugin to compile a shared library on linux. I pass the compiler option -g
to enable the debug symbol generation. Here is an excerpt from the POM:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>native-maven-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<workingDirectory></workingDirectory>
<compilerStartOptions>
<compilerStartOption>-g</compilerStartOption>
</compilerStartOptions>
<linkerStartOptions>
<linkerStartOption>-shared</linkerStartOption>
<linkerStartOption>-g</linkerStartOption>
</linkerStartOptions>
<sources>
...
</sources>
</configuration>
</plugin>
The native-maven-plugin alsways uses absolute paths to the source files when invoking gcc. This results in absolute paths in the debug symbols, too.
The output of nm -l libfoo.so
listing the debug symbols looks like:
0000797a T GetTickCount /home/myusername/projects/blabla/foo.c:3005
As you can see the source file path is absolute and includes my username and project structure. I don't want that. How can I change the debug symbols to relative path names?