jazz2-native icon indicating copy to clipboard operation
jazz2-native copied to clipboard

Compile failure, possibly glibc related.

Open FrostKnight opened this issue 10 months ago • 23 comments

Jazz² Resurrection version

2.6.1

System information

Linux Hyperbola 0.4.4 Intel® HD Graphics 4000

Issue description

After the make part, it fails at 100% like the below:

/usr/bin/ld: _deps/ncine_libraries-src/Linux/x86_64/libopenmpt.so: undefined reference to std::__throw_bad_array_new_length()@GLIBCXX_3.4.29' /usr/bin/ld: _deps/ncine_libraries-src/Linux/x86_64/libopenmpt.so: undefined reference to __libc_single_threaded@GLIBC_2.32' /usr/bin/ld: _deps/ncine_libraries-src/Linux/x86_64/libopenmpt.so: undefined reference to std::to_chars(char*, char*, double)@GLIBCXX_3.4.29' /usr/bin/ld: _deps/ncine_libraries-src/Linux/x86_64/libopenmpt.so: undefined reference to std::__glibcxx_assert_fail(char const*, int, char const*, char const*)@GLIBCXX_3.4.30' collect2: error: ld returned 1 exit status make[2]: *** [CMakeFiles/jazz2.dir/build.make:4688: jazz2] Error 1 make[1]: *** [CMakeFiles/Makefile2:100: CMakeFiles/jazz2.dir/all] Error 2 make: *** [Makefile:156: all] Error 2

Steps to reproduce

attempted compiling after,

mkdir build in the main folder, cd build, cmake .. CMAKE_SYSTEM_PREFIX_PATH=/usr

then make

at 100% it fails for some reason. No idea why. Maybe glibc related? Sorry, would build from earlier release probably but you have no archives.

I will say, I look forward to online mode.

FrostKnight avatar Apr 15 '24 22:04 FrostKnight

The game automatically uses bundled library version if the library (package) is not installed in OS. Because Linux (unlike Windows) is so scattered, the bundled libraries can be sometimes incompatible with OS and other libraries.

You have to install system package for libopenmpt library (or somehow get a compatible version of it for your OS).

deathkiller avatar Apr 16 '24 07:04 deathkiller

The game automatically uses bundled library version if the library (package) is not installed in OS. Because Linux (unlike Windows) is so scattered, the bundled libraries can be sometimes incompatible with OS and other libraries.

You have to install system package for libopenmpt library (or somehow get a compatible version of it for your OS).

odd thing is, even after installing that it still is failing. Perhaps my version is too old?

I wonder what libopenmpt version I need.

FrostKnight avatar Apr 16 '24 17:04 FrostKnight

libopenmpt version usually doesn't matter, because the game uses only old API which is in any version. Check CMake log, you should see which libopenmpt library was used for build.

deathkiller avatar Apr 16 '24 17:04 deathkiller

libopenmpt version usually doesn't matter, because the game uses only old API which is in any version. Check CMake log, you should see which libopenmpt library was used for build. That is mine I mean.

Ahh okay. Well its version 0.5.12 supposedly of libopenmpt

CMAKE version is 3.15 if that helps.

More info from log:

Performing C SOURCE FILE Test CMAKE_HAVE_LIBC_PTHREAD failed with the following output: Change Dir: /home/luser/jazz2-native/build/CMakeFiles/CMakeScratch/TryCompile-fccvUF

Run Build Command(s):/usr/bin/make -f Makefile cmTC_d654f/fast && /usr/bin/make -f CMakeFiles/cmTC_d654f.dir/build.make CMakeFiles/cmTC_d654f.dir/build make[1]: Entering directory '/home/user/jazz2-native/build/CMakeFiles/CMakeScratch/TryCompile-fccvUF' Building C object CMakeFiles/cmTC_d654f.dir/src.c.o /usr/bin/cc -DCMAKE_HAVE_LIBC_PTHREAD -o CMakeFiles/cmTC_d654f.dir/src.c.o -c /home/luser/jazz2-native/build/CMakeFiles/CMakeScratch/TryCompile-fccvUF/src.c Linking C executable cmTC_d654f /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_d654f.dir/link.txt --verbose=1 /usr/bin/cc CMakeFiles/cmTC_d654f.dir/src.c.o -o cmTC_d654f /usr/bin/ld: CMakeFiles/cmTC_d654f.dir/src.c.o: in function main': src.c:(.text+0x2d): undefined reference to pthread_create' /usr/bin/ld: src.c:(.text+0x39): undefined reference to pthread_detach' /usr/bin/ld: src.c:(.text+0x45): undefined reference to pthread_cancel' /usr/bin/ld: src.c:(.text+0x56): undefined reference to `pthread_join' collect2: error: ld returned 1 exit status make[1]: *** [CMakeFiles/cmTC_d654f.dir/build.make:99: cmTC_d654f] Error 1 make[1]: Leaving directory '/home/user/jazz2-native/build/CMakeFiles/CMakeScratch/TryCompile-fccvUF' make: *** [Makefile:127: cmTC_d654f/fast] Error 2

Source file was: #include <pthread.h>

static void* test_func(void* data) { return data; }

int main(void) { pthread_t thread; pthread_create(&thread, NULL, test_func, NULL); pthread_detach(thread); pthread_cancel(thread); pthread_join(thread, NULL); pthread_atfork(NULL, NULL, NULL); pthread_exit(NULL);

return 0; }

Determining if the function pthread_create exists in the pthreads failed with the following output: Change Dir: /home/user/jazz2-native/build/CMakeFiles/CMakeScratch/TryCompile-n91S3E

Run Build Command(s):/usr/bin/make -f Makefile cmTC_07661/fast && /usr/bin/make -f CMakeFiles/cmTC_07661.dir/build.make CMakeFiles/cmTC_07661.dir/build make[1]: Entering directory '/home/user/jazz2-native/build/CMakeFiles/CMakeScratch/TryCompile-n91S3E' Building C object CMakeFiles/cmTC_07661.dir/CheckFunctionExists.c.o /usr/bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create -o CMakeFiles/cmTC_07661.dir/CheckFunctionExists.c.o -c /home/user/jazz2-native/build/CMakeFiles/CMakeScratch/TryCompile-n91S3E/CheckFunctionExists.c Linking C executable cmTC_07661 /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_07661.dir/link.txt --verbose=1 /usr/bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create CMakeFiles/cmTC_07661.dir/CheckFunctionExists.c.o -o cmTC_07661 -lpthreads /usr/bin/ld: cannot find -lpthreads collect2: error: ld returned 1 exit status make[1]: *** [CMakeFiles/cmTC_07661.dir/build.make:99: cmTC_07661] Error 1 make[1]: Leaving directory '/home/user/jazz2-native/build/CMakeFiles/CMakeScratch/TryCompile-n91S3E' make: *** [Makefile:127: cmTC_07661/fast] Error 2

FrostKnight avatar Apr 16 '24 17:04 FrostKnight

CMakeError.log

FrostKnight avatar Apr 16 '24 17:04 FrostKnight

I meant the CMake output usually written to terminal, it should look like this:

-- The CXX compiler identification is GNU 11.4.0
-- The C compiler identification is GNU 11.4.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Compiling for architecture: x86_64
-- Content directory: /home/runner/work/jazz2-native/jazz2-native/Content
-- Found Git: /usr/bin/git (found version "2.43.2")
-- Game version: 2.6.r663-c69758b
-- Downloading dependencies from "https://github.com/deathkiller/jazz2-libraries/archive/2.6.1.tar.gz"...
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11")
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so
-- Found GLFW: /home/runner/work/jazz2-native/jazz2-native/_build/_deps/ncine_libraries-src/Linux/x86_64/libglfw.so
-- Found SDL2: /home/runner/work/jazz2-native/jazz2-native/_build/_deps/ncine_libraries-src/Linux/x86_64/libSDL2main.a;/home/runner/work/jazz2-native/jazz2-native/_build/_deps/ncine_libraries-src/Linux/x86_64/libSDL2.so
-- Found OpenAL: /home/runner/work/jazz2-native/jazz2-native/_build/_deps/ncine_libraries-src/Linux/x86_64/libopenal.so
-- Found Vorbis: /usr/lib/x86_64-linux-gnu/libogg.so
-- Found libopenmpt: /usr/lib/x86_64-linux-gnu/libopenmpt.so
-- Using GLFW as the preferred backend
-- Using GNU IFUNC for CPU-dependent functionality

And Found libopenmpt should point to your system library. You can also try to delete your build output directory to reset all cached paths.

deathkiller avatar Apr 16 '24 17:04 deathkiller

I meant the CMake output usually written to terminal, it should look like this:

-- The CXX compiler identification is GNU 11.4.0
-- The C compiler identification is GNU 11.4.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Compiling for architecture: x86_64
-- Content directory: /home/runner/work/jazz2-native/jazz2-native/Content
-- Found Git: /usr/bin/git (found version "2.43.2")
-- Game version: 2.6.r663-c69758b
-- Downloading dependencies from "https://github.com/deathkiller/jazz2-libraries/archive/2.6.1.tar.gz"...
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11")
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so
-- Found GLFW: /home/runner/work/jazz2-native/jazz2-native/_build/_deps/ncine_libraries-src/Linux/x86_64/libglfw.so
-- Found SDL2: /home/runner/work/jazz2-native/jazz2-native/_build/_deps/ncine_libraries-src/Linux/x86_64/libSDL2main.a;/home/runner/work/jazz2-native/jazz2-native/_build/_deps/ncine_libraries-src/Linux/x86_64/libSDL2.so
-- Found OpenAL: /home/runner/work/jazz2-native/jazz2-native/_build/_deps/ncine_libraries-src/Linux/x86_64/libopenal.so
-- Found Vorbis: /usr/lib/x86_64-linux-gnu/libogg.so
-- Found libopenmpt: /usr/lib/x86_64-linux-gnu/libopenmpt.so
-- Using GLFW as the preferred backend
-- Using GNU IFUNC for CPU-dependent functionality

And Found libopenmpt should point to your system library. You can also try to delete your build output directory to reset all cached paths.

I'll rebuild it just to be safe. Maybe doing cmake again will fix it if I do ir from scratch.

FrostKnight avatar Apr 16 '24 17:04 FrostKnight

output.txt You mean like that?

FrostKnight avatar Apr 16 '24 17:04 FrostKnight

No, this is build output, but CMake has another output. You should see the same as I shown you 2 messages above.

deathkiller avatar Apr 16 '24 18:04 deathkiller

No, this is build output, but CMake has another output. You should see the same as I shown you 2 messages above.

Oh sorry, I am a bit confused which file? OH... I get it now my bad.

FrostKnight avatar Apr 16 '24 18:04 FrostKnight

cmakeerror.txt You mean this? If not, tell me specifically.

Or possibly this?

-- Compiling for architecture: x86_64 -- Content directory: /home/auser/jazz2-native/Content -- Specified custom GIT path: /usr/bin/git -- Game version: 2.6.r663-c69758b -- Downloading dependencies from "https://github.com/deathkiller/jazz2-libraries/archive/2.6.1.tar.gz"... -- Could NOT find libdwarf (missing: LIBDWARF_LIBRARY LIBDWARF_INCLUDE_DIR) -- Using GLFW as the preferred backend -- Using GNU IFUNC for CPU-dependent functionality -- Runtime event tracing is enabled -- Exporting shader files to C strings -- Configuring done -- Generating done -- Build files have been written to: /home/auser/jazz2-native/build

FrostKnight avatar Apr 16 '24 18:04 FrostKnight

Yes, the last one, but it's too short. Try to delete everything, redownload it and rerun it, so everything is recreated.

deathkiller avatar Apr 16 '24 18:04 deathkiller

-- The CXX compiler identification is GNU 8.4.0 -- The C compiler identification is GNU 8.4.0 -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Compiling for architecture: x86_64 -- Content directory: /home/someuser/jazz2-native/Content -- Found Git: /usr/bin/git (found version "2.28.0") -- Game version: 2.6.r663-c69758b -- Downloading dependencies from "https://github.com/deathkiller/jazz2-libraries/archive/2.6.1.tar.gz"... -- Found libdw: /usr/lib/libdw.so
-- Found libbfd: /usr/lib/libbfd.so
-- Could NOT find libdwarf (missing: LIBDWARF_LIBRARY LIBDWARF_INCLUDE_DIR) -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed -- Looking for pthread_create in pthreads -- Looking for pthread_create in pthreads - not found -- Looking for pthread_create in pthread -- Looking for pthread_create in pthread - found -- Found Threads: TRUE
-- Found ZLIB: /usr/lib/libz.so (found version "1.2.11") -- Found GLEW: /usr/lib/libGLEW.so (found version "2.1.0") -- Found OpenGL: /usr/lib/libGL.so
-- Found GLFW: /usr/lib/libglfw.so
-- Found SDL2: /usr/lib/libSDL2main.a;/usr/lib/libSDL2.so;-lpthread
-- Found OpenAL: /usr/lib/libopenal.so
-- Found Vorbis: /usr/lib/libogg.so
-- Found libopenmpt: /usr/lib/libopenmpt.so
-- Using GLFW as the preferred backend -- Using GNU IFUNC for CPU-dependent functionality -- Runtime event tracing is enabled -- Exporting shader files to C strings -- Configuring done -- Generating done -- Build files have been written to: /home/someuser/jazz2-native/build

FrostKnight avatar Apr 16 '24 18:04 FrostKnight

It looks fine. It doesn't build now?

deathkiller avatar Apr 16 '24 18:04 deathkiller

It looks fine. It doesn't build now?

Yeah... I dunno why.

FrostKnight avatar Apr 16 '24 19:04 FrostKnight

I have the dependencies here: https://aur.archlinux.org/packaes/jazz2-bin

Also, but I wondered if there are any hidden ones I am unaware of

EDIT: No it was 2.1 the last version I used.

I wonder... maybe I should try building from older snapshots see what the newest one that works is.

Btw, I think I remember how to backtrack to a specific commit, but I am not sure if I remember. just a heads up.

FrostKnight avatar Apr 16 '24 19:04 FrostKnight

EDIT again, this is a mystery to me, I don't know what I did.

I thought I backtracked it to 2.6, but when I look closer, I had tried to push it back to 2.5 with a98af96

But when I look closer, it says r663*c697586 when I boot jazz2 up and the menu appears.

FrostKnight avatar Apr 16 '24 20:04 FrostKnight

I did so many changes between 2.5.0 and master, so it's hard to tell what's different and why it doesn't work for you now. Probably the only way is to find last working commit.

deathkiller avatar Apr 17 '24 09:04 deathkiller

Added NCINE_COMPILE_OPENMPT CMake option to compile libopenmpt from sources instead of using library. It's not tested, but can help with this issue.

deathkiller avatar Apr 22 '24 08:04 deathkiller

I am erasing what I originally wrote, because I realize that my error is a prefix one.

I think that is what keeps getting in my way.

I want to be able to change prefix to /usr

but when I try using cmake commands it very obnoxiously ignores it mostly.

Not sure why, but anywho, you have done fine.

FrostKnight avatar Apr 24 '24 01:04 FrostKnight

Why do you want to changed the prefix?

You should be able to configure and build it like this:

cmake -B output_dir -D CMAKE_BUILD_TYPE=Release -D NCINE_WITH_GLEW=OFF -D NCINE_COMPILE_OPENMPT=OFF
make -C output_dir

deathkiller avatar Apr 24 '24 07:04 deathkiller

I change the prefix more because that's usually how I do it in Hyperbola.

/usr is where stuff goes not /ust/local

That's how I have been doing it more than anything.

So you are saying I need to do this in cmake and make for it to work though? Is this correct?

FrostKnight avatar Apr 24 '24 22:04 FrostKnight

Yeah, I don't know anything about Hyperbola, but the game builds just fine in Fedora and Ubuntu.

deathkiller avatar Apr 25 '24 16:04 deathkiller

Closing due to inactivity. Feel free to re-open if needed.

deathkiller avatar May 28 '24 21:05 deathkiller