Seite 1 von 1

relocation R_X86_64_PC32: undefined hidden symbol dso_handle

Verfasst: Sa Mai 18, 2013 2:32 pm
von Xin
Moin!

Bisher habe ich mich mit Libraries bestenfalls auf Windows-Ebene beschäftigt und da auch keine Probleme mit. Nun unterteile ich mein Framework, das ich bisher als Klassensammelsurium verwendet habe als mit denen ich Anwendungen zusammenge'steckt' habe, in unterschiedliche Libraries. Das funktioniert unter Linux soweit auch wunderbar. Unter Linux stoße ich aber auf Probleme:

Code: Alles auswählen

xin@trinity:~/xsd/de/xsd/core$ make
>>>> de/xsd/core/mem 
>>>> de/xsd/core/primitive 
>>>> de/xsd/core/string 
>>>> de/xsd/core/string/wiki 
>>>> de/xsd/core/type 
>>>> de/xsd/core/unit 
>>>> de/xsd/core/util 
ld -shared -o ../../../lib/xsdcore.so ../../../obj/linux/de/xsd/core/mem/blocklist.o ../../../obj/linux/de/xsd/core/primitive/double.o ../../../obj/linux/de/xsd/core/primitive/uint.o ../../../obj/linux/de/xsd/core/string/lineendencoding.o ../../../obj/linux/de/xsd/core/string/path.o ../../../obj/linux/de/xsd/core/string/representation.o ../../../obj/linux/de/xsd/core/string/searchtoken.o ../../../obj/linux/de/xsd/core/string/stringtoken.o ../../../obj/linux/de/xsd/core/string/wikistring.o ../../../obj/linux/de/xsd/core/string/wiki/bold.o ../../../obj/linux/de/xsd/core/string/wiki/console.o ../../../obj/linux/de/xsd/core/string/wiki/headline.o ../../../obj/linux/de/xsd/core/string/wiki/italic.o ../../../obj/linux/de/xsd/core/string/wiki/linebreak.o ../../../obj/linux/de/xsd/core/string/wiki/link.o ../../../obj/linux/de/xsd/core/string/wiki/monospace.o ../../../obj/linux/de/xsd/core/string/wiki/plugin.o ../../../obj/linux/de/xsd/core/string/wiki/underline.o ../../../obj/linux/de/xsd/core/type/cloud.o ../../../obj/linux/de/xsd/core/type/parameter.o ../../../obj/linux/de/xsd/core/type/string.o ../../../obj/linux/de/xsd/core/type/timestamp.o ../../../obj/linux/de/xsd/core/type/unique.o ../../../obj/linux/de/xsd/core/type/url.o ../../../obj/linux/de/xsd/core/unit/unitcolor.o ../../../obj/linux/de/xsd/core/unit/unit.o ../../../obj/linux/de/xsd/core/util/bresenhamarray.o ../../../obj/linux/de/xsd/core/util/calendar.o ../../../obj/linux/de/xsd/core/util/debugmemory.o ../../../obj/linux/de/xsd/core/util/endian.o ../../../obj/linux/de/xsd/core/util/errorreport.o ../../../obj/linux/de/xsd/core/util/inquiry.o ../../../obj/linux/de/xsd/core/util/posture.o ../../../obj/linux/de/xsd/core/util/separators.o ../../../obj/linux/de/xsd/core/util/sequence.o ../../../obj/linux/de/xsd/core/util/xmljson.o ../../../obj/linux/de/xsd/core/util/xml.o --whole-archive
../../../obj/linux/de/xsd/core/mem/blocklist.o: In function `__static_initialization_and_destruction_0':
/usr/include/c++/4.7/iostream:75: undefined reference to `__dso_handle'
ld: ../../../obj/linux/de/xsd/core/mem/blocklist.o: relocation R_X86_64_PC32 against undefined hidden symbol `__dso_handle' can not be used when making a shared object
ld: final link failed: Bad value
make: *** [library] Error 1
Erstellt werden soll das Shared Object xsdcore.so, blocklist.o ist also das erste zu linkende Objekt und schon scheppert es. ^^

Alle Objekte sind C++ Code. Als CCFlags sind angegeben:

Code: Alles auswählen

xin@trinity:~/xsd/de/xsd/core$ make showccflags
-DXSD_MYSQL_REQUIRED -fPIC -g -Wall -D DO_NOT_SIMPLIFY_OPERATORS -Wno-non-template-friend -pedantic -Wno-long-long -DXSD_OPENGL_REQUIRED -DXSD_MYSQL_REQUIRED -std=c++0x -D _LP64 -D VERSION_LINUX -std=c++11 -DXSD_GTK_REQUIRED -std=c++0x
An dem Makeskript arbeite ich gerade noch... ich bin sicher, ein Standard wird sich irgendwann durchsetzen ;-) , aber da sehe ich derzeit noch nicht das Problem.

Kennt jemand das Problem oder ist super fit im Shared-Object-Bauen? Fitter als ich würde mir fast schon reichen, ich mache das (bis auf eine Test-Lib) gerade zum ersten Mal. ^^

Re: relocation R_X86_64_PC32: undefined hidden symbol dso_ha

Verfasst: So Mai 19, 2013 11:24 am
von Xin
Laut LowLevel Wiki braucht man bei C++ lediglich ein Objektfile, dass folgenden (kompilierten) Quelltext enthält.

Code: Alles auswählen

void * __dso_handle;
der Lib hinzuzufügen.

Damit kompiliert es auch spontan und ich erhalte eine Shared Lib. Jetzt muss ich nur noch testen, ob's funktioniert. ^^

/* Edit: Funktioniert! */