diff mbox

[v2] package/gauche: fix 'dlfcn.h: No such file' on autobuild

Message ID 201511171550.tAHFoAcS030490@ms-omx01.plus.so-net.ne.jp
State Accepted
Headers show

Commit Message

kei-k@ca2.so-net.ne.jp Nov. 17, 2015, 3:50 p.m. UTC
Ported from bdwgc package.
When build with BR2_STATIC_LIBS environment, prevent to use dlopen().

Fix:
http://autobuild.buildroot.org/results/da5/da5b9605552d4914c5e6f0d890367b92536419c1

Signed-off-by: Hiroshi Kawashima <kei-k@ca2.so-net.ne.jp>
---
Changes:
v1 -> v2
- refelect comment from Thomas for refine.
---
============================================================
    Hiroshi Kawashima

Comments

Peter Korsgaard Nov. 17, 2015, 8:26 p.m. UTC | #1
>>>>> "Hiroshi" == Hiroshi Kawashima <kei-k@ca2.so-net.ne.jp> writes:

 > Ported from bdwgc package.
 > When build with BR2_STATIC_LIBS environment, prevent to use dlopen().

 > Fix:
 > http://autobuild.buildroot.org/results/da5/da5b9605552d4914c5e6f0d890367b92536419c1

 > Signed-off-by: Hiroshi Kawashima <kei-k@ca2.so-net.ne.jp>
 > ---
 > Changes:
 > v1 -> v2
 > - refelect comment from Thomas for refine.

Committed, thanks.
Thomas Petazzoni Nov. 17, 2015, 8:40 p.m. UTC | #2
Dear Hiroshi Kawashima,

On Wed, 18 Nov 2015 00:50:10 +0900, Hiroshi Kawashima wrote:
> Ported from bdwgc package.
> When build with BR2_STATIC_LIBS environment, prevent to use dlopen().
> 
> Fix:
> http://autobuild.buildroot.org/results/da5/da5b9605552d4914c5e6f0d890367b92536419c1
> 
> Signed-off-by: Hiroshi Kawashima <kei-k@ca2.so-net.ne.jp>

This patch is not sufficient. It still fails to build, later, because
gauche tries to build a shared library. So I believe gauche really
needs to depend on !BR2_STATIC_LIBS. Here is the failure you get:

gcc -O2 -DHAVE_CONFIG_H -o arm-buildroot-linux-uclibcgnueabi-gauche-config gauche-config.c
TARGETLIB=`pwd`  /home/thomas/projets/buildroot/output/host/usr/bin/arm-linux-gcc -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -Os  -static -std=gnu99 -DGC_NO_DLOPEN -fPIC -Wl,--rpath -Wl,`pwd` -L. -static  -o gauche-config gauche-config.o -lcrypt -lutil -lrt -lm  -lpthread
TARGETLIB=`pwd`  /home/thomas/projets/buildroot/output/host/usr/bin/arm-linux-gcc -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -Os  -static -std=gnu99 -DGC_NO_DLOPEN -fPIC -Wl,--rpath -Wl,`pwd` -L. -static  -Wl,--soname,libgauche-0.9.so.0.4  -shared -o libgauche-0.9.so box.o core.o vm.o compaux.o macro.o code.o error.o class.o prof.o collection.o boolean.o char.o string.o list.o hash.o treemap.o bits.o port.o write.o read.o vector.o weak.o symbol.o gloc.o compare.o regexp.o signal.o parameter.o module.o proc.o number.o bignum.o load.o paths.o lazy.o repl.o autoloads.o system.o compile.o libalpha.o libbool.o libchar.o libcode.o libcmp.o libdict.o libeval.o libexc.o libfmt.o libio.o liblazy.o liblist.o libmisc.o libmod.o libnum.o libobj.o libomega.o libproc.o librx.o libstr.o libsym.o libsys.o libvec.o `ls -1 ../gc/.libs/*.o | grep -v '/cord' | grep -v '/staticrootslib'` `ls -1 ../gc/libatomic_ops/src/.libs/*.o` -lcrypt -lutil -lrt -lm  -lpthread
ls: cannot access ../gc/.libs/*.o: No such file or directory
ls: cannot access ../gc/libatomic_ops/src/.libs/*.o: No such file or directory
/home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libc.a(__uClibc_main.os): In function `__uClibc_fini':
__uClibc_main.c:(.text+0x138): undefined reference to `__fini_array_end'
__uClibc_main.c:(.text+0x13c): undefined reference to `__fini_array_start'
__uClibc_main.c:(.text+0x140): undefined reference to `__fini_array_start'
/home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libc.a(__uClibc_main.os): In function `__uClibc_main':
__uClibc_main.c:(.text+0x568): undefined reference to `__preinit_array_start'
__uClibc_main.c:(.text+0x56c): undefined reference to `__preinit_array_end'
__uClibc_main.c:(.text+0x570): undefined reference to `__preinit_array_start'
__uClibc_main.c:(.text+0x574): undefined reference to `__init_array_start'
__uClibc_main.c:(.text+0x578): undefined reference to `__init_array_end'
__uClibc_main.c:(.text+0x57c): undefined reference to `__init_array_start'
/home/thomas/projets/buildroot/output/host/opt/ext-toolchain/bin/../lib/gcc/arm-buildroot-linux-uclibcgnueabi/4.9.3/../../../../arm-buildroot-linux-uclibcgnueabi/bin/ld: libgauche-0.9.so: hidden symbol `__fini_array_end' isn't defined
/home/thomas/projets/buildroot/output/host/opt/ext-toolchain/bin/../lib/gcc/arm-buildroot-linux-uclibcgnueabi/4.9.3/../../../../arm-buildroot-linux-uclibcgnueabi/bin/ld: final link failed: Bad value

When building the following minimal configuration:

BR2_arm=y
BR2_STATIC_LIBS=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y
BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y
BR2_TOOLCHAIN_EXTERNAL_URL="http://autobuild.buildroot.org/toolchains/tarballs/br-arm-full-static-2015.08-647-gc356fb2.tar.bz2"
BR2_TOOLCHAIN_EXTERNAL_GCC_4_9=y
BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_14=y
BR2_TOOLCHAIN_EXTERNAL_LOCALE=y
# BR2_TOOLCHAIN_EXTERNAL_HAS_THREADS_DEBUG is not set
BR2_TOOLCHAIN_EXTERNAL_INET_RPC=y
BR2_TOOLCHAIN_EXTERNAL_CXX=y
BR2_INIT_NONE=y
BR2_SYSTEM_BIN_SH_NONE=y
# BR2_PACKAGE_BUSYBOX is not set
BR2_PACKAGE_GAUCHE=y
# BR2_TARGET_ROOTFS_TAR is not set

Best regards,

Thomas
Peter Korsgaard Nov. 17, 2015, 10:29 p.m. UTC | #3
>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@free-electrons.com> writes:

 > Dear Hiroshi Kawashima,
 > On Wed, 18 Nov 2015 00:50:10 +0900, Hiroshi Kawashima wrote:
 >> Ported from bdwgc package.
 >> When build with BR2_STATIC_LIBS environment, prevent to use dlopen().
 >> 
 >> Fix:
 >> http://autobuild.buildroot.org/results/da5/da5b9605552d4914c5e6f0d890367b92536419c1
 >> 
 >> Signed-off-by: Hiroshi Kawashima <kei-k@ca2.so-net.ne.jp>

 > This patch is not sufficient. It still fails to build, later, because
 > gauche tries to build a shared library. So I believe gauche really
 > needs to depend on !BR2_STATIC_LIBS. Here is the failure you get:

Ok, I'll drop it then.
diff mbox

Patch

diff --git a/package/gauche/gauche.mk b/package/gauche/gauche.mk
index b887c6a..e708068 100644
--- a/package/gauche/gauche.mk
+++ b/package/gauche/gauche.mk
@@ -20,13 +20,21 @@  else
 GAUCHE_CONF_OPTS += --without-zlib
 endif
 
+GAUCHE_CFLAGS = $(TARGET_CFLAGS)
+
 # Detection of c99 support in configure fails without WCHAR. To enable
 # automatic detection of c99 support by configure, we need to enable
 # WCHAR in toolchain. But actually we do not need WCHAR at gauche
 # runtime. So reuesting WCHAR in toolchain just for automatic detection
 # will be overkill. To solve this, explicitly -std=gnu99 is specified
 # here.
-GAUCHE_CONF_ENV = CFLAGS="$(TARGET_CFLAGS) -std=gnu99"
+GAUCHE_CFLAGS += -std=gnu99
+
+ifeq ($(BR2_STATIC_LIBS),y)
+GAUCHE_CFLAGS += -DGC_NO_DLOPEN
+endif
+
+GAUCHE_CONF_ENV = CFLAGS="$(GAUCHE_CFLAGS)"
 
 $(eval $(host-autotools-package))
 $(eval $(autotools-package))