[reSIProcate] building shared libraries on AMD64
Byron Campen
bcampen at estacado.net
Fri Sep 22 15:32:08 CDT 2006
Hrm, looks like the object files need to be compiled with -fPIC too.
I will try the following slightly different patch:
Index: build/Makefile.tools
===================================================================
--- build/Makefile.tools (revision 6598)
+++ build/Makefile.tools (working copy)
@@ -43,6 +43,12 @@
LNDIR = $(shell pwd)/$(ROOT)/build/lndir.sh
CFLAGS += -Wall
CXXFLAGS += -Wall
+
+ifeq ($(BUILD_SHARED_LIBS),yes)
+CFLAGS += -fPIC
+CXXFLAGS += -fPIC
+endif
+
DFLAG_INTEGRATED = -MMD
DEBUG_FLAG = -g
COMPILE_SMALL_FLAG = -Os -fno-inline -fno-keep-static-consts
Best regards,
Byron Campen
> hi Byron
>
> here is the error when building rutil shared:
>
>
> gcc -fPIC -shared -o obj.debug.Linux.x86_64/librutil.so
> obj.debug.Linux.x86_64/AbstractFifo.o obj.debug.Linux.x86_64/
> BaseException.o obj.debug.Linux.x86_64/Coders.o
> obj.debug.Linux.x86_64/Condition.o obj.debug.Linux.x86_64/
> CountStream.o obj.debug.Linux.x86_64/Data.o obj.debug.Linux.x86_64/
> DataStream.o obj.debug.Linux.x86_64/DnsUtil.o
> obj.debug.Linux.x86_64/FileSystem.o obj.debug.Linux.x86_64/
> HeapInstanceCounter.o obj.debug.Linux.x86_64/Lock.o
> obj.debug.Linux.x86_64/Log.o obj.debug.Linux.x86_64/Logger.o
> obj.debug.Linux.x86_64/MD5Stream.o obj.debug.Linux.x86_64/Mutex.o
> obj.debug.Linux.x86_64/OpenSSLInit.o obj.debug.Linux.x86_64/
> ParseBuffer.o obj.debug.Linux.x86_64/Poll.o obj.debug.Linux.x86_64/
> RWMutex.o obj.debug.Linux.x86_64/Random.o obj.debug.Linux.x86_64/
> RecursiveMutex.o obj.debug.Linux.x86_64/SelectInterruptor.o
> obj.debug.Linux.x86_64/SHA1Stream.o obj.debug.Linux.x86_64/Socket.o
> obj.debug.Linux.x86_64/Subsystem.o obj.debug.Linux.x86_64/
> SysLogBuf.o obj.debug.Linux.x86_64/SysLogStream.o
> obj.debug.Linux.x86_64/ThreadIf.o obj.debug.Linux.x86_64/Timer.o
> obj.debug.Linux.x86_64/vmd5.o obj.debug.Linux.x86_64/dns/AresDns.o
> obj.debug.Linux.x86_64/dns/DnsAAAARecord.o obj.debug.Linux.x86_64/
> dns/DnsCnameRecord.o obj.debug.Linux.x86_64/dns/DnsHostRecord.o
> obj.debug.Linux.x86_64/dns/DnsNaptrRecord.o obj.debug.Linux.x86_64/
> dns/DnsSrvRecord.o obj.debug.Linux.x86_64/dns/DnsStub.o
> obj.debug.Linux.x86_64/dns/ExternalDnsFactory.o
> obj.debug.Linux.x86_64/dns/RRCache.o obj.debug.Linux.x86_64/dns/
> RRList.o obj.debug.Linux.x86_64/dns/RRVip.o obj.debug.Linux.x86_64/
> dns/QueryTypes.o obj.debug.Linux.x86_64/dns/RROverlay.o
> obj.debug.Linux.x86_64/stun/Stun.o obj.debug.Linux.x86_64/stun/Udp.o
> /usr/bin/ld: obj.debug.Linux.x86_64/AbstractFifo.o: relocation
> R_X86_64_32 against `a local symbol' can not be used when making a
> shared object; recompile with -fPIC
> obj.debug.Linux.x86_64/AbstractFifo.o: could not read symbols: Bad
> value
> collect2: ld returned 1 exit status
> make: *** [obj.debug.Linux.x86_64/librutil.so] Error 1
>
>
> the system is Ubuntu 6.06 AMD64, g++ v4.0.3
>
>
> my fix was to add the -fPIC compile flag:
> (you should verify if this is correct)
>
>
> --- build/Makefile.tools (revision 6599)
> +++ build/Makefile.tools (working copy)
> @@ -41,8 +41,8 @@
> DMANGLE =
> INSTALL = install
> LNDIR = $(shell pwd)/$(ROOT)/build/lndir.sh
> -CFLAGS += -Wall
> -CXXFLAGS += -Wall
> +CFLAGS += -Wall -fPIC
> +CXXFLAGS += -Wall -fPIC
> DFLAG_INTEGRATED = -MMD
> DEBUG_FLAG = -g
> COMPILE_SMALL_FLAG = -Os -fno-inline -fno-keep-static-consts
>
>
> /alfred
>
> Byron Campen wrote:
>> I see some logic in the build system that was meant to handle
>> this sort of thing, but it appears to not be working. Could you
>> send the link-line?
>> Best regards,
>> Byron Campen
>>> hi
>>>
>>> when building resiprocate with "Should the resip libraries be built
>>> shared?" set to "Yes", I got the following error:
>>>
>>>
>>> /usr/bin/ld: obj.debug.Linux.x86_64/AbstractFifo.o: relocation
>>> R_X86_64_32 against `a local symbol' can not be used when making a
>>> shared object; recompile with -fPIC
>>> obj.debug.Linux.x86_64/AbstractFifo.o: could not read symbols:
>>> Bad value
>>> collect2: ld returned 1 exit status
>>> make: *** [obj.debug.Linux.x86_64/librutil.so] Error 1
>>>
>>>
>>> adding the "-fPIC" option solved the problem, but I am not sure if
>>> this is the correct way to solve it.. patch below:
>>>
>>>
>>> Index: build/Makefile.tools
>>> ===================================================================
>>> --- build/Makefile.tools (revision 6553)
>>> +++ build/Makefile.tools (working copy)
>>> @@ -41,8 +41,8 @@
>>> DMANGLE =
>>> INSTALL = install
>>> LNDIR = $(shell pwd)/$(ROOT)/build/lndir.sh
>>> -CFLAGS += -Wall
>>> -CXXFLAGS += -Wall
>>> +CFLAGS += -Wall -fPIC
>>> +CXXFLAGS += -Wall -fPIC
>>> DFLAG_INTEGRATED = -MMD
>>> DEBUG_FLAG = -g
>>> COMPILE_SMALL_FLAG = -Os -fno-inline -fno-keep-static-consts
>>>
>>>
>>> _______________________________________________
>>> resiprocate-devel mailing list
>>> resiprocate-devel at list.sipfoundry.org
>>> https://list.sipfoundry.org/mailman/listinfo/resiprocate-devel
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2369 bytes
Desc: not available
URL: <http://list.resiprocate.org/pipermail/resiprocate-devel/attachments/20060922/0d9091b7/attachment.bin>
More information about the resiprocate-devel
mailing list