|
Re: Linker issues and pkg-config [message #1715481 is a reply to message #1715432] |
Tue, 24 November 2015 01:38 |
David Vavra Messages: 1426 Registered: October 2012 |
Senior Member |
|
|
The message with -fPIC is a clue.
These may help:
https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options (look for -fPIC)
http://stackoverflow.com/questions/332767/recompile-with-fpic-option-but-the-option-is-already-in-the-makefile
But this is for generating a library and your command line seems to want to build an executable.
So why use the -shared option? It's for producing a shared library.
https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html#Link-Options (look for -shared)
You need to use at least `pkg-config --libs jack` on the link line. It sets the lib options needed for libjack.
You need to use at least `pkg-config --cflags jack` on the compile line to get the cflags needed for using libjack.
It's OK to combine --cflags and --libs as gcc will use just what it needs.
When using Eclipse, you have to modify the the tool chain commands found in
Project ==> Properties ==> C/C++ Build ==> Settings
A problem arises if Eclipse doesn't start the commands in a shell. If this is the case (and I think it is) then the back quotes will be passed to gcc which has no idea what to do with them.
I't probably best to make two build variables (say, JACKCFLAGS and JACKLFLAGS) in Project ==> Properties ==> C/C++ Build ==>Build Variables using the Add... button and paste the output of pkg-config --cflags jack and pkg-config --libs jack respectively as the values.
You then would modify the tool chain settings to use ${JACKCFLAGS} in the compiler command and ${JACKLFLAGS} in the linker command
[Updated on: Tue, 24 November 2015 02:00] Report message to a moderator
|
|
|
Re: Linker issues and pkg-config [message #1715492 is a reply to message #1715481] |
Tue, 24 November 2015 04:11 |
Joe C. Messages: 5 Registered: November 2015 |
Junior Member |
|
|
Thanks for the time put into that response, David! Much appreciated!
Quote:So why use the -shared option? It's for producing a shared library.
That was a big clue, the "shared" option was checked by default (and I didn't even think to look there). After unchecking that, the -fPIC error went away, and creating JACKLFLAGS with a value of -ljack solved the other problems (there was no output from --cflags).
Cheers, Joe
[Updated on: Tue, 24 November 2015 04:12] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.03588 seconds