unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Sebastian Freundt <freundt@fresse.org>
To: Mark H Weaver <mhw@netris.org>
Cc: guile-devel@gnu.org
Subject: Re: Incorrect guile pkg-config --libs and --cflags
Date: Thu, 25 Apr 2013 05:49:32 +0000	[thread overview]
Message-ID: <871u9zb1n7.fsf@segen.fresse.org> (raw)
In-Reply-To: <87li885r76.fsf@tines.lan> (Mark H. Weaver's message of "Wed, 24 Apr 2013 03:21:49 -0400")

Mark H Weaver <mhw@netris.org> writes:

> Daniel Hartwig <mandyke@gmail.com> writes:
>
>> On 15 April 2013 19:58, Daniel Hartwig <mandyke@gmail.com> 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	other threads:[~2013-04-25  5:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-15  8:26 Incorrect guile pkg-config --libs and --cflags Jan Synacek
2013-04-15 11:58 ` Daniel Hartwig
2013-04-15 13:45   ` Daniel Hartwig
2013-04-15 13:59     ` Daniel Hartwig
2013-04-16  6:35     ` Jan Synacek
2013-04-24  7:21     ` Mark H Weaver
2013-04-25  5:49       ` Sebastian Freundt [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871u9zb1n7.fsf@segen.fresse.org \
    --to=freundt@fresse.org \
    --cc=guile-devel@gnu.org \
    --cc=mhw@netris.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).