Subject: | |
From: | |
Reply To: | |
Date: | Sat, 18 Jul 2009 01:53:31 +0100 |
Content-Type: | TEXT/PLAIN |
Parts/Attachments: |
|
|
On Sat, 18 Jul 2009, Nicola Maggi wrote:
<snip>
>> About all I can suggest is adding -fPIC to the compilation of the .cc and
>> the the link line - you didn't specify how that was being compiled...
>
> If you mean how do I compile my shared library sources here is an
> excerpt from Makefile:
> ______________________________
> libReadoutModuleRAPS.so : okFrontPanelDLL.o raps.o DataChannelRAPS.o
> ReadoutModuleRAPS.o
> g++ -shared -fpic -LlibokFrontPanel.so -lROSCore -lers -lDFDebug
> ${LIBDIR} ${LIBS} -o libReadoutModuleRAPS.so okFrontPanelDLL.o
> ReadoutModuleRAPS.o DataChannelRAPS.o raps.o
>
> ReadoutModuleRAPS.o : ReadoutModuleRAPS.cpp
> ${CC} ${INCLUDES} -c -DLINUX -DDEBUG_LEVEL=3 $<
> DataChannelRAPS.o : DataChannelRAPS.cpp
> ${CC} ${INCLUDES} -c -DLINUX -DDEBUG_LEVEL=3 DataChannelRAPS.cpp
> raps.o: raps.cpp
> g++ ${INCLUDES} -DDEBUG_LEVEL=3 -DLINUX -c $<
> okFrontPanelDLL.o: okFrontPanelDLL.cpp
> g++ -fPIC -DLINUX -c $<
> ______________________________
> Just ignore all the -l switches becouse those are other libraries
> which works just fine..
> the only important one is -LlibokFrontPanel.so which calls the FPGA
> shared library.
>
> As you can see I'm already using -fPIC to compile the cpp library
> wrapper but I don't really know if I should use it to compile the
> other files too.
Actually you are using -fpic on the line which links/creates the shared
library, but are not specifying pic for _compiling_ all the code which is
going into it.
ie try adding -fPIC to the lines which generate ReadoutModuleRAPS.o,
DataChannelRAPS.o and raps.o - since they need to be pic as well since
they are going into the final .so file (as well as okFrontPanelDLL.o which
is being compiled -fPIC).
BTW while on many system -fpic and -fPIC generate the same code you should
be consistent and pick one - at the moment you have both -fpic and -fPIC
which may clash.
-- Jon
|
|
|