[Scons-users] modify linker command

Managan, Rob managan1 at llnl.gov
Tue Jun 19 12:00:42 EDT 2012


I guess I don't understand your problem. I have a Mac and since I don't
have administrator privileges I have many libraries installed at
$HOME/local/lib. I regularly use my linux Scons setup to find those
libraries. Some of them are shared libraries but some I build are static,
libxxx.a.


Generally I have used the call CheckLibWithHeader. This was set up long
enough ago I don't recall if I use that because I could not get other
Check routines to work as I wanted or if I just wanted to specify the
header.

Let me also say that this stuff dates back to SCons versions before 1.0
and there may be a better way to do this now.

For example:

if env["x11"] == 1:
# print 'Checking X11 library ',len(env['LIBS'])

ret=CheckLibHeaderwPaths(env,conf,'X11',['X11/Xlib.h','X11/Xutil.h'],env['x
11_inc'],'XLIB',
env['x11_lib'],language='C',
call='char display_name[32] = "" ;Display *display =
XOpenDisplay(display_name);')
if ret != None:
env['x11'] = 0


I attached my routine CheckLibHeaderwPaths as a text file to preserve
indentation.
I have a similar routine that adds a TryRun to make sure I can execute a
test program with the library...



On 6/19/12 7:04 AM, "Kraus Philipp" <philipp.kraus at flashpixx.de> wrote:


>

>Am 19.06.2012 um 14:44 schrieb Gary Oberbrunner:

>

>> On Tue, Jun 19, 2012 at 8:25 AM, F. Heitkamp <heitkamp at ameritech.net>

>>wrote:

>>> I second this. I have a rather unusual Linux system with libraries in

>>> certain directories. I need to specify these (LDFLAGS,LIBS,etc).

>>>Scons

>>> doesn't seem to allow an easy way to do this. Not trying to create a

>>>flame

>>> war but this is very easy with autotools. Doesn't anyone have any

>>>hints?

>>> I've tried just about everything I can think of, without actually

>>>modifying

>>> Scons scripts.

>>

>>That is not the problem, I think you missunderstood something:

>

>How can I detect with the Scons autotools a static library? The CheckLib

>/ CheckLibWithHeader Command find only dynamic libraries, not static, so

>I can modify the build string command, but I need the full qualified path

>of the static library. On different systems the pathes are different and

>Autotools should be find the correct installed library. Autoconf works

>only with dynamic libraries not with static. I have tried to use

>CheckLib("libmylib.a") but the command returns always false. If I run

>CheckLib("mylib") autotools finds only the dynamic.

>

>On binutils linker I use -Bstatic -l<library> -Wl for building static

>linked code, so with the issue of Autoconf I use Autotool for searching

>the dynamic libs and than I modify the LINKCOM string for adding -bstatic

>and -Wl around the -l flags, but OSX does not support the -bstatic flag,

>so the linker command breaks, so I can link on OSX only static if I know

>the fulled qualified path to my static library. This is a chicken or the

>egg causality dilemma

>

>So the main problems is: How I can use static libraries with the Scons

>Autoconf?

>

>




*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
Rob Managan email managan at llnl.gov
LLNL phone: 925-423-0903
P.O. Box 808, L-095 FAX: 925-422-3389
Livermore, CA 94551-0808




>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: checklibheader.py
Type: text/x-python-script
Size: 3239 bytes
Desc: checklibheader.py
Url : <http://four.pairlist.net/pipermail/scons-users/attachments/20120619/5bb9a25a/attachment-0001.bin>


More information about the Scons-users mailing list