Boost logo

Boost-Build :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2007-12-25 04:57:14


On Wednesday 19 December 2007 13:02:11 Anthony Novatsis wrote:
> Hello All,
>
> I have an application written in C compiled with Boost.Build and the
> output executable has a runtime dependency on libstdc++. See the
> simple example below.
>
> main.c:
>
> int main(int argc, char* argv[])
> {
> return 0;
> }
>
> Jamfile:
>
> exe test : main.c : : ;
>
> Executing bjam (linker command line: "g++-4.1" -o
> "bin/gcc-4.1/debug/test" -Wl,--start-group "bin/gcc-4.1/debug/main.o"
> -Wl,--end-group -g) produces an executable with the following
> dependencies:
>
> ldd ./bin/gcc-4.1/debug/test
> linux-gate.so.1 => (0xffffe000)
> libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb7e92000)
> libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0xb7e6d000)
> libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb7e61000)
> libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7d17000)
> /lib/ld-linux.so.2 (0xb7f94000)
>
> After re-running the link step manually and replacing g++-4.1 with
> gcc-4.1, the output executable has the following dependencies:
>
> ldd ./bin/gcc-4.1/debug/test
> linux-gate.so.1 => (0xffffe000)
> libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7e54000)
> /lib/ld-linux.so.2 (0xb7fad000)
>
> I need to eliminate the dependency on libstdc++ as the application
> will eventually run on a target where there is no C++ runtime. Is
> there any way to configure Boost Build to use gcc instead of g++.
> Perhaps by configuring the C and C++ compiler separately or some other
> work around ? Or am I doing something else wrong ?

You can use 'gcc' as compiler command, in user-config.jam.

This is generally not recommended exactly because it won't link to
libstdc++, but you seem to want not to link to it.

- Volodya


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk