FedoraForum.org - Fedora Support Forums and Community
Results 1 to 3 of 3
  1. #1
    sivaram_swdw Guest

    Static linking issue with glibc

    Hey folks,

    I am trying to run one C program which makes use of several header files. In the makefile we have set the following option:
    LDFLAGS += -static

    We want all the libraries to be linked statically.
    But we are getting the following warnings when we try to make the file

    midas-1.9.5/linux/lib/mfe.o femagic.o magic_box.o camacnul.o ../../midas-1.9.5/linux/lib/libmidas.a -lpthread -static -lm -lz -lutil -lnsl -pg
    ../../midas-1.9.5/linux/lib/libmidas.a(midas.o)(.text+0x1072b): In function `rpc_server_callback':
    src/midas.c:12173: warning: Using 'gethostbyaddr' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
    ../../midas-1.9.5/linux/lib/libmidas.a(midas.o)(.text+0x3d79): In function `rpc_client_connect':
    src/midas.c:8575: warning: Using 'gethostbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking


    We thought that its just warning message and continue to run the program but its getting crashed. But when we commented out the LDFLAGS += -static statement in the Make file and then rerun the make and run the program then its working fine without any problem.

    Does anyone have suggestions regarding this.

    Thanks in advance,
    Ram.

  2. #2
    Join Date
    Aug 2004
    Posts
    4,256
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I don't do static linking but your question made me curious and I found:
    http://www.gnu.org/software/libc/FAQ.html#s-2.22
    It's rather suprising to me that -static doesn't really give a completely static executable. According to the web this suprises many. For example:
    http://groups-beta.google.com/group/...4b2b7f639d812c
    "Never let the task you are trying to accomplish distract you from the study of computers."

  3. #3
    sivaram_swdw Guest
    Hi Tashir,

    Thank you for your suggestion, I'll keep looking on your suggestions.

    Cheers,
    Ram.

Similar Threads

  1. glibc-common issue on x86_64
    By PinGUIWin in forum Using Fedora
    Replies: 8
    Last Post: 22nd August 2009, 10:51 AM
  2. gcc 4.1 static linking
    By deeloke in forum Fedora Core 5 - Dev
    Replies: 0
    Last Post: 30th April 2007, 03:25 PM
  3. Replies: 22
    Last Post: 10th November 2005, 07:16 PM
  4. static linking pthread lib
    By afeick in forum Programming & Packaging
    Replies: 10
    Last Post: 4th November 2005, 02:18 PM
  5. glibc issue?
    By spatula in forum Fedora Core 4 Test
    Replies: 3
    Last Post: 19th April 2005, 08:33 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •