Recompile with -fPIC
-
Any idea how to solve this error? it happens at the linking stage. I tried setting the flag in the JUCE file but it made no difference so I assume it is something else that needs to be compiled with the flag set.
/usr/bin/ld: build/Sofia Woodwinds.a(BinaryData_ce4232d4.o): relocation R_X86_64_PC32 against symbol `_ZN10BinaryData13infoError_pngE' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: final link failed: Bad value collect2: error: ld returned 1 exit status make: *** [build/Sofia Woodwinds.so] Error 1 Compiling finished. Cleaning up...
-
I saw this link:
https://stackoverflow.com/questions/19768267/relocation-r-x86-64-32s-against-linking-error
It shows how to check if your static library was compiled with -fPIC
-
Well I did make clean and resaved the jucer file and magically that issue vanished!
Now I'm getting this when compiling the standalone
/usr/bin/ld: build/intermediate/Release/include_juce_gui_basics_e3f79785.o: undefined reference to symbol 'XShmGetEventBase' //usr/lib/x86_64-linux-gnu/libXext.so.6: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status make: *** [build/Sofia Woodwinds] Error 1
Any ideas? I've reinstalled libxext-dev and libx11-dev just in case but it made no difference.
-
This might help?
"You should mention the library on the command line after the object files being compiled.
Explanation: the linking is dependent on the order of modules. Symbols are first requested, and then linked in from a library that has them. So you have to specify modules that use libraries first, and libraries after them. " -
@dustbro Yeah I saw that too. I'm using the auto-generated files from HISE but looks like I might have to start tinkering with them to see if I can get it to work.
-
Turns out I had this fPIC issue before and forgot about it, also explains the solution
https://forum.hise.audio/topic/940/linux-dependency-issue/23