Re: Changing Oolite...
Posted: Thu Jan 27, 2022 2:19 pm
Yes, that's what we are supposed to do, which is why you need to build against version 1.20 and not version 1.25. Your dev environment must match what we are distributing.
For information and discussion about Oolite.
https://bb.oolite.space/
Yes, that's what we are supposed to do, which is why you need to build against version 1.20 and not version 1.25. Your dev environment must match what we are distributing.
So we need to either change the makefile (I am even better talking french) or at least find out how to call make so the compiler gets the right information. From LD_LIBRARY_PATH – or: How to get yourself into trouble! I see we need to look at compiler options -L and -rpath:another_commander wrote: ↑Thu Jan 27, 2022 2:19 pmYes, that's what we are supposed to do, which is why you need to build against version 1.20 and not version 1.25. Your dev environment must match what we are distributing.
Code: Select all
cc -o myprog obj1.o ... objn.o -Wl,-rpath=/path/to/lib \
-L/path/to/lib -lmylib
We agree on the concept. But how to do it in practice?another_commander wrote: ↑Fri Jan 28, 2022 6:39 amI don't think it needs to be so overcomplicated. You only need to build against the versions of the .so files that we distribute with the installer.
Code: Select all
vagrant@OoliteBuilder:~/oolite/deps/Linux-deps/x86_64/lib_linker$ ls -l
total 4
lrwxrwxrwx 1 root root 22 Jan 28 07:35 libSDL.so -> ../lib/libSDL-1.2.so.0
lrwxrwxrwx 1 root root 21 Jan 28 07:35 libespeak.so -> ../lib/libespeak.so.1
lrwxrwxrwx 1 root root 18 Jan 28 07:35 libogg.so -> ../lib/libogg.so.0
lrwxrwxrwx 1 root root 21 Jan 28 07:35 libopenal.so -> ../lib/libopenal.so.1
lrwxrwxrwx 1 root root 21 Jan 28 07:35 libpng.so -> ../lib/libpng14.so.14
lrwxrwxrwx 1 root root 21 Jan 28 07:35 libvorbis.so -> ../lib/libvorbis.so.0
lrwxrwxrwx 1 root root 25 Jan 28 07:35 libvorbisfile.so -> ../lib/libvorbisfile.so.3
lrwxrwxrwx 1 root root 16 Jan 28 07:35 libz.so -> ../lib/libz.so.1
-rwxr-xr-x 1 vagrant vagrant 695 Jan 28 07:35 make_so_links.sh
vagrant@OoliteBuilder:~/oolite/deps/Linux-deps/x86_64/lib_linker$
For this one, execute tha make command usinghiran wrote:However I cannot see the commands invoking the compiler or the linker in the build output
messages=yes
. This will generate verbose output.
Code: Select all
make -fMakefile pkg-posix-snapshot messages=yes
I believe the assumption 'it worked for years therefore something is wrong on your side' is wrong. Times have changed, and I cannot setup the build system as it had been without good instructions how to do it.another_commander wrote: ↑Fri Jan 28, 2022 8:26 amI don't think there is anything missing. We have been generating releases with those makefiles and scripts for ages, so it's most likely something on your side. Also, GNUstep is a quite complex system and if I am not mistaken, the paths to the libraries linking against are set when its startup scripts execute. So when we link using -lgnustep-base, it is expected that the folders to go and look for the import libraries for linking are known. Maybe that is why there is no specific action involving gnustep-base inside the make_so_links script.
If you have installed and build using gnustep-base 1.25 but we package the 1.20 shared library, then obviously this will not produce a working executable. So the very first step should be to ensure that you build with the expected dependencies.
Package does not exist (any more):another_commander wrote: ↑Fri Jan 28, 2022 8:26 amProposed solution: apt-get-install gnustep-base 1.20 and attempt a project rebuild.
Code: Select all
gcc -rdynamic -shared-libgcc -pthread -fexceptions -fgnu-runtime -o [color=#BF4040]<long list of object files>[/color] -L/home/runner/GNUstep/Library/Libraries -L/usr/local/lib -L/usr/lib -Ldeps/Linux-deps/x86_64/lib_linker -lGLU -lGL -lX11 -lSDL -lgnustep-base -Ldeps/Linux-deps/x86_64/mozilla -ljs_static -lopenal -lz -lvorbisfile -lpng `nspr-config --libs` -lstdc++ -lespeak -lobjc -lm
Code: Select all
-L/home/runner/GNUstep/Library/Libraries
-L/usr/local/lib
-L/usr/lib
-Ldeps/Linux-deps/x86_64/lib_linker
-Ldeps/Linux-deps/x86_64/mozilla
Been there, done that. I had created a script to iterate over oolite and everything in an empty lib directory. Whatever ldd found to be missing the script would automatically copy in, and the next iteration would start.another_commander wrote: ↑Fri Jan 28, 2022 1:26 pmAnother idea: What if you distribute gnustep-base.so version 1.25 or whichever version it is you are building it with instead of 1.20? This would maybe cause the Windows and Linux builds to deviate (they are currently using the same gnustep version), but if the alternative is to not be able to build, it may be something worth considering.
It seems like making one library accessible via /usr/local/lib helped as much as the linker reacted. However that lib has dependencies that could not be satisfied and the linker failed. I will next copy all libs to that directory.hiran wrote: ↑Fri Jan 28, 2022 12:49 pmSo what I obtained now building with messages=yes is this call (which I believe to be the linker step:From that I take it as the path the linker is searching for libraries looks likeCode: Select all
gcc -rdynamic -shared-libgcc -pthread -fexceptions -fgnu-runtime -o [color=#BF4040]<long list of object files>[/color] -L/home/runner/GNUstep/Library/Libraries -L/usr/local/lib -L/usr/lib -Ldeps/Linux-deps/x86_64/lib_linker -lGLU -lGL -lX11 -lSDL -lgnustep-base -Ldeps/Linux-deps/x86_64/mozilla -ljs_static -lopenal -lz -lvorbisfile -lpng `nspr-config --libs` -lstdc++ -lespeak -lobjc -lm
Already in /usr/lib - the second location - I can find libgnustep-base.so pointing to 1.26 on Debian 10.11. Something which would explain why the library is not even searched in the thirs location.Code: Select all
-L/home/runner/GNUstep/Library/Libraries -L/usr/local/lib -L/usr/lib -Ldeps/Linux-deps/x86_64/lib_linker -Ldeps/Linux-deps/x86_64/mozilla
I will next create symlinks into /usr/local/lib.
Code: Select all
$ LD_LIBRARY_PATH=oolite.app/lib ldd oolite.app/oolite
linux-vdso.so.1 (0x00007ffe4e36c000)
libGLU.so.1 => /lib/x86_64-linux-gnu/libGLU.so.1 (0x00007f0331f13000)
libGL.so.1 => /lib/x86_64-linux-gnu/libGL.so.1 (0x00007f0331e8b000)
libX11.so.6 => /lib/x86_64-linux-gnu/libX11.so.6 (0x00007f0331d4e000)
libSDL-1.2.so.0 => oolite.app/lib/libSDL-1.2.so.0 (0x00007f0331ab3000)
libgnustep-base.so.1.20 => oolite.app/lib/libgnustep-base.so.1.20 (0x00007f03313e0000)
libopenal.so.1 => oolite.app/lib/libopenal.so.1 (0x00007f033118e000)
libz.so.1 => oolite.app/lib/libz.so.1 (0x00007f0330f76000)
libvorbisfile.so.3 => oolite.app/lib/libvorbisfile.so.3 (0x00007f0330d6e000)
libpng14.so.14 => oolite.app/lib/libpng14.so.14 (0x00007f0330b4a000)
libplds4.so.0d => oolite.app/lib/libplds4.so.0d (0x00007f0330947000)
libplc4.so.0d => oolite.app/lib/libplc4.so.0d (0x00007f0330743000)
libnspr4.so.0d => oolite.app/lib/libnspr4.so.0d (0x00007f0330506000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f03304e3000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f03304dd000)
libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f03302fb000)
libespeak.so.1 => oolite.app/lib/libespeak.so.1 (0x00007f0330092000)
libobjc.so.2 => oolite.app/lib/libobjc.so.2 (0x00007f032fe75000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f032fd24000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f032fd09000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f032fb17000)
libGLdispatch.so.0 => /lib/x86_64-linux-gnu/libGLdispatch.so.0 (0x00007f032fa5f000)
libGLX.so.0 => /lib/x86_64-linux-gnu/libGLX.so.0 (0x00007f032fa2b000)
libxcb.so.1 => /lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f032fa01000)
libgmp.so.10 => oolite.app/lib/libgmp.so.10 (0x00007f032f787000)
libgnutls.so.30 => oolite.app/lib/libgnutls.so.30 (0x00007f032f45f000)
libgcrypt.so.20 => oolite.app/lib/libgcrypt.so.20 (0x00007f032f195000)
libxml2.so.2 => /lib/x86_64-linux-gnu/libxml2.so.2 (0x00007f032efdb000)
libffi.so.4 => oolite.app/lib/libffi.so.4 (0x00007f032edd3000)
libnsl.so.1 => oolite.app/lib/libnsl.so.1 (0x00007f032ebb8000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f032ebad000)
libvorbis.so.0 => oolite.app/lib/libvorbis.so.0 (0x00007f032e982000)
libogg.so.0 => oolite.app/lib/libogg.so.0 (0x00007f032e77c000)
/lib64/ld-linux-x86-64.so.2 (0x00007f0332a91000)
libportaudio.so.2 => oolite.app/lib/libportaudio.so.2 (0x00007f032e556000)
libXau.so.6 => /lib/x86_64-linux-gnu/libXau.so.6 (0x00007f032e54e000)
libXdmcp.so.6 => /lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007f032e546000)
libnettle.so.6 => oolite.app/lib/libnettle.so.6 (0x00007f032e310000)
libhogweed.so.4 => oolite.app/lib/libhogweed.so.4 (0x00007f032e0dc000)
libgpg-error.so.0 => oolite.app/lib/libgpg-error.so.0 (0x00007f032deca000)
libicuuc.so.66 => /lib/x86_64-linux-gnu/libicuuc.so.66 (0x00007f032dce2000)
liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007f032dcb9000)
libasound.so.2 => /lib/x86_64-linux-gnu/libasound.so.2 (0x00007f032dbbe000)
libbsd.so.0 => /lib/x86_64-linux-gnu/libbsd.so.0 (0x00007f032dba4000)
libicudata.so.66 => /lib/x86_64-linux-gnu/libicudata.so.66 (0x00007f032c0e3000)
$
Code: Select all
$ ./oolite
+ ESPEAK_DATA_PATH=oolite.app/Resources
+ LD_LIBRARY_PATH=oolite.app/lib
+ oolite.app/oolite
./oolite: line 2: 419986 Aborted (core dumped) ESPEAK_DATA_PATH=oolite.app/Resources LD_LIBRARY_PATH=oolite.app/lib oolite.app/oolite
$
I am neither aware that the GNUStep header files were provided in the project nor that the headers for v1.20 were on the system at all. So it is likely that during compile headers for 1.25 (or whatever is around) are used, and at link time we then take the 1.20 version.another_commander wrote: ↑Fri Jan 28, 2022 11:04 pmYou are linking with gnustep-base 1.20, but what about the gnustep headers in use? Are the headers still those from 1.25? The APIs between the two versions may differ and this could be a potential explanation for the core dump. If any gnustep headers are included, it would be good to check and ensure that they are the 1.20 ones. One thing you can try is run gdb on the oolite executable and get a backtrace when it crashes. If the crash happens on a gnustep call, the above could be the cause.
Indeed we don't provide the 1.20 headers. These are installed when you install gnustep in your build environment. In case it helps, here is a link to the source code of the gnustep-base distibution Oolite is based on: http://ftp.gnustep.org/pub/gnustep/core ... 0.1.tar.gzhiran wrote: ↑Sat Jan 29, 2022 1:08 pmI am neither aware that the GNUStep header files were provided in the project nor that the headers for v1.20 were on the system at all. So it is likely that during compile headers for 1.25 (or whatever is around) are used, and at link time we then take the 1.20 version.
Getting a backtrace from gdb should be a matter of:How exactly would I apply gdb to find that out?
gdb oolite
run
as soon as the gdb prompt appears.bt
as soon as gdb has reported the crash.q
to quit gdb and return to the shell.Regrettably, I do not have Vagrant and Virtualbox and setting up a build environment for Linux is something that demands much nmore time than I have available to dedicate. The easy role of backseat driver, whenever an opportunity is given, is the best I can hope for these days.I have created a vagrant/virtualbox/ansible setup that performs the whole job locally. If you have Vagrant and Virtualbox installed on your Windows it might work straight out of the box, and you could have the Linux based compilation at your fingertips.