Horde3D
http://horde3d.org/forums/

Issues compiling on Linux
http://horde3d.org/forums/viewtopic.php?f=2&t=1693
Page 1 of 1

Author:  kirilz [ 23.07.2012, 04:53 ]
Post subject:  Issues compiling on Linux

This issue might not be Linux specific, but I tagged it as such just in case.

I checked out the trunk from the community repository. I followed the instructions on the wiki and created a "make" directory in "trunk/" . Once in there, I ran the
Code:
$ cmake ..

and
Code:
$ make

commands to start the build. At around 80% I run into the following fatal error:
Code:
[ 83%] Building CXX object Horde3D/Source/Horde3DEngine/CMakeFiles/Horde3D.dir/utOpenGL.cpp.o
Linking CXX shared library libHorde3D.so
/usr/bin/ld: ../../../Extensions/Sound/Source/libHorde3DSound.a(sound_extension.cpp.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
../../../Extensions/Sound/Source/libHorde3DSound.a: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
make[2]: *** [Horde3D/Source/Horde3DEngine/libHorde3D.so] Error 1
make[1]: *** [Horde3D/Source/Horde3DEngine/CMakeFiles/Horde3D.dir/all] Error 2
make: *** [all] Error 2


Here is a pastebin of the full build output:
http://pastebin.com/uf1xUsxv

My system is ArchLinux 64.
I'm not really sure what is going on here. I tried building from the sourceforge SVN, same deal.
Thanks in advance!

Author:  shd [ 23.07.2012, 18:16 ]
Post subject:  Re: Issues compiling on Linux

kirilz wrote:
...
Linking CXX shared library libHorde3D.so
/usr/bin/ld: ../../../Extensions/Sound/Source/libHorde3DSound.a(sound_extension.cpp.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
...
[/code]
...

Hello,

To link on x64 you need to compile static libs with -fPIC flag.
cd $Horde3D
cmake .. -DCMAKE_CXX_FLAGS=-fPIC -DCMAKE_C_FLAGS=-fPIC # or cmake-gui .. and change appropriate variables
make clean && make

Author:  kirilz [ 23.07.2012, 20:04 ]
Post subject:  Re: Issues compiling on Linux

Thanks for the reply, I managed to build without problem.

The only thing that I had to do besides the -fPIC flag was to add -lX11 as well.

Thanks again, I'll be off to trying the tutorials.

Author:  kirilz [ 24.07.2012, 03:35 ]
Post subject:  Re: Issues compiling on Linux

Hm seems like my celebration was premature. I tried running the tutorial program, but I am getting Segmentation Fault when I call the h3dInit function.
First I tried using the Python wrapper (I updated it to match the current community revision's api, but since the wrapper is extremely simple it can't be the source of the problem itself). For good measure, I tried the tutorial in C++ but still the same. I have initialized a GL surface (pyglet with the python wrapper, SDL when with C++) and the C++ program is linked in the correct order. My only guess is that something during the linking of the engine has gone terribly wrong. Here is a detailed log of my compilation process

I have a folder called 'Builds' in Horde3D/trunk

cmake is called with the CMAKE_CXX_FLAGS and the CMAKE_C_FLAGS both set to -fPIC -lX11. If I don't have -fPIC, the error from the first post occurs. If I don't have the -lX11 flag the following error occurs:
Code:
Linking CXX executable ../../../../Horde3D/Binaries/Linux/Sound
/usr/bin/ld: ../../../Horde3D/Samples/glfw/libglfw.a(x11_window.c.o): undefined reference to symbol 'XPending'
/usr/bin/ld: note: 'XPending' is defined in DSO /usr/lib/libX11.so.6 so try adding it to the linker command line
/usr/lib/libX11.so.6: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status
make[2]: *** [../Horde3D/Binaries/Linux/Sound] Error 1
make[1]: *** [Extensions/Sound/Sample/CMakeFiles/Sound.dir/all] Error 2
make: *** [all] Error 2

Which leads me to believe that I should'nt be using the -lX11 flag but something else instead.

I managed to build the engine with just the -fPIC flag by disabling the compilation for Sound and Terrain. It segfaults again.
I managed to build the engine without the -fPIC flag by disabling the compilation for Sound and Terrain, but it still segfaults.

What could be going wrong here?


P.S. Sorry if I am a pest; I am not very experienced in compiling and linking large projects.

Author:  shd [ 24.07.2012, 11:17 ]
Post subject:  Re: Issues compiling on Linux

kirilz wrote:
Hm seems like my celebration was premature. I tried running the tutorial program, but I am getting Segmentation Fault when I call the h3dInit function

...

I'm not that experienced too, but i believe you're linking and compiling correctly (-fPIC and -lX11 should be set by CMake).

IMO you should look for the problem somewhere else, and i'd recommend you to start with compiling and running stock Horde3D demos.
After that progress to make your own code.

As you probably know, h3dInit might SEGFAULT when you'll forget to initialize OpenGL context before, so make sure you're doing it.
I have no other ideas, sorry. Maybe someone else will help You.

Author:  kirilz [ 24.07.2012, 13:50 ]
Post subject:  Re: Issues compiling on Linux

The OpenGL context is initialized before the call to h3dInit, I made sure of that after I googled on the problem.
I think the stock examples were compiled when the engine was compiled. In any case everything in /trunk/Horde3D/Binaries/Linux runs fine (at 60 fps). I haven't tried any of the samples in /trunk/Horde3D/Samples yet, but I think I will go and try the C# sample. The Python ones segfault even after I fixed the wrapper (and the GL context there is initialized via pyglet, the window actually manages to pop up for a second before the crash).

P.S. My graphics card is an old ATI Mobility Radeon 3450 HD, but it does cover the minimum requirements.

Author:  tshannon [ 24.07.2012, 17:05 ]
Post subject:  Re: Issues compiling on Linux

kirilz wrote:
P.S. My graphics card is an old ATI Mobility Radeon 3450 HD, but it does cover the minimum requirements.


You should confirm the compatibilty level of your card with whatever linux driver you are using. Just because your card supports opengl 2.0 doesn't mean the linux driver for your card does.

I know driver support for mobile graphics is especially touchy.

For instance, I can't run horde on my laptop running linux, but if I boot into my Windows partition I can. If you have a windows partition, I'd give it a try.

Author:  shd [ 24.07.2012, 20:41 ]
Post subject:  Re: Issues compiling on Linux

kirilz wrote:
In any case everything in /trunk/Horde3D/Binaries/Linux runs fine (at 60 fps).

The Python ones segfault even after I fixed the wrapper (and the GL context there is initialized via pyglet, the window actually manages to pop up for a second before the crash).


So, if C++ version works fine, it looks like you got a problem with bindings.
I'm running Horde3D via SWIG, and i had no problems in this way yet.

Author:  tshannon [ 24.07.2012, 21:36 ]
Post subject:  Re: Issues compiling on Linux

tshannon wrote:
kirilz wrote:
P.S. My graphics card is an old ATI Mobility Radeon 3450 HD, but it does cover the minimum requirements.


You should confirm the compatibilty level of your card with whatever linux driver you are using. Just because your card supports opengl 2.0 doesn't mean the linux driver for your card does.

I know driver support for mobile graphics is especially touchy.

For instance, I can't run horde on my laptop running linux, but if I boot into my Windows partition I can. If you have a windows partition, I'd give it a try.



Nevermind this. I misread the post.

Author:  kirilz [ 25.07.2012, 20:22 ]
Post subject:  Re: Issues compiling on Linux

First of all, thanks for all the replies.
I have narrowed the problem down to the h3dutLoadResourcesFromDisk. I tried to code the C++ tutorial (with the properly compiled engine now), and while I manange to get a GL screen it remains black. Upon further examination the function (h3dutLoadResourcesFromDisk) returns false, which means it can't load something. My best guess is that the load path is messed up, since it can't load any of the resources(pipe, model or anim files); it basically returns true only if there is nothing to load.
For path I tried passing the following values: empty string and absolute path to a folder with the files. For good measure I copied the resource files in what I thought was the likely default search path (as in, where the binary is located).

Also, with this new information I checked the wrapper again and it segfaults when the same function is called; it does not even return false. So that seems to be the culprit.

Author:  kirilz [ 28.07.2012, 05:34 ]
Post subject:  Re: Issues compiling on Linux

Just a quick update on the situation, I just started rewriting the wrapper in Cython and so far I managed to rewrite one of the examples given with the old wrapper and it works. Hopefully in the end it will all work properly.

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/