guile-devel
[Top][All Lists]
Advanced

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

Re: Incorrect guile pkg-config --libs and --cflags


From: Sebastian Freundt
Subject: Re: Incorrect guile pkg-config --libs and --cflags
Date: Thu, 25 Apr 2013 05:49:32 +0000
User-agent: Gnus/5.130005 (Ma Gnus v0.5) SXEmacs/22.1.15 (linux)

Mark H Weaver <address@hidden> writes:

> Daniel Hartwig <address@hidden> writes:
>
>> On 15 April 2013 19:58, Daniel Hartwig <address@hidden> wrote:
>>> or peculiar to the linker, libguile on your system, other?
>>
>> I see that this is related to the linker in fedora, which debian seems
>> also in the process of supporting.  Indirect linkage like this is out
>> (apparently), and LIBS should properly include -pthread option.
>>
>> <https://fedoraproject.org/wiki/UnderstandingDSOLinkChange>
>> <http://wiki.debian.org/ToolChain/DSOLinking#Not_resolving_symbols_in_indirect_dependent_shared_libraries>
>
> FWIW, I've observed that on my Debian Wheezy system, almost all of the
> *.pc files that include "-pthread" in Cflags also include it in Libs.
>
> In the relevant bug report
> <https://bugzilla.redhat.com/show_bug.cgi?id=951781>, Sebastian Freundt
> claims that linking "any trivial test file test.c" against libguile
> (1.8) fails on Fedora 18 unless -pthread is used during linking.
>
> Apparently this is the case even if the main program does not directly
> use the pthread API.  I confess that I don't understand the reason for
> this, but if it's true, I'm inclined to believe that either we should
> add -pthread to the pkg-config Libs, or that perhaps this is a bug in
> the toolchain.  One way or another, $(pkg-config --libs guile-*) should
> provide what is needed to link a minimal test program with guile.
>
> I've taken the liberty of adding Sebastian to the CC list, since he
> already expressed an interest in raising this issue with upstream.
> Perhaps he can shed some light on this issue.

Hi there,
indeed I can shed some light, on a Fedora 16/17/18 try:

gcc -std=c99 -x c -c -o trivial.o -O2 $(pkg-config --cflags guile-1.8) - <<'EOF'
#include <libguile.h>

int
main(void)
{
        static scm_t_bits scm_tc16_echs_mod;
        SCM XSMOB;
        char smob[4];

        SCM_NEWSMOB(XSMOB, scm_tc16_echs_mod, smob);
        return 0;
}
EOF

followed by:

gcc -std=c99 -o trivial trivial.o $(pkg-config --libs guile-1.8) 
/usr/bin/ld: trivial.o: undefined reference to symbol 
'pthread_getspecific@@GLIBC_2.2.5'
/usr/bin/ld: note: 'pthread_getspecific@@GLIBC_2.2.5' is defined in DSO 
/lib64/libpthread.so.0 so try adding it to the linker command line
/lib64/libpthread.so.0: could not read symbols: Invalid operation
collect2: ld returned 1 exit status

whereas it would have worked if pkg-config --libs also emitted -lpthread.


Just for the sake of completeness:

ldd /usr/lib64/libguile.so
        linux-vdso.so.1 =>  (0x00007fff9a3ff000)
        libgmp.so.3 => /usr/lib64/libgmp.so.3 (0x0000003674600000)
        libcrypt.so.1 => /lib64/libcrypt.so.1 (0x0000003677600000)
        libm.so.6 => /lib64/libm.so.6 (0x0000003673e00000)
        libltdl.so.7 => /usr/lib64/libltdl.so.7 (0x00000033b2400000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x0000003672e00000)
        libc.so.6 => /lib64/libc.so.6 (0x0000003672a00000)
        /lib64/ld-linux-x86-64.so.2 (0x0000003672600000)
        libfreebl3.so => /lib64/libfreebl3.so (0x0000003677200000)
        libdl.so.2 => /lib64/libdl.so.2 (0x0000003673200000)

guile --version
Guile 1.8.8
Copyright (c) 1995, 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 
2008 Free Software Foundation
Guile may be distributed under the terms of the GNU General Public Licence;
certain other uses are permitted as well.  For details, see the file
`COPYING', which is included in the Guile distribution.
There is no warranty, to the extent permitted by law.

Cheers,
Sebastian



reply via email to

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