LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: prinz on May 24, 2006, 03:57:20

Title: Problems building lwjgl on linux x86_64
Post by: prinz on May 24, 2006, 03:57:20
Hi,

I'm having trouble linking the shared library for lwjgl on SuSE 10.0 x86_64.  

I did the following:

cd src/native/linux
make -f Makefile.amd64

... everything compiles fine and then:

/usr/lib64/gcc/x86_64-suse-linux/4.0.2/../../../../x86_64-suse-linux/bin/ld: /usr/X11R6/lib64/libXxf86vm.a(XF86VMode.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/usr/X11R6/lib64/libXxf86vm.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make: *** [liblwjgl.so] Error 1

JOGL builds and runs fine so I was expecting a much smoother experience
trying to build LWJGL.  The pre-built 32-bit shared library doesn't load, so
I was trying to build my own.  Anybody have experience building a 64 bit
version?  I want to use JME which requires LWJGL.
Title: Problems building lwjgl on linux x86_64
Post by: Matzon on May 24, 2006, 05:44:22
I know others have successfully compiled it. Please search the forum or join #lwjgl on freenode (IRC). Ulfjack (I think) is running amd64.
Title: Problems building lwjgl on linux x86_64
Post by: Golly on May 24, 2006, 19:51:13
howdy

i tried to compile lwjgl on a athlon64 3200+ running gentoo linux (in 64bit) using the 64 bit jdk (1.5.0_06-b05) and get exactly the same error

Ulfjack told me to fix some path's but had to go soon. :(

So far i got this fixes in the makefile:

line 7: change the first path (/usr/X11R6/lib64) to the right location of libXxf86vm.a
(under gentoo linux this is /usr/lib64)

line 6: change the shared flag into static
(does this work? or will the resulting lib be useless?)

after applying this fixes i get this error message:
/usr/lib/gcc/x86_64-pc-linux-gnu/3.4.5/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -ljawt

libjawt.so can be found here:
/opt/sun-jdk-1.5.0.06/jre/lib/amd64/libjawt.so

and the makefile contains:
-L$(JAVA_HOME)/jre/lib/amd64

so i don't have a clue why it isn't working :(

any help anyone?
Title: Problems building lwjgl on linux x86_64
Post by: Matzon on May 25, 2006, 07:35:23
is JAVA_HOME defined?
Title: Problems building lwjgl on linux x86_64
Post by: Golly on May 25, 2006, 17:09:07
i knew someone would ask that ... but i forgot to mention: yes JAVA_HOME is correctly set
Title: Problems building lwjgl on linux x86_64
Post by: prinz on June 02, 2006, 04:46:14
I did end up getting things to work.   I basically removed the -static and use shared libraries for all libs.

[santacruz:linux] diff Makefile.amd64 Makefile.x86_64
7c7
< LIBS=-L/usr/X11R6/lib64 -L/usr/X11/lib -lm -lX11 -lXext -lpthread -L$(JAVA_HOME)/jre/lib/amd64 -ljawt -Wl,-static,-lXxf86vm,-lXcursor,-lXrender,-lXrandr,-call_shared
---
> LIBS=-L/usr/X11R6/lib64 -L/usr/X11/lib -lm -lX11 -lXext -lpthread -L$(JAVA_HOME)/jre/lib/amd64 -ljawt -Wl,-lXxf86vm,-lXcursor,-lXrender,-lXrandr,-call_shared

I also found a few other things.  I was initially using the 64bit 1.6 JDK which seems to have stability issues in some cases.  I elimininated lots of problems switching to 1.5.

Another significant issue was that I had to regenerate the jni headers and java bindings.  I basically did something like run down the targets reported by ant -p.

If there was documentation about how to build I couldn't find it.  It would really help if the build procedure were better documented.  It would make all the fine work done on this project more accessible IMHO

Things now work but I have problems with display modes being reported which is probably because I need to better configure my X server.  I have two displays connected to an NVidia 7800 running in TwinView mode and the only mode seems to be 2560x1024.
Title: Confirmation
Post by: MadCoder on June 25, 2006, 19:42:06
I confirm that doing the above changes to the makefile, makes it compile for gentoo on amd64