ATF-devel archive

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

Re: Error "Shared object "" not found" on NetBSD

Hello Julio,

On Wed, Jul 14, 2010 at 12:54 PM, Julio Merino <> 
> What headers are you including in your code?  You must '#include
> <atf-c.h>'.  ATF_REQUIRE_MSG is a macro so the linker should not be
> seeing it at all.
Yes, I have #include <atf-c.h> in my test programs.

> I bet your compiler doesn't complain because you do not have -Wall.
> Also, can you show your  I believe automake should be
> adding -Wall to your compiler calls but in the snippet above I don't
> see it.
I have two - one in my project's top directory and one
under src. Their contents is as follows:

$ cat ./

$ cat src/

bin_PROGRAMS = countnb

countnb_SOURCES = countnb.c

testsdir = $(exec_prefix)/tests/cryptoexamples
tests_DATA = Atffile

tests_PROGRAMS = test_seed_prng test_init_bf
test_seed_prng_SOURCES = seed_prng.c test_seed_prng.c
test_init_bf_SOURCES = seed_prng.c init_bf.c test_init_bf.c

atf_run_and_report = rm -f $${fifofile}; \
        mkfifo $${fifofile}; \
        cd $${dir}; \
        cat $${fifofile} | tee $${logfile} | atf-report & \
        atf-run >>$${fifofile}; \
        res=$${?}; \
        wait; \
        echo "The verbatim output of atf-run has been saved to" \
             "$${logfile}; exit code was $${res}"; \
        test $${res} -eq 0

check-local: check-atf
.PHONY: check-atf
        logfile=$$(pwd)/check.log; fifofile=$$(pwd)/check.fifo;
dir=${builddir}; $(atf_run_and_report)
CLEANFILES += check.fifo check.log

installcheck-local: installcheck-atf
.PHONY: installcheck-atf
fifofile=$$(pwd)/installcheck.fifo; dir=$(testsdir);
CLEANFILES += installcheck.log installcheck.fifo

> (You may also want to borrow atf's m4/developer-mode.m4 to
> add a bunch of extra warning checks to your compilations.)
>> It seems that the library in NetBSD base system is older and is
>> missing some functions. I installed ATF from pkgsrc:
> ATF_REQUIRE_MSG has been around since 0.6.  What version of atf does
> /usr/bin/atf-version report?

$ /usr/bin/atf-version
Automated Testing Framework 0.5 (atf-0.5)
Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.

Base revision: 0b094aecb5df00cbc8a6a1a9b2668bd586ad5938
Information gathered from data cached in distribution; further changes may
have been made.

It seems that it is pretty old. I will upgrade my NetBSD base system
to see if I will get a newer ATF.

$ /usr/pkg/bin/atf-version
Automated Testing Framework 0.10 (atf-0.10)
Copyright (c) 2007, 2008, 2009, 2010 The NetBSD Foundation, Inc.

Built from a distribution file; no revision information available.

>> Back to my project I ran:
>> $ make clean distclean
>> $ ./configure CPPFLAGS=-I/usr/pkg/include LDFLAGS=-L/usr/pkg/lib
>> $ make
> That should, in general, be LDFLAGS="-L/usr/pkg/lib
> -Wl,-R/usr/pkg/lib" or the binaries won't pick the correct library
> version at run time.
Yes, these options are working.

Let me give more information: I am attempting the build the project
and build and execute its unit test on Mac OS X and on NetBSD. On Mac
OS X I run

$ ./configure CPPFLAGS=-I/opt/local/include LDFLAGS=-L/opt/local/lib

On NetBSD I run, as you said,

$ ./configure CPPFLAGS=-I/usr/pkg/include LDFLAGS="-L/usr/pkg/lib

Obviously, I need a way to consolidate these options, but this is an
issue related with autotools and it requires more extensive reading of
autotools manual.

> But in this case it doesn't matter because atf
> does not install shared libraries at this point.  Oh wait, pkgsrc IS
> installing shared libraries; why, I don't know but I must fix that.
> Minor point: I'd suggest you to use the atf-c.pc pkg-config file to
> detect the correct compiler/linker flags for atf from your configure
> script.  If my memory serves well:
> PKG_CHECK_MODULES([ATF_C], [atf-c >= 0.10])
> And then just use $(ATF_C_CFLAGS) and $(ATF_C_LIBS) from your makefile.

Yes, I played a little bit with pkg-config and PKG_CHECK_MODULES, not
with much success. Will take a deeper look tomorrow.

>> By the way, I check /usr/bin/atf-run and /usr/bin/atf-report and none
>> of it has an option to show its version. I know that the version is
>> actually dumped in the output of atf-run when it executed tests, but
>> in cases like this I am not able to execute my tests.
> Use atf-version.
My miss! Actually I read about it, even took notes and then I forgot about it.


Tangra Mega Rock:

Home | Main Index | Thread Index | Old Index