Mailinglist Archive: opensuse-java (11 mails)

< Previous Next >
[opensuse-java] Re: Problem with linking - undefined glTexParameterf
  • From: Michal Vyskocil <mvyskocil@xxxxxxx>
  • Date: Wed, 10 Mar 2010 15:39:31 +0100
  • Message-id: <201003101539.37551.mvyskocil@xxxxxxx>
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

/* confdefs.h */
#define PACKAGE_NAME "Scilab"
#define PACKAGE_TARNAME "scilab"
#define PACKAGE_VERSION "5"
#define PACKAGE_STRING "Scilab 5"
#define PACKAGE_BUGREPORT "http://bugzilla.scilab.org/";
#define PACKAGE_URL ""
#define INSTALLPREFIX "/usr/local"
#define STDC_HEADERS 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRING_H 1
#define HAVE_MEMORY_H 1
#define HAVE_STRINGS_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_STDINT_H 1
#define HAVE_UNISTD_H 1
#define INSTALLPREFIX "/usr/local"
#define PACKAGE "scilab"
#define VERSION "5"
#define G95_FORTRAN /**/
#define SIZEOF_INT 4
#define SIZEOF_LONG 8
#define USE_DYNAMIC_STACK /**/
#define WTU /**/
#define CNAME(name1,name2) name1##name2
#define C2F(name) name##_
#define F2C(name) name##_
#define HAVE_LIBHDF5 1
#define HDF5_CFLAGS "-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/"
#define HDF5_LIBS "-lhdf5"
#define WITH_HDF5 /**/
/* end confdefs.h. */

/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char glTexParameterf ();
int
main ()
{
return glTexParameterf ();
;
return 0;
}
< Previous Next >
References