Error compiling on Solaris 2.9

  • Donnie Hale

    Donnie Hale - 2004-06-02

    ...using gcc 3.2 and the "ld" that comes w/ the OS.

    I'm seeing this error:

    ld: fatal: relocations remain against allocatable but non-writable sections
    collect2: ld returned 1 exit status
    error: command 'gcc' failed with exit status 1

    There are several hundred lines of the form:

    <unknown>                           0xd58       /usr/local/lib/gcc-lib/sparc-sun-solaris2.9/3.2/../../../libpcap.a(grammar.o)
    <unknown>                           0xd60       /usr/local/lib/gcc-lib/sparc-sun-solaris2.9/3.2/../../../libpcap.a(grammar.o)
    pcap_nerrs                          0x4c        /usr/local/lib/gcc-lib/sparc-sun-solaris2.9/3.2/../../../libpcap.a(grammar.o)
    pcap_nerrs                          0x58        /usr/local/lib/gcc-lib/sparc-sun-solaris2.9/3.2/../../../libpcap.a(grammar.o)
    pcap_nerrs                          0xae4       /usr/local/lib/gcc-lib/sparc-sun-solaris2.9/3.2/../../../libpcap.a(grammar.o)
    pcap_nerrs                          0xc84       /usr/local/lib/gcc-lib/sparc-sun-solaris2.9/3.2/../../../libpcap.a(grammar.o)
    pcap_nerrs                          0xc8c       /usr/local/lib/gcc-lib/sparc-sun-solaris2.9/3.2/../../../libpcap.a(grammar.o)
    pcap_char                           0x48        /usr/local/lib/gcc-lib/sparc-sun-solaris2.9/3.2/../../../libpcap.a(grammar.o)
    pcap_char                           0x54        /usr/local/lib/gcc-lib/sparc-sun-solaris2.9/3.2/../../../libpcap.a(grammar.o)

    (that's not formatted really cleanly).

    Unfortunately, I'm not a shared library export on Unix boxes, so I don't know how to proceed to figure out what's going on.

    Any ideas on fixing this? Thanks.

    • Wim Lewis

      Wim Lewis - 2004-06-10

      I only have a little familiarity with Solaris, but my guess is that libpcap.a wasn't compiled with whatever option is required for code that's going to be dynamically loaded.

      (Often that option is -fPIC, which makes gcc generate position-independent-code which won't require fixups/relocations when it's loaded. On some systems this is just an optimization but on Solaris-SPARC it's apparently necessary.)

      I just tried compiling on SourceForge's solaris compile farm machine and got the same result you did. When I have a bit more time I'll give it another try and see if adding -fPIC to libpcap's CFLAGS helps any.

    • Donnie Hale

      Donnie Hale - 2004-06-11

      Adding "-fPIC" to libpcap's build did fix the issue. My only concern now is whether that would break anything else that uses libpcap.


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks