[opensuse-packaging] Re: Problem with linking - undefined glTexParameterf
Hi, JFI resent from opensuse-java, but problem is in gcc/ld, not in java On Monday 08 March 2010 11:00:05 am Kirill Kirillov wrote:
Hi, all!
We [1] are trying to move [2] Java-based Scilab [3] to Factory OSS repository.
We have problem with linking jogl JNI to Scilab [4], if we remove the following line in scilab.spec: "BuildRequires: -post-build-checks" then build fails on configure stage with the following error:
checking jogl... /usr/lib64/java//jogl.jar checking for glTexParameterf in -ljogl... no configure: WARNING: Could not link against -ljogl. Will try against -ljogl -lGL checking for glTexParameterf in -ljogl ... no configure: error: "libjogl: Library missing (Cannot find symbol glTexParameterf). Check if libjogl - C/Java (JNI) interface for JOGL - or libGL are installed and if the version is correct. Note that you might have to update etc/librarypath.xml to provide the actual path the the JNI libraries." error: Bad exit status from /var/tmp/rpm-tmp.CYklG7 (%build)
The configure script fails on a linking during gcc -o conftest conftest.c - L/usr/lib64/jni -ljogl. But the manual run in chroot works well and I got this error only when using build script. I did not find any problem during ld - there's the output with CFLAGS=-Wl,--trace,--trace-symbol=glTexParameterf This is the output from config.log from a first run with -ljogl only configure:11894: checking for glTexParameterf in -ljogl configure:11919: gcc -o conftest -fmessage-length=0 -O2 -Wall - D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind- tables -fno-strict-aliasing -Wl,--trace,--trace-symbol=glTexParameterf - DNDEBUG -fno-stack-protector -DNARROWPROTO -m64 - I$(top_srcdir)/modules/core/includes/ -I$(top_srcdir)/libs/MALLOC/includes/ - I$(top_srcdir)/modules/localization/includes/ -L/usr/lib/jni - L/usr/lib64/jni/ -L./thirdparty/ -L./bin/ conftest.c -ljogl >&5 /usr/lib64/gcc/x86_64-suse-linux/4.4/../../../../x86_64-suse-linux/bin/ld: mode elf_x86_64 /usr/lib64/gcc/x86_64-suse-linux/4.4/../../../../lib64/crt1.o /usr/lib64/gcc/x86_64-suse-linux/4.4/../../../../lib64/crti.o /usr/lib64/gcc/x86_64-suse-linux/4.4/crtbegin.o /tmp/ccKtTcdn.o -ljogl (/usr/lib64/jni//libjogl.so) -lgcc_s (/usr/lib64/gcc/x86_64-suse-linux/4.4/libgcc_s.so) /lib64/libc.so.6 (/usr/lib64/libc_nonshared.a)elf-init.oS /lib64/ld-linux-x86-64.so.2 -lgcc_s (/usr/lib64/gcc/x86_64-suse-linux/4.4/libgcc_s.so) /usr/lib64/gcc/x86_64-suse-linux/4.4/crtend.o /usr/lib64/gcc/x86_64-suse-linux/4.4/../../../../lib64/crtn.o /tmp/ccKtTcdn.o: reference to glTexParameterf /usr/lib64/jni//libjogl.so: reference to glTexParameterf /tmp/ccKtTcdn.o: In function `main': conftest.c:(.text+0x7): undefined reference to `glTexParameterf' /usr/lib64/gcc/x86_64-suse-linux/4.4/../../../../x86_64-suse-linux/bin/ld: link errors found, deleting executable `conftest' collect2: ld returned 1 exit status configure:11919: $? = 1 The second run with -lGL gcc -o conftest -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack- protector -funwind-tables -fasynchronous-unwind-tables -fno-strict-aliasing - Wl,--trace,--trace-symbol=glTexParameterf -DNDEBUG -fno-stack-protector - DNARROWPROTO -m64 -I$(top_srcdir)/modules/core/includes/ - I$(top_srcdir)/libs/MALLOC/includes/ - I$(top_srcdir)/modules/localization/includes/ -L/usr/lib/jni - L/usr/lib64/jni/ -L./thirdparty/ -L./bin/ -lGL conftest.c -ljogl >&5 /usr/lib64/gcc/x86_64-suse-linux/4.4/../../../../x86_64-suse-linux/bin/ld: mode elf_x86_64 /usr/lib64/gcc/x86_64-suse-linux/4.4/../../../../lib64/crt1.o /usr/lib64/gcc/x86_64-suse-linux/4.4/../../../../lib64/crti.o /usr/lib64/gcc/x86_64-suse-linux/4.4/crtbegin.o -lGL (/usr/lib64/gcc/x86_64-suse-linux/4.4/../../../../lib64/libGL.so) /tmp/cckG39mv.o -ljogl (/usr/lib64/jni//libjogl.so) -lgcc_s (/usr/lib64/gcc/x86_64-suse-linux/4.4/libgcc_s.so) /lib64/libc.so.6 (/usr/lib64/libc_nonshared.a)elf-init.oS /lib64/ld-linux-x86-64.so.2 -lgcc_s (/usr/lib64/gcc/x86_64-suse-linux/4.4/libgcc_s.so) /usr/lib64/gcc/x86_64-suse-linux/4.4/crtend.o /usr/lib64/gcc/x86_64-suse-linux/4.4/../../../../lib64/crtn.o /usr/lib64/gcc/x86_64-suse-linux/4.4/../../../../lib64/libGL.so: definition of glTexParameterf /tmp/cckG39mv.o: reference to glTexParameterf /usr/lib64/jni//libjogl.so: reference to glTexParameterf /tmp/cckG39mv.o: In function `main': conftest.c:(.text+0x7): undefined reference to `glTexParameterf' /usr/lib64/gcc/x86_64-suse-linux/4.4/../../../../x86_64-suse-linux/bin/ld: link errors found, deleting executable `conftest' collect2: ld returned 1 exit status On the other side the build of conftest.c in chroot works well - be aware that I use the shortest form, but there's no difference when I use the same set of arguments as configure does, it is built well. gcc -L/usr/lib64/jni -o conftest conftest.c -ljogl -Wl,--trace,--trace- symbol=glTexParameterf /usr/lib64/gcc/x86_64-suse-linux/4.4/../../../../x86_64-suse-linux/bin/ld: mode elf_x86_64 /usr/lib64/gcc/x86_64-suse-linux/4.4/../../../../lib64/crt1.o /usr/lib64/gcc/x86_64-suse-linux/4.4/../../../../lib64/crti.o /usr/lib64/gcc/x86_64-suse-linux/4.4/crtbegin.o /tmp/ccUZe3IC.o -ljogl (/usr/lib64/jni/libjogl.so) -lgcc_s (/usr/lib64/gcc/x86_64-suse-linux/4.4/libgcc_s.so) /lib64/libc.so.6 (/usr/lib64/libc_nonshared.a)elf-init.oS /lib64/ld-linux-x86-64.so.2 -lgcc_s (/usr/lib64/gcc/x86_64-suse-linux/4.4/libgcc_s.so) /usr/lib64/gcc/x86_64-suse-linux/4.4/crtend.o /usr/lib64/gcc/x86_64-suse-linux/4.4/../../../../lib64/crtn.o /tmp/ccUZe3IC.o: reference to glTexParameterf /usr/lib64/jni/libjogl.so: reference to glTexParameterf /usr/lib64/libGL.so.1: definition of glTexParameterf gcc -L/usr/lib64/jni -o conftest conftest.c -lGL -ljogl -Wl,--trace,--trace- symbol=glTexParameterf /usr/lib64/gcc/x86_64-suse-linux/4.4/../../../../x86_64-suse-linux/bin/ld: mode elf_x86_64 /usr/lib64/gcc/x86_64-suse-linux/4.4/../../../../lib64/crt1.o /usr/lib64/gcc/x86_64-suse-linux/4.4/../../../../lib64/crti.o /usr/lib64/gcc/x86_64-suse-linux/4.4/crtbegin.o /tmp/cc4FryQF.o -lGL (/usr/lib64/gcc/x86_64-suse-linux/4.4/../../../../lib64/libGL.so) -ljogl (/usr/lib64/jni/libjogl.so) -lgcc_s (/usr/lib64/gcc/x86_64-suse-linux/4.4/libgcc_s.so) /lib64/libc.so.6 (/usr/lib64/libc_nonshared.a)elf-init.oS /lib64/ld-linux-x86-64.so.2 -lgcc_s (/usr/lib64/gcc/x86_64-suse-linux/4.4/libgcc_s.so) /usr/lib64/gcc/x86_64-suse-linux/4.4/crtend.o /usr/lib64/gcc/x86_64-suse-linux/4.4/../../../../lib64/crtn.o /tmp/cc4FryQF.o: reference to glTexParameterf /usr/lib64/gcc/x86_64-suse-linux/4.4/../../../../lib64/libGL.so: definition of glTexParameterf /usr/lib64/jni/libjogl.so: reference to glTexParameterf conftest.c is attached and you need libGL.so and ligjogl.so from Education project to build. Does anyone have an idea what's wrong? Regards Michal Vyskocil
I've fixed jogl package [5] to place jar's and so's according to [6]: /usr/lib/java and /usr/lib/jni for 32 bits and /usr/lib64/java and /usr/lib64/jni for 64 bits. But unfortunately it didn't help.
Could you tell please how to fix it? Thanks.
[1] http://lists.opensuse.org/opensuse-edu/2010-03/msg00000.html [2] http://en.opensuse.org/Scilab/Moving [3] http://www.scilab.org/ [4] https://build.opensuse.org/package/show?package=scilab&project=Education [5] https://build.opensuse.org/package/show?package=jogl&project=Education [6] http://en.opensuse.org/Packaging/Java#Packaging_JAR_files_that_use_JNI
On Wed, Mar 10, 2010 at 03:39:31PM +0100, Michal Vyskocil wrote:
Hi,
JFI resent from opensuse-java, but problem is in gcc/ld, not in java
gcc -L/usr/lib64/jni -o conftest conftest.c -lGL -ljogl -Wl,--trace,--trace- symbol=glTexParameterf
You need to swap the position of -ljogl and -lGL to meet the --as-needed needs I guess. Ciao, Marcus -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
Hello, On Wed, 10 Mar 2010, Michal Vyskocil wrote:
The second run with -lGL gcc -o conftest -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack- protector -funwind-tables -fasynchronous-unwind-tables -fno-strict-aliasing - Wl,--trace,--trace-symbol=glTexParameterf -DNDEBUG -fno-stack-protector - DNARROWPROTO -m64 -I$(top_srcdir)/modules/core/includes/ - I$(top_srcdir)/libs/MALLOC/includes/ - I$(top_srcdir)/modules/localization/includes/ -L/usr/lib/jni - L/usr/lib64/jni/ -L./thirdparty/ -L./bin/ -lGL conftest.c -ljogl >&5
You need to put the -lGL argument after the conftest.c argument. In the buildservice the semantics of shared library linking is a bit stricter and similar to static libraries. It's a side-effect of doing library as-needed processing by default in the buildsystem (but only when building packages from .spec file). Ciao, Michael. -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
On Wednesday 10 March 2010 06:16:38 pm Michael Matz wrote:
Hello,
On Wed, 10 Mar 2010, Michal Vyskocil wrote:
The second run with -lGL gcc -o conftest -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack- protector -funwind-tables -fasynchronous-unwind-tables -fno-strict-aliasing - Wl,--trace,--trace-symbol=glTexParameterf -DNDEBUG -fno-stack-protector - DNARROWPROTO -m64 -I$(top_srcdir)/modules/core/includes/ - I$(top_srcdir)/libs/MALLOC/includes/ - I$(top_srcdir)/modules/localization/includes/ -L/usr/lib/jni - L/usr/lib64/jni/ -L./thirdparty/ -L./bin/ -lGL conftest.c -ljogl >&5
You need to put the -lGL argument after the conftest.c argument. In the buildservice the semantics of shared library linking is a bit stricter and similar to static libraries. It's a side-effect of doing library as-needed processing by default in the buildsystem (but only when building packages from .spec file).
Marcus and Michael, thanks a lot - I removed the LDFLAGS hack in configure.ac and added -lGL as last argument of AC_CHECK_LIB and it works well. Regards Michal Vyskocil
Ciao, Michael.
participants (3)
-
Marcus Meissner
-
Michael Matz
-
Michal Vyskocil