Results 1 to 4 of 4

Thread: what is -fPIC gcc compile option

  1. #1
    Join Date
    Apr 2005
    Beans
    849

    what is -fPIC gcc compile option

    Hi,
    I'm doing some cross language programming (calling C from R).
    And I get the following error.

    Code:
    /usr/bin/ld: myProg.o: relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
    I don't really understand the error, and I've never heard about -fPIC.

    thanks in advance

  2. #2
    Join Date
    Jun 2007
    Beans
    538

    Re: what is -fPIC gcc compile option

    In much older versions of the compiler gcc there was a flag "-fPIC" which was an abbreviation for Position Independent Code, and this had to be passed to create library code objects, without that flag, code that is specific to the source would be used, and then the library would fail.

    Gerald

  3. #3
    Join Date
    Oct 2007
    Beans
    100

    Re: what is -fPIC gcc compile option

    http://people.redhat.com/drepper/dsohowto.pdf

    The "-fPIC" flag is still in gcc 4.2.2 (fortunately!)

  4. #4
    Join Date
    May 2007
    Beans
    251

    Re: what is -fPIC gcc compile option

    Quote Originally Posted by wolfbone View Post
    http://people.redhat.com/drepper/dsohowto.pdf

    The "-fPIC" flag is still in gcc 4.2.2 (fortunately!)
    An absolute must-read for anyone dealing with shared objects (shared libraries) with any bit of seriousness
    The Unforgiven

Bookmarks

Posting Permissions

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