ATF-devel archive

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

Re: Error "Shared object "libatf-c.so.0" not found" on NetBSD



On Jul 15, 2010, at 10:39 AM, Ivan Rambius Ivanov wrote:

> Hello Julio,
> 
> On Thu, Jul 15, 2010 at 11:10 AM, Julio Merino <jmmv%netbsd.org@localhost> 
> wrote:
>> There is nothing to fix here.  Each platform has its own way of
>> specifying compiler flags, and in particular, the rpath stuff is quite
>> platform dependent.  If the user is providing additional flags, he is
>> responsible for doing the right thing.
>> 
>> Using the pkgconfig files for the libraries you are interested in will
>> "just work" though.  You will just need to point configure to the
>> right location of the .pc files (with PKG_CONFIG_PATH) and all
>> compiler/linker flags will be detected automatically.
> 
> After some reading I understood how to use pkg-config with autotools.
> For the sake of completeness, I am posting my build scripts.
> 
> In configure.ac I have
> 
> #                                               -*- Autoconf -*-
> # Process this file with autoconf to produce a configure script.
> 
> AC_INIT([cryptoexamples], [0.1], [rambiusparkisanius%gmail.com@localhost])
> AC_CONFIG_AUX_DIR(config)
> AC_CONFIG_SRCDIR([src])
> AC_CONFIG_HEADERS([config.h])
> AM_INIT_AUTOMAKE
> 
> # Checks for programs.
> AC_PROG_CC
> AC_PROG_RANLIB
> AC_PATH_PROG([ATFRUN], [atf-run])
> AC_PATH_PROG([ATFREPORT], [atf-report])
> 
> # Checks for libraries.
> 
> # Checks for header files.
> 
> # Checks for typedefs, structures, and compiler characteristics.
> 
> # Checks for library functions.
> 
> # Checks for packages with pkg-config .pc files
> PKG_CHECK_MODULES([OPENSSL], [openssl >= 0.9.7])
> PKG_CHECK_MODULES([ATF_C], [atf-c >= 0.10])
> 
> AC_CONFIG_FILES([Makefile src/Makefile])
> AC_OUTPUT
> 
> I replaced all autoconf checks for libs and headers for openssl and
> atf with pkg-config checks for the modules. In my src/Makefile.am I
> have
> 
> AM_CPPFLAGS=$(OPENSSL_CFLAGS) $(ATF_C_CFLAGS)
> AM_LDFLAGS=$(OPENSSL_LIBS) $(ATF_C_LIBS)
> 
> 
> Of course, my scripts are not perfect. Next I will split the sources
> and the tests in different directories.
> 
> Once again, thank you very much for your pointers.

        If you read ./configure --help, it has helpful pointers on what you can 
specify on the command line to get things to work properly; If the project 
conforms to GNU autotools conventions, the proper way to do things is: CPPFLAGS 
for -D / -I flags on that will get passed to cc / cpp, CFLAGS for anything else 
that needs to be passed to cc directly, LDFLAGS for everything minus -lfoo 
flags, LDLIBS for everything like -lfoo.
        You need to specify the -rpath junk in LDFLAGS (just provided the 
background to make sure that you had a consistent understanding of how things 
are from an autotools perspective).
HTH,
-Garrett

PS FreeBSD at least doesn't have the level of complexity with CPPFLAGS, and 
displaces LDLIBS for LDADD -- just a sidenote.


Home | Main Index | Thread Index | Old Index