|
Nihathrael
|
|
Post:
Oct 25th 2007 at 10:47 AM |
|
|
I fixed most of the problems i had allready, but i can't figure what this means:
[exec] gcc -lasound -lpthread -shared -o libMidiReceiverJNI.so midi_receiver.o -fPIC
[exec] /usr/bin/ld: midi_receiver.o: relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
[exec] midi_receiver.o: could not read symbols: Bad value
[exec] collect2: ld returned 1 exit status
[exec] make: *** [libMidiReceiverJNI.so] Error 1
|
|
| Back to Top |
| |
|
Julian
|
|
Post:
Oct 25th 2007 at 12:46 PM |
|
|
Hi..
did you modify src/jni/MakeFile ?? i thik yes because the "-fPIC" option...
well the error says "recompile with -fPIC" so..
i suggest you modify the MakeFile, and replace:
$(CXX) $(INCLUDES) -c -o $@ $<
To:
$(CXX) $(INCLUDES) -fPIC -c -o $@ $<
please let me know if it works..
|
|
| Back to Top |
| |
|
Nihathrael
|
|
Post:
Oct 25th 2007 at 5:09 PM |
|
|
Nope that still gives the same error, i couldn't find any doku about-fPIC anyhow, seams its not an official command.
Still gives the sam error.
thanks anyway :)
|
|
| Back to Top |
| |
|
Julian
|
|
Post:
Oct 25th 2007 at 5:52 PM |
|
|
Well, i don't have a 64bit PC .. so it's very hard fix it for me...
but as i read on the web.. that's an usual error.. and add -fPIC flags to compiler ( not same as linker ) fix if
can you paste here the content of your modified src/jni/MakeFile ?
|
|
| Back to Top |
| |
|
Nihathrael
|
|
Post:
Oct 25th 2007 at 9:21 PM |
|
|
CXX = gcc
INCLUDES = -I $(JAVA_HOME)/include/ -I $(JAVA_HOME)/include/linux/
LIBRARIES = -lasound -lpthread
LIBRARY = libMidiReceiverJNI.so
OBJECTS = midi_receiver.o
.SUFFIXES: .o .c
.c.o :
$(CXX) $(INCLUDES) -c -o $@ $<
all: $(LIBRARY)
$(LIBRARY): $(OBJECTS)
$(CXX) $(LIBRARIES) -shared -o $(LIBRARY) $(OBJECTS)
clean:
rm -f $(OBJECTS) $(LIBRARY)
All i did was uncomment the include line.
|
|
| Back to Top |
| |
|
Julian
|
|
Post:
Oct 26th 2007 at 12:45 AM |
|
|
mmm i can't understand..
on the top post, the error log say:
[exec] gcc -lasound -lpthread -shared -o libMidiReceiverJNI.so midi_receiver.o -fPIC
but at this makefile there is not "-fPIC" flag.. so i don't have idea why it appears...
can you try build the library manually ???
doing this:
export JAVA_HOME=[WHERE IS JAVA]
cd src/jni
gcc -I${JAVA_HOME}/include/ -I${JAVA_HOME}/include/linux/ -c -o midi_receiver.o midi_receiver.c
gcc -shared -o libMidiReceiverJNI.so midi_receiver.o -lasound -lpthread
|
|
| Back to Top |
| |
|
Nihathrael
|
|
Post:
Oct 26th 2007 at 6:15 AM |
|
|
Still gives the same error :-/
[nihathrael@myhost src]$ cd jni
[nihathrael@myhost jni]$ export JAVA_HOME=/opt/java/
[nihathrael@myhost jni]$ $JAVA_HOME
bash: /opt/java/: is a directory
[nihathrael@myhost jni]$ gcc -I${JAVA_HOME}/include/ -I${JAVA_HOME}/include/linux/ -c -o midi_receiver.o midi_receiver.c
[nihathrael@myhost jni]$ gcc -shared -o libMidiReceiverJNI.so midi_receiver.o -lasound -lpthread
/usr/bin/ld: midi_receiver.o: relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
midi_receiver.o: could not read symbols: Bad value
collect2: ld returned 1 exit status
[nihathrael@myhost jni]$
|
|
| Back to Top |
| |
|
Julian
|
|
Post:
Oct 26th 2007 at 6:34 PM |
|
|
mmm.. i don't know what to say..
i search at the web.. but in all sites i see the same..
use "-fPIC".. but it doesn't works..
and a don't have a 64bit PC to test anything...
it should be a single "how to build a shared library" for x64
sorry
|
|
| Back to Top |
| |
|
Nihathrael
|
|
Post:
Oct 26th 2007 at 8:47 PM |
|
|
I managed to compile the file manually like this:
gcc -fPIC -I $JAVA_HOME/include/ -I $JAVA_HOME/include/linux/ -c midi_receiver.c
gcc -shared -o libMidiReceiverJNI.so midi_receiver.o
Maybe this can be of any help for future makefiles!
Now i just have to figure out what to do with the files i have now ;)
|
|
| Back to Top |
| |
|
Nihathrael
|
|
Post:
Oct 26th 2007 at 9:05 PM |
|
|
/opt/java/bin/java: symbol lookup error: /home/nihathrael/Apps/TuxGuitar/lib/libMidiReceiverJNI.so: undefined symbol: snd_seq_open
Is the error i get now, when trying to start tuxguitar with the plugin :-/
|
|
| Back to Top |
| |
|
Julian
|
|
Post:
Oct 26th 2007 at 9:07 PM |
|
|
that's exactly what you did ??
alsa library need be linked ( "-lasound" )
|
|
| Back to Top |
| |
|
Julian
|
|
Post:
Oct 26th 2007 at 9:09 PM |
|
|
mmm.. we write at same time..
that's exactly the problem.
"snd_seq_open" is part of alsa sound library..
you must link it:
gcc -shared -o libMidiReceiverJNI.so midi_receiver.o -lasound
|
|
| Back to Top |
| |
|
Nihathrael
|
|
Post:
Oct 27th 2007 at 6:12 AM |
|
|
Ok, everything is working fine now:
gcc -fPIC -I $JAVA_HOME/include/ -I $JAVA_HOME/include/linux/ -c midi_receiver.c
gcc -shared -o libMidiReceiverJNI.so midi_receiver.o -lasound -lpthread
I hope this can be of any help for the future make file, would be great if x64 support came out of the box. I would love to add a package of Tuxguitar to the ArchLinux AUR database!
|
|
| Back to Top |
| |
|
Julian
|
|
Post:
Oct 27th 2007 at 3:02 PM |
|
|
well.. great.. so the solution was add "-fPIC" to the compiler.
but i can't understand something.. when i say you in previous post replace:
$(CXX) $(INCLUDES) -c -o $@ $<
To:
$(CXX) $(INCLUDES) -fPIC -c -o $@ $<
did you do that right ?? so it didn't works..
or maybe you confused and replace this other line ?
$(CXX) $(LIBRARIES) -shared -o $(LIBRARY) $(OBJECTS)
i ask you it, because to fix it on the CVS makefile.
> I hope this can be of any help for the future make file,
> would be great if x64 support came out of the box
Ofcourse it helps.. a new MakeFile was uploaded to CVS version ( it needs CVS version of tuxguitar )
> I would love to add a package of Tuxguitar to the ArchLinux AUR database!
it would be great!!.. if you do that, you can send me a download link to put on downloads section.
thanks
|
|
| Back to Top |
| |
|
Nihathrael
|
|
Post:
Oct 27th 2007 at 3:23 PM |
|
|
I recall trying it in both lines, but i will test that again tomorrow and report back.
A cvs version is no problem for ArchLinux packages, i'll have to see what i can do(never built a cvs package befor). I'll send you a link if i manage to put it online.
|
|
| Back to Top |
| |
|
dom
|
|
Post:
Nov 24th 2007 at 6:43 PM |
|
|
I tried this :
$(CXX) $(INCLUDES) -fPIC -c -o $@ $<
but strangely it didn't work ?!?
so I tried this :
CXX = gcc -fPIC
instead of
CXX = gcc
and now it does :)
|
|
| Back to Top |
| |