This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libobjc/78698] New: [7 regression] Using static PIC libgc fails when it has dependencies


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78698

            Bug ID: 78698
           Summary: [7 regression] Using static PIC libgc fails when it
                    has dependencies
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libobjc
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ro at gcc dot gnu.org
                CC: doko at gcc dot gnu.org
  Target Milestone: ---

When building with an external libgc 7.6.0, configured with --disable-shared
--with-pic to avoid rpath issues, yet be able to link it into libobjc_gc.so, I
ran
into build failures in various configurations:

* On x86_64-pc-linux-gnu, the system boehm-gc test fails:

configure:11605: checking for system boehm-gc
configure:11625: /var/gcc/regression/trunk/4.7.9-gcc-gas-gld/build/./gcc/xgcc
-B/var/gcc/regression/trunk/4.7.9-gcc-gas-gld/build/./gcc/
-B/vol/gcc/x86_64-pc-linux-gnu/bin/ -B/vol/gcc/x86_64-pc-linux-gnu/lib/
-isystem /vol/gcc/x86_64-pc-linux-gnu/include -isystem
/vol/gcc/x86_64-pc-linux-gnu/sys-include    -o conftest -g -O2
-I/vol/gcc/include   conftest.c  -L/vol/gcc/lib -lgc >&5
/vol/gcc/lib/libgc.a(misc.o): In function `GC_get_heap_usage_safe':
/vol/src/local/gc/gc-7.6.0/misc.c:530: undefined reference to
`pthread_mutex_trylock'

  and many more:

__pthread_register_cancel
__pthread_unregister_cancel
pthread_attr_getstack
pthread_cancel
pthread_create
pthread_detach
pthread_getattr_np
pthread_join
pthread_kill
pthread_mutex_trylock
pthread_mutexattr_destroy
pthread_mutexattr_init
pthread_mutexattr_settype
pthread_sigmask
sem_destroy
sem_getvalue
sem_init
sem_post
sem_wait

  We need to link with -lpthread here, and this dependency is correctly
recorded
  in libgc.la, yet not used here.  It may be a chicken-and-egg situation,
  however, because libtool is only build once configure has run to completion.

* Similarly on Solaris 10:

configure:11605: checking for system boehm-gc
configure:11625: /var/gcc/regression/trunk/10-gcc/build/./gcc/xgcc
-B/var/gcc/re
gression/trunk/10-gcc/build/./gcc/ -B/vol/gcc/i386-pc-solaris2.10/bin/
-B/vol/gc
c/i386-pc-solaris2.10/lib/ -isystem /vol/gcc/i386-pc-solaris2.10/include
-isyste
m /vol/gcc/i386-pc-solaris2.10/sys-include    -o conftest -g -O2
-I/vol/gcc/incl
ude   conftest.c  -L/vol/gcc/lib -lgc >&5
Undefined                       first referenced
 symbol                             in file
sched_yield                         /vol/gcc/lib/libgc.a(pthread_support.o)
sem_destroy                         /vol/gcc/lib/libgc.a(pthread_support.o)
sem_getvalue                        /vol/gcc/lib/libgc.a(pthread_stop_world.o)
sem_init                            /vol/gcc/lib/libgc.a(pthread_support.o)
sem_post                            /vol/gcc/lib/libgc.a(pthread_support.o)
sem_wait                            /vol/gcc/lib/libgc.a(pthread_support.o)
ld: fatal: symbol referencing errors. No output written to conftest
collect2: error: ld returned 1 exit status
[...]
configure:11663: error: system bdw-gc required but not found

  They are provided by librt, which is again recorded in libgc.la.

This used to work just fine with in-tree boehm-gc where libgc was built as
a convenience library and linked into libobjc_gc this way, taking care of the
depencencies.

  Rainer

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]