Find the answer to your Linux question:
Results 1 to 2 of 2
I'm trying to get SCons to make a shared library. One of the items going into the .so is a .a static lib. I have a line like: env_2.SharedLibrary('libstuff.so', Split("""stuff.cxx ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Dec 2006
    Posts
    2

    SCons to make .so with .a


    I'm trying to get SCons to make a shared library. One of the items going into the .so is a .a static lib.

    I have a line like:
    env_2.SharedLibrary('libstuff.so', Split("""stuff.cxx
    mylib/libMine.a""")

    And upon running get an error:
    scons: *** Source file: mylib/libMine.a is static and is not compatible with shared target: libstuff.so

    However, I know that a shared library can be made from the .a via command like.

    g++ -m32 -shared -o libstuff.so stuff.o mylib/libMine.a

    Any ideas on getting this to work are doing the run around the issue would be greatly appreciated.

    -jk

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,572
    First, all the objects in the static library have to be compiled with the PIC (position indepent code) option. Next, you probably need to extract all the .o files from the archive in order to link them into a shared library.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

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