Opened 11 years ago

Closed 8 years ago

#5820 closed Bugs (fixed)

SEARCHED_LIB targets always treated as shared by clang module

Reported by: Ai Azuma <ai.azuma@…> Owned by: Vladimir Prus
Milestone: To Be Determined Component: build
Version: Boost 1.47.0 Severity: Problem
Keywords: Cc: flast@…

Description

When using the clang module of Boost.Build, SEARCHED_LIB targets specified by "<link>static" property does not work properly, and the targets are always treated as shared ones.

For example, when I write the following jamroot file,

# jamroot
lib gmp ;
exe test.exe : test.cpp gmp/<link>static ;

test.exe links against the shared version of gmp (libgmp.so).

$ bjam -a -d+2 toolset=clang
compile.c++.without-pth bin/clang-linux-3.0/debug/test.o

  "clang++" -c -x c++ -O0 -g -fno-inline -Wall -g -fPIC    -o "bin/clang-linux-3.0/debug/test.o" "test.cpp"

clang-linux.link bin/clang-linux-3.0/debug/test

  "clang++"    -o "bin/clang-linux-3.0/debug/test" "bin/clang-linux-3.0/debug/test.o"   -lgmp -g 

The problem here is "-l" option does not follow any "-Wl,-Bstatic" flag.

Note that the gcc module works properly on the same jamroot, of course.

$ bjam -a -d+2 toolset=gcc
gcc.compile.c++ bin/gcc-4.4.5/debug/test.o

    "g++"  -ftemplate-depth-128 -O0 -fno-inline -Wall -g -fPIC     -c -o "bin/gcc-4.4.5/debug/test.o" "test.cpp"

gcc.link bin/gcc-4.4.5/debug/test

    "g++"    -o "bin/gcc-4.4.5/debug/test" -Wl,--start-group "bin/gcc-4.4.5/debug/test.o"  -Wl,-Bstatic -lgmp -Wl,-Bdynamic  -Wl,--end-group -g 

Attachments (1)

Fix-clang-linker-flags.patch (2.5 KB ) - added by Kohei Takahashi <flast@…> 10 years ago.

Download all attachments as: .zip

Change History (4)

by Kohei Takahashi <flast@…>, 10 years ago

comment:1 by Kohei Takahashi <flast@…>, 10 years ago

Cc: flast@… added

I attached the patch.

And I tested under x86_64-linux-gnu / Clang trunk(3.2) only. Can anyone test under darwin environment?

comment:2 by Kohei Takahashi <flast@…>, 8 years ago

This issue is already resolved by https://github.com/boostorg/build/pull/10 and shipped in 1.56 release. So please close this.

comment:3 by Vladimir Prus, 8 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.