Cannot find -lgcc_s



  • Hallo,

    ich habe unter Ubuntu 10.04LTS Qt 4.7.4 statisch installiert und möchte nun ein Qt-Programm statisch linken und auf einem Industrierechner ausführen können.

    Die Qt-Libs werden auf jeden Fall statisch eingebunden. Nun sollen alle restlichen Libs auch statisch eingebunden werden. Ich dachte, ich könnte das mit LFLAGS = -static ... realisieren. Leider erhalte ich immer folgenden Fehler:

    ajohnigk@ajohnigk-laptop:~/NetBeansProjects/QtSendOrders$ /usr/local/Trolltech/Qt-4.7.4/bin/qmake -project
    ajohnigk@ajohnigk-laptop:~/NetBeansProjects/QtSendOrders$ /usr/local/Trolltech/Qt-4.7.4/bin/qmake QtSendOrders.pro 
    ajohnigk@ajohnigk-laptop:~/NetBeansProjects/QtSendOrders$ make
    g++ -Wl,-O1 -Wl,-rpath,/usr/local/Trolltech/Qt-4.7.4/lib,-static -o QtSendOrders main.o mainWindow.o moc_mainWindow.o    -L/usr/local/Trolltech/Qt-4.7.4/lib -lQtGui -L/usr/local/Trolltech/Qt-4.7.4/lib -L/usr/X11R6/lib -ljpeg -lmng -ltiff -lpng -lgobject-2.0 -lSM -lICE -lXrender -lfontconfig -lfreetype -lXext -lX11 -lQtCore -lz -lm -ldl -pthread -lgthread-2.0 -lrt -lglib-2.0 -lpthread 
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libX11.a(CrGlCur.o): In function `open_library':
    (.text+0x3b): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
    /usr/bin/ld: cannot find -lgcc_s
    collect2: ld returned 1 exit status
    make: *** [QtSendOrders] Fehler 1
    

    Wenn ich die Option static weglasse, funktioniert es. Die Libs libgcc_s.so.1 bzw. der Link libgcc_s.so -> libgcc_s.so.1 sowie libgcc.a sind auf meinem Notebook vorhanden. 😕

    Weiß jemand, was es damit auf sich hat? Was bedeutet die Warnung? Vielen vielen Dank!!

    Grüße,
    anjohn


  • Mod

    Mach mal noch -static-libgcc als Schalter dazu.



  • Option hinzugefügt.
    Ergebnis:

    ajohnigk@ajohnigk-laptop:~/NetBeansProjects/QtSendOrders$ make
    g++ -Wl,-O1 -Wl,-rpath,/usr/local/Trolltech/Qt-4.7.4/lib,-static,-static-libgcc -o QtSendOrders main.o mainWindow.o moc_mainWindow.o    -L/usr/local/Trolltech/Qt-4.7.4/lib -lQtGui -L/usr/local/Trolltech/Qt-4.7.4/lib -L/usr/X11R6/lib -ljpeg -lmng -ltiff -lpng -lgobject-2.0 -lSM -lICE -lXrender -lfontconfig -lfreetype -lXext -lX11 -lQtCore -lz -lm -ldl -pthread -lgthread-2.0 -lrt -lglib-2.0 -lpthread 
    /usr/bin/ld: unrecognized -a option `tic-libgcc'
    collect2: ld returned 1 exit status
    make: *** [QtSendOrders] Fehler 1
    

    😕 😕
    Danke für deine Antwort! Klappt leider noch nicht. 😞

    Grüße,
    anjohn


  • Mod

    Da hast du mit der Schreibweise was falsch gemacht. Lies die Fehlermeldungen doch mal.

    Um's kurz zu sagen: Mach mal LDFLAGS="-static -static-libgcc". Mit den Anführungszeichen. Und natürlich noch alles, was vorher da war.

    Da sind auch allerlei komische Optionen gesetzt. Wieso wird O1 an den Linker geschickt? Und der rpath mit Komma statt Gleichheitszeichen? Und überhaupt ein rpath bei statischem Linken? Und mehrmals verschiedene Schalter, die das gleiche machen. Irgendwie ist da allgemein der Wurm drin.



  • Das Makefile wird von qmake erzeugt. Ich habe nur die Option -static hinzugefügt. Also sollte ich das Makefile lieber selber schreiben?

    Denke mal, jetzt hat er die Option geschluckt. Das hier kam heraus:

    ajohnigk@ajohnigk-laptop:~/NetBeansProjects/QtSendOrders$ make
    g++ -Wl,-O1 -Wl,-rpath,/usr/local/Trolltech/Qt-4.7.4/lib,-static -static-libgcc -o QtSendOrders main.o mainWindow.o moc_mainWindow.o    -L/usr/local/Trolltech/Qt-4.7.4/lib -lQtGui -L/usr/local/Trolltech/Qt-4.7.4/lib -L/usr/X11R6/lib -ljpeg -lmng -ltiff -lpng -lgobject-2.0 -lSM -lICE -lXrender -lfontconfig -lfreetype -lXext -lX11 -lQtCore -lz -lm -ldl -pthread -lgthread-2.0 -lrt -lglib-2.0 -lpthread 
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libX11.a(CrGlCur.o): In function `open_library':
    (.text+0x3b): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
    /usr/local/Trolltech/Qt-4.7.4/lib/libQtCore.a(qfsfileengine_unix.o): In function `QFSFileEngine::owner(QAbstractFileEngine::FileOwner) const':
    qfsfileengine_unix.cpp:(.text+0x1195): warning: Using 'getgrgid_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libglib-2.0.a(gutils.o): In function `g_get_any_init_do':
    (.text+0x1215): warning: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libglib-2.0.a(gutils.o): In function `g_get_any_init_do':
    (.text+0x1208): warning: Using 'setpwent' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libglib-2.0.a(gutils.o): In function `g_get_any_init_do':
    (.text+0x1220): warning: Using 'endpwent' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libX11.a(GetDflt.o): In function `GetHomeDir':
    (.text+0xa7): warning: Using 'getpwnam_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
    /usr/local/Trolltech/Qt-4.7.4/lib/libQtGui.a(qapplication_x11.o): In function `sm_performSaveYourself(QSessionManagerPrivate*)':
    qapplication_x11.cpp:(.text+0x8ffd): warning: Using 'getpwuid_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libX11.a(xim_trans.o): In function `_XimXTransSocketUNIXConnect':
    (.text+0xe23): warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libICE.a(icetrans.o): In function `_IceTransGetPeerNetworkId':
    (.text+0x1e36): warning: Using 'gethostbyaddr' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libICE.a(icetrans.o): In function `_IceTransSocketINETConnect':
    (.text+0x2b4e): warning: Using 'gethostbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libICE.a(icetrans.o): In function `_IceTransSocketINETCreateListener':
    (.text+0x273b): warning: Using 'getservbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libmng.a(libmng_cms.o): In function `mng_correct_full_cms':
    (.text+0x3f4): undefined reference to `cmsDoTransform'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libmng.a(libmng_cms.o): In function `mnglcms_creatememprofile':
    (.text+0x420): undefined reference to `cmsOpenProfileFromMem'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libmng.a(libmng_cms.o): In function `mnglcms_freetransform':
    (.text+0x449): undefined reference to `cmsDeleteTransform'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libmng.a(libmng_cms.o): In function `mnglcms_freeprofile':
    (.text+0x479): undefined reference to `cmsCloseProfile'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libmng.a(libmng_cms.o): In function `mnglcms_createsrgbprofile':
    (.text+0x537): undefined reference to `cmsWhitePointFromTemp'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libmng.a(libmng_cms.o): In function `mnglcms_createsrgbprofile':
    (.text+0x54d): undefined reference to `cmsBuildGamma'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libmng.a(libmng_cms.o): In function `mnglcms_createsrgbprofile':
    (.text+0x56f): undefined reference to `cmsCreateRGBProfile'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libmng.a(libmng_cms.o): In function `mnglcms_createsrgbprofile':
    (.text+0x57c): undefined reference to `cmsFreeGamma'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libmng.a(libmng_cms.o): In function `mng_init_full_cms':
    (.text+0x712): undefined reference to `cmsOpenProfileFromMem'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libmng.a(libmng_cms.o): In function `mng_init_full_cms':
    (.text+0x755): undefined reference to `cmsCreateTransform'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libmng.a(libmng_cms.o): In function `mng_init_full_cms':
    (.text+0x7ab): undefined reference to `cmsCreateTransform'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libmng.a(libmng_cms.o): In function `mng_init_full_cms':
    (.text+0x96c): undefined reference to `cmsBuildGamma'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libmng.a(libmng_cms.o): In function `mng_init_full_cms':
    (.text+0x999): undefined reference to `cmsCreateRGBProfile'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libmng.a(libmng_cms.o): In function `mng_init_full_cms':
    (.text+0x9a6): undefined reference to `cmsFreeGamma'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libmng.a(libmng_cms.o): In function `mng_init_full_cms':
    (.text+0x9ed): undefined reference to `cmsCreateTransform'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libmng.a(libmng_cms.o): In function `mng_init_full_cms':
    (.text+0xa0c): undefined reference to `cmsOpenProfileFromMem'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libmng.a(libmng_cms.o): In function `mng_init_full_cms':
    (.text+0xc17): undefined reference to `cmsCreateTransform'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libmng.a(libmng_cms.o): In function `mnglcms_createfileprofile':
    (.text+0xc83): undefined reference to `cmsOpenProfileFromFile'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libmng.a(libmng_cms.o): In function `mnglcms_initlibrary':
    (.text+0xcaa): undefined reference to `cmsErrorAction'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libfontconfig.a(fcxml.o): In function `FcConfigMessage':
    (.text+0x2c6): undefined reference to `XML_GetCurrentLineNumber'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libfontconfig.a(fcxml.o): In function `FcConfigMessage':
    (.text+0x35a): undefined reference to `XML_GetCurrentLineNumber'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libfontconfig.a(fcxml.o): In function `FcConfigParseAndLoad':
    (.text+0x53a): undefined reference to `XML_ParserCreate'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libfontconfig.a(fcxml.o): In function `FcConfigParseAndLoad':
    (.text+0x5aa): undefined reference to `XML_SetUserData'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libfontconfig.a(fcxml.o): In function `FcConfigParseAndLoad':
    (.text+0x5c2): undefined reference to `XML_SetDoctypeDeclHandler'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libfontconfig.a(fcxml.o): In function `FcConfigParseAndLoad':
    (.text+0x5da): undefined reference to `XML_SetElementHandler'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libfontconfig.a(fcxml.o): In function `FcConfigParseAndLoad':
    (.text+0x5ea): undefined reference to `XML_SetCharacterDataHandler'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libfontconfig.a(fcxml.o): In function `FcConfigParseAndLoad':
    (.text+0x60c): undefined reference to `XML_GetBuffer'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libfontconfig.a(fcxml.o): In function `FcConfigParseAndLoad':
    (.text+0x649): undefined reference to `XML_ParseBuffer'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libfontconfig.a(fcxml.o): In function `FcConfigParseAndLoad':
    (.text+0x681): undefined reference to `XML_ParserFree'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libfontconfig.a(fcxml.o): In function `FcConfigParseAndLoad':
    (.text+0x9d7): undefined reference to `XML_GetErrorCode'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libfontconfig.a(fcxml.o): In function `FcConfigParseAndLoad':
    (.text+0x9df): undefined reference to `XML_ErrorString'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libX11.a(ClDisplay.o): In function `XCloseDisplay':
    (.text+0xbd): undefined reference to `xcb_disconnect'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libX11.a(OpenDis.o): In function `OutOfMemory':
    (.text+0x449): undefined reference to `xcb_disconnect'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libX11.a(OpenDis.o): In function `XOpenDisplay':
    (.text+0x7f4): undefined reference to `xcb_get_setup'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libX11.a(OpenDis.o): In function `XOpenDisplay':
    (.text+0xd6d): undefined reference to `xcb_get_maximum_request_length'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libX11.a(xcb_disp.o): In function `_XConnectXCB':
    (.text+0xa8): undefined reference to `xcb_parse_display'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libX11.a(xcb_disp.o): In function `_XConnectXCB':
    (.text+0x16e): undefined reference to `xcb_connect_to_display_with_auth_info'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libX11.a(xcb_disp.o): In function `_XConnectXCB':
    (.text+0x18c): undefined reference to `xcb_get_file_descriptor'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libX11.a(xcb_disp.o): In function `_XConnectXCB':
    (.text+0x1b3): undefined reference to `xcb_generate_id'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libX11.a(xcb_disp.o): In function `_XConnectXCB':
    (.text+0x1f0): undefined reference to `xcb_connection_has_error'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libX11.a(xcb_disp.o): In function `_XConnectXCB':
    (.text+0x224): undefined reference to `xcb_connect'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libX11.a(xcb_io.o): In function `require_socket':
    (.text+0x394): undefined reference to `xcb_take_socket'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libX11.a(xcb_io.o): In function `wait_or_poll_for_event':
    (.text+0x41c): undefined reference to `xcb_wait_for_event'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libX11.a(xcb_io.o): In function `wait_or_poll_for_event':
    (.text+0x485): undefined reference to `xcb_poll_for_event'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libX11.a(xcb_io.o): In function `process_responses':
    (.text+0x54b): undefined reference to `xcb_poll_for_reply'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libX11.a(xcb_io.o): In function `process_responses':
    (.text+0x6ca): undefined reference to `xcb_connection_has_error'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libX11.a(xcb_io.o): In function `_XAllocIDs':
    (.text+0x7bc): undefined reference to `xcb_generate_id'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libX11.a(xcb_io.o): In function `_XIDHandler':
    (.text+0x82e): undefined reference to `xcb_generate_id'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libX11.a(xcb_io.o): In function `_XSend':
    (.text+0xa29): undefined reference to `xcb_writev'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libX11.a(xcb_io.o): In function `_XReply':
    (.text+0xc1a): undefined reference to `xcb_wait_for_reply'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libglib-2.0.a(gregex.o): In function `g_regex_get_string_number':
    (.text+0x38f): undefined reference to `pcre_get_stringnumber'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libglib-2.0.a(gregex.o): In function `g_regex_get_capture_count':
    (.text+0x426): undefined reference to `pcre_fullinfo'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libglib-2.0.a(gregex.o): In function `g_regex_get_max_backref':
    (.text+0x456): undefined reference to `pcre_fullinfo'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libglib-2.0.a(gregex.o): In function `g_regex_unref':
    (.text+0x737): undefined reference to `pcre_free'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libglib-2.0.a(gregex.o): In function `g_regex_unref':
    (.text+0x747): undefined reference to `pcre_free'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libglib-2.0.a(gregex.o): In function `match_info_new':
    (.text+0x8e5): undefined reference to `pcre_fullinfo'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libglib-2.0.a(gregex.o): In function `g_regex_match_all_full':
    (.text+0x1162): undefined reference to `pcre_dfa_exec'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libglib-2.0.a(gregex.o): In function `g_regex_new':
    (.text+0x13ac): undefined reference to `pcre_compile2'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libglib-2.0.a(gregex.o): In function `g_regex_new':
    (.text+0x13d5): undefined reference to `pcre_fullinfo'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libglib-2.0.a(gregex.o): In function `g_regex_new':
    (.text+0x1439): undefined reference to `pcre_study'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libglib-2.0.a(gregex.o): In function `g_regex_new':
    (.text+0x1517): undefined reference to `pcre_config'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libglib-2.0.a(gregex.o): In function `g_regex_new':
    (.text+0x152e): undefined reference to `pcre_config'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libglib-2.0.a(gregex.o): In function `g_regex_new':
    (.text+0x1575): undefined reference to `pcre_fullinfo'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libglib-2.0.a(gregex.o): In function `get_matched_substring_number':
    (.text+0x1b90): undefined reference to `pcre_get_stringtable_entries'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libglib-2.0.a(gregex.o): In function `get_matched_substring_number':
    (.text+0x1c0b): undefined reference to `pcre_get_stringnumber'
    /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/libglib-2.0.a(gregex.o): In function `g_match_info_next':
    (.text+0x20e8): undefined reference to `pcre_exec'
    collect2: ld returned 1 exit status
    make: *** [QtSendOrders] Fehler 1
    

    Danke,
    anjohn



  • Die Warnung betreffs dlopen hast du aber gesehen ? - ich hab mich da auch schon mal richtig geölt



  • Hallo,
    ich glaube, dass bei neueren gcc-Versionen (ab Version ???) trotz
    statischem Linken das resultierende Programm auf die dyn. Bibliotheken
    zurückgreift. Das betrifft die Warnungen bis Zeile 24 in der Ausgabe.
    Bei den restlichen Fehlermeldungen ... keine Ahnung !?!?
    Pauschal hätte ich gesagt -> Versionskonflikt bei den libs 🙄


Anmelden zum Antworten