Date: Sun, 25 Jan 2004 14:06:02 -0800 From: "Renaud Waldura" <renaud+freebsd-java@waldura.com> To: <freebsd-java@freebsd.org> Subject: Re: Problems linking against pthreads Message-ID: <001f01c3e38f$6d6b8fa0$011211ac@biohz.net> References: <001101c3e384$ae908180$011211ac@biohz.net>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --] I got it. I needed to link the glue library against libc_r. I attach a patch with my changes, maybe it will help somebody one day... ----- Original Message ----- From: "Renaud Waldura" <renaud+freebsd-java@waldura.com> To: <freebsd-java@freebsd.org> Sent: Sunday, January 25, 2004 12:49 PM Subject: Problems linking against pthreads > I'm attempting to write an Icecast stream source in Java. I've got Icecast > 2.0 all built up and working, with all its libraries libshout, libvorbis > etc. > > I have found this package: > http://benow.ca/index?page=project&project=libshout-java > that allows me to make calls to libshout from a Java program, but I'm having > a hard time getting the library links resolved correctly. > > When running a Java program that uses the libshout-java glue, I get: > > java.lang.UnsatisfiedLinkError: > /home/renaud/src/libshout-java-0.1-freebsd/native/libshoutjava.so.1.0: > /usr/local/lib/libshout.so.3: Undefined symbol "pthread_cond_signal" > > OK, so it looks like libshout needs pthreads. Another program that uses > libshout is linked against both libc and libc_r, thus including pthreads. > > work/ices-2.0-Beta2/src/ices: > libshout.so.3 => /usr/local/lib/libshout.so.3 (0x28158000) > libc_r.so.4 => /usr/lib/libc_r.so.4 (0x28343000) > libc.so.4 => /usr/lib/libc.so.4 (0x283fa000) > > Yet the Diablo VM I'm using is linked against libc only: > > java version "1.3.1" > Java(TM) 2 Runtime Environment, Standard Edition (build diablo-1.3.1-0) > Classic VM (build diablo-1.3.1-0, green threads, nojit) > > /usr/local/diablo-jdk1.3.1/jre/bin/i386/green_threads/java: > libhpi.so => not found (0x0) > libc.so.4 => /usr/lib/libc.so.4 (0x28067000) > > This is where I get stuck. How can I provide libc_r to my libshout when the > VM doesn't use it? Or is this the wrong approach? > > I'm running FreeBSD 4.2-RELEASE. Thanks for any clues! > > --Renaud > [-- Attachment #2 --] Only in libshout-java-0.1: build diff -u -r libshout-java-0.1/build.xml libshout-java-0.1-freebsd/build.xml --- libshout-java-0.1/build.xml Sun Dec 14 18:26:00 2003 +++ libshout-java-0.1-freebsd/build.xml Sun Jan 25 02:27:04 2004 @@ -58,7 +58,7 @@ <target name="native" depends="compile" description="Compile native code"> - <exec dir="native" executable="make"/> + <exec dir="native" executable="gmake"/> </target> <target name="jar" depends="compile" Only in libshout-java-0.1: dist diff -u -r libshout-java-0.1/native/Makefile libshout-java-0.1-freebsd/native/Makefile --- libshout-java-0.1/native/Makefile Sun Dec 14 18:26:00 2003 +++ libshout-java-0.1-freebsd/native/Makefile Sun Jan 25 13:43:53 2004 @@ -1,5 +1,5 @@ # v-- Change these to match your install --v -prefix=/opt/jdk +prefix=/usr/local/diablo-jdk1.3.1 # SHELL = /bin/sh @@ -7,11 +7,11 @@ JAVADIR=$(prefix) REL_JAVAEXTLIBPATH=jre/lib/i386 JAVAEXTLIBPATH=$(JAVADIR)/$(REL_JAVAEXTLIBPATH) -OSNAME=linux +OSNAME=freebsd ARCHNAME=i386 CC=gcc DEFINES=-DUSE_LAME_API -CPPFLAGS=-g -Wall -I$(JAVADIR)/include -I$(JAVADIR)/include/$(OSNAME) -fPIC -D_REENTRANT $(DEFINES) +CPPFLAGS=-g -Wall -I/usr/local/include -I$(JAVADIR)/include -I$(JAVADIR)/include/$(OSNAME) -fPIC -D_THREAD_SAFE $(DEFINES) INSTALL = /bin/install -c INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 @@ -30,7 +30,7 @@ LIBDEST=$(LIBBASENAME).so.1.0 LIBDEST_ABSOLUTE=$(ABS_PREFIX)/$(LIBDEST) -LIBS=-lshout +LIBS=-lc_r -L/usr/local/lib -lshout JAVAH = javah -force -classpath $(OBJDIR) Binary files libshout-java-0.1/native/libshoutjava.so and libshout-java-0.1-freebsd/native/libshoutjava.so differ Binary files libshout-java-0.1/native/libshoutjava.so.1 and libshout-java-0.1-freebsd/native/libshoutjava.so.1 differ Binary files libshout-java-0.1/native/libshoutjava.so.1.0 and libshout-java-0.1-freebsd/native/libshoutjava.so.1.0 differ diff -u -r libshout-java-0.1/native/org_xiph_libshout_Shout.c libshout-java-0.1-freebsd/native/org_xiph_libshout_Shout.c --- libshout-java-0.1/native/org_xiph_libshout_Shout.c Sun Dec 14 18:26:00 2003 +++ libshout-java-0.1-freebsd/native/org_xiph_libshout_Shout.c Sun Jan 25 10:45:33 2004 @@ -326,12 +326,13 @@ */ JNIEXPORT jint JNICALL Java_org_xiph_libshout_Shout_n_1write(JNIEnv *env, jobject obj, jcharArray chars, jint len) { int i; - + jchar *elems; + // if the buffer is greater than our internal, return error (shouldn't happen) if (len>8192) return SHOUTERR_MALLOC; // copy to const array - jchar *elems=(*env)->GetCharArrayElements(env, chars, 0); + elems=(*env)->GetCharArrayElements(env, chars, 0); for (i=0;i<len;i++) buffer[i]=elems[i]; (*env)->ReleaseCharArrayElements(env, chars,elems,0);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?001f01c3e38f$6d6b8fa0$011211ac>
