#47 Can't link to static when both static and dynamic are avail

cpptasks (103)
Ivan Markov

"Library names should not contain periods"

I know libraries should be specified without the 'lib' prefix
and without the '.so/.dll/.a/.sl' suffix, but restricting
their names not to contain dots seems pretty harsh,
isn't it?

I have this brand new Fox 1.1.37 drop and I can't link
SWT/Fox to it anymore, because it has this new library
naming scheme, libFOX-1.1.a/.so, so when I specify as
library name 'FOX-1.1', guess what happens..

The offending code is at line 182 in


On a similar note, why, oh, why can't I somehow
specify, that I want to *statically* link with library.

I have both libFOX-1.1.so and libFOX-1.1.a installed, but
I want to link with the static one. No way, with
cpptasks, it always picks the .so version, or am I


  • Curt Arnold

    Curt Arnold - 2003-10-13
    • labels: --> cpptasks
    • assigned_to: nobody --> carnold
    • summary: Can't link to libraries containing periods --> Can't link to static when both static and dynamic are avail
  • Curt Arnold

    Curt Arnold - 2003-10-13

    Logged In: YES

    First section is a duplicate of 759121.

    Will have to research later part. <syslibset> and <libset> mimic
    -l command line switch on gcc, don't know its rules when there
    are multiple matches.

  • Ivan Markov

    Ivan Markov - 2003-10-14

    Logged In: YES

    As far as I know, if you want to link with an .a archive,
    instead of with the regular .so library (when both are
    available), you should do something like this (on the gcc
    command line):
    ... -Wl,-Bstatic -lmylib -Wl,-Bdynamic ...

    (The -Wl switch essentially says that the next switch (-
    Bstatic/dynamic) is for the linker.)

    This only works for the gcc toolchain though.

    It could have been great too, if cpptasks provided a way to
    pass custom parameters to the gcc *linker*, because if it did,
    I could have used directly the approach from above. But it
    somehow chokes on the -Wl,-Bstatic sequence.

  • Curt Arnold

    Curt Arnold - 2004-04-21
    • status: open --> open-accepted
  • Curt Arnold

    Curt Arnold - 2004-04-21

    Adds type attribute to libset/syslibset

  • Curt Arnold

    Curt Arnold - 2004-04-21

    Logged In: YES

    The attached patch adds a type attribute to libset and
    syslibset which is used by ld compatible linkers to add an
    appropriate -Bstatic or -Bdynamic attribute.

  • Curt Arnold

    Curt Arnold - 2004-04-24
    • status: open-accepted --> closed-fixed

Log in to post a comment.

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

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks