libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How does one compile in a "make check" test?


From: Ralf Wildenhues
Subject: Re: How does one compile in a "make check" test?
Date: Tue, 20 Dec 2005 08:41:09 +0100
User-agent: Mutt/1.5.11

Hi Bruce,

* Bruce Korb wrote on Fri, Dec 16, 2005 at 08:18:08PM CET:
> Bruce Korb wrote:
> >
> >I need to be able to create a source file and compile the thing
> >in my "make check" testing.  Unfortunately, I have no need for
>
> I like replying to my own messages :)
> 
> How's this for an ugly hack?

Ugly.  ;-)

> Add the following to a project build directory:
> 
>    test/cc.defs :
>        (echo COMPILE="'$(COMPILE)'" ; \
>        echo LINK="'$(LINK)'" | sed 's/ -o.*//') > $@
> 
> and in the test directory:
> 
>    $(TESTS) : cc.defs
>         cd .. ; $(MAKE) test/cc.defs
> 
> and then use ${COMPILE} and ${LINK} in my test scripts?  :)
> I don't like it, but I think it ought to work....
> How reasonable is that?  Thanks - Bruce

I agree that it ought to work.  Cleaner, but a lot more to write, would
be something like
  TESTS_ENVIRONMENT = CC="$(CC)" CFLAGS=... LIBTOOL=...

in the tests/Makefile.am, and just use
  $LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS ...

Depending on your needs, throw in AM_{C,CPP,..}FLAGS as well -- but
those should be under your control anyway.

> >What is the recommended way of convincing libtool that it should
> >compile a program linking against libraries that can be in any of
> >various places?

This question is completely independent of above issue.

> > What I have been trying does not work on some platforms,
> >though it seems to work on most:
> >
> >>+ gcc -DHAVE_CONFIG_H -g -O2 -DTEST_TEST_NESTED_OPTS 
> >>-I/local/build/autogen-5.8 -I/local/build/autogen-5.8/agen5 
> >>-I/local/build/autogen-5.8/autoopts -I/usr/local/include -o nested 
> >>nested.c /local/build/autogen-5.8/autoopts/.libs/libopts.a 
> >>/local/build/autogen-5.8/autoopts/.libs/libguileopts.a -Wl,-R 
> >>-Wl,-rpath,/usr/local/lib -Wl,-L/usr/local/lib -lguile -lguile-ltdl 
> >>-Wl,-rpath,/usr/local/lib -lcrypt -lm
> >>/usr/local/lib: file not recognized: File format not recognized
> >>collect2: ld returned 1 exit status
> >>+ failure cannot compile nested.c

What did you throw in?  Is the
  -Wl,-L/usr/local/lib

your or libtool's creation?  You should

  -L/first/path ... -L/last/path -lfoo

if you search for libfoo in one of several places.  If you know that a
library is in your build tree, use
  ../relative/path/libfoo.la
instead.

If any issues arise, please post the command line and what libtool made
of it, plus `./libtool --config', so we know which system this is.
Can't give any further help without knowing that.

Cheers,
Ralf




reply via email to

[Prev in Thread] Current Thread [Next in Thread]