Quake3e icon indicating copy to clipboard operation
Quake3e copied to clipboard

Unable to compile on Arch Linux

Open oitzujoey opened this issue 11 months ago • 8 comments

I am unable to compile on Arch Linux.

log0.txt

% ldd --version
ldd (GNU libc) 2.40

The code preventing it from compiling seems to be this:

code/qcommon/q_shared.h:417

#ifdef __linux__
#ifdef __GLIBC__
#if idx64
// force version for better runtime compatibility
__asm__(".symver logf,logf@GLIBC_2.2.5");
__asm__(".symver powf,powf@GLIBC_2.2.5");
__asm__(".symver expf,expf@GLIBC_2.2.5");
__asm__(".symver memcpy,memcpy@GLIBC_2.2.5");
#endif
#endif
#endif

oitzujoey avatar Dec 22 '24 20:12 oitzujoey

I comment out the code above and I get this:

log1.txt

oitzujoey avatar Dec 22 '24 20:12 oitzujoey

+1 same here. What i've done for now:

alex@alex-MS-7B79:~/build-Quake3e$ cmake ../Quake3e
-- The C compiler identification is GNU 11.4.0
-- The CXX compiler identification is GNU 11.4.0
-- 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
-- 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
-- Found SDL2: /usr/lib/x86_64-linux-gnu/libSDL2.so (found version "2.0.20")
-- Configuring done
-- Generating done
-- Build files have been written to: /home/alex/build-Quake3e

Then

alex@alex-MS-7B79:~/build-Quake3e$ make
...
[ 76%] Building C object CMakeFiles/quake3e_opengl_x86.dir/code/renderer/tr_vbo.c.o
[ 76%] Building C object CMakeFiles/quake3e_opengl_x86.dir/code/renderer/tr_world.c.o
[ 76%] Building C object CMakeFiles/quake3e_opengl_x86.dir/code/renderercommon/tr_font.c.o
[ 77%] Building C object CMakeFiles/quake3e_opengl_x86.dir/code/renderercommon/tr_image_bmp.c.o
[ 77%] Building C object CMakeFiles/quake3e_opengl_x86.dir/code/renderercommon/tr_image_jpg.c.o
[ 78%] Building C object CMakeFiles/quake3e_opengl_x86.dir/code/renderercommon/tr_image_pcx.c.o
[ 78%] Building C object CMakeFiles/quake3e_opengl_x86.dir/code/renderercommon/tr_image_png.c.o
[ 78%] Building C object CMakeFiles/quake3e_opengl_x86.dir/code/renderercommon/tr_image_tga.c.o
[ 79%] Building C object CMakeFiles/quake3e_opengl_x86.dir/code/renderercommon/tr_noise.c.o
[ 79%] Building C object CMakeFiles/quake3e_opengl_x86.dir/code/qcommon/q_shared.c.o
[ 80%] Building C object CMakeFiles/quake3e_opengl_x86.dir/code/qcommon/puff.c.o
[ 80%] Building C object CMakeFiles/quake3e_opengl_x86.dir/code/qcommon/q_math.c.o
[ 80%] Linking C shared library libquake3e_opengl_x86.so
/usr/bin/ld: libquake3e_opengl_x86.so: no symbol version section for versioned symbol 'powf@GLIBC_2.2.5'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/quake3e_opengl_x86.dir/build.make:625: libquake3e_opengl_x86.so] Error 1
make[1]: *** [CMakeFiles/Makefile2:203: CMakeFiles/quake3e_opengl_x86.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

Go to code/qcommon/q_shared.h:417 and erase this entire fragment:

#ifdef __linux__
#ifdef __GLIBC__
#if idx64
// force version for better runtime compatibility
__asm__(".symver logf,logf@GLIBC_2.2.5");
__asm__(".symver powf,powf@GLIBC_2.2.5");
__asm__(".symver expf,expf@GLIBC_2.2.5");
__asm__(".symver memcpy,memcpy@GLIBC_2.2.5");
#endif
#endif
#endif

Then try to make it again

alex@alex-MS-7B79:~/build-Quake3e$ make
...
[ 92%] Building C object CMakeFiles/quake3e_vulkan_x86.dir/code/renderercommon/tr_image_pcx.c.o
[ 92%] Building C object CMakeFiles/quake3e_vulkan_x86.dir/code/renderercommon/tr_image_png.c.o
[ 92%] Building C object CMakeFiles/quake3e_vulkan_x86.dir/code/renderercommon/tr_image_tga.c.o
[ 93%] Building C object CMakeFiles/quake3e_vulkan_x86.dir/code/renderercommon/tr_noise.c.o
[ 93%] Building C object CMakeFiles/quake3e_vulkan_x86.dir/code/qcommon/q_shared.c.o
[ 94%] Building C object CMakeFiles/quake3e_vulkan_x86.dir/code/qcommon/puff.c.o
[ 94%] Building C object CMakeFiles/quake3e_vulkan_x86.dir/code/qcommon/q_math.c.o
[ 95%] Linking C shared library libquake3e_vulkan_x86.so
[ 95%] Built target quake3e_vulkan_x86
[ 96%] Building C object CMakeFiles/q3ui.dir/code/sdl/sdl_gamma.c.o
[ 96%] Building C object CMakeFiles/q3ui.dir/code/sdl/sdl_glimp.c.o
[ 96%] Building C object CMakeFiles/q3ui.dir/code/sdl/sdl_input.c.o
[ 97%] Building C object CMakeFiles/q3ui.dir/code/sdl/sdl_snd.c.o
[ 97%] Built target q3ui
[ 97%] Building C object CMakeFiles/quake3e.dir/code/unix/unix_main.c.o
[ 98%] Building C object CMakeFiles/quake3e.dir/code/unix/unix_shared.c.o
[ 98%] Building C object CMakeFiles/quake3e.dir/code/unix/linux_signals.c.o
[ 99%] Linking C executable quake3e
/usr/bin/ld: CMakeFiles/client.dir/code/client/snd_mix.c.o: in function «S_TransferStereo16»:
snd_mix.c:(.text+0x137): undefined reference to «S_WriteLinearBlastStereo16_SSE_x64»
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/quake3e.dir/build.make:401: quake3e] Error 1
make[1]: *** [CMakeFiles/Makefile2:284: CMakeFiles/quake3e.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

Okay, that's better. Go to code/client/snd_mix.c:268 and erase this entire fragment:

#if idx64 && (!defined (_MSC_VER) || defined(USE_WIN32_ASM))
void S_WriteLinearBlastStereo16_SSE_x64( int*, short*, int );
#endif

Go to code/client/snd_mix.c:298 to find this fragment:

#if idx64 && (!defined (_MSC_VER) || defined (USE_WIN32_ASM))
	S_WriteLinearBlastStereo16_SSE_x64( snd_p, snd_out, snd_linear_count );
#else
	S_WriteLinearBlastStereo16();
#endif

And replace it with this:

S_WriteLinearBlastStereo16();

And now we have a successful build:

alex@alex-MS-7B79:~/build-Quake3e$ make
...
[ 98%] Linking C executable quake3e
[ 99%] Built target quake3e
[ 99%] Building C object CMakeFiles/quake3e.ded.dir/code/unix/unix_main.c.o
[ 99%] Building C object CMakeFiles/quake3e.ded.dir/code/unix/unix_shared.c.o
[100%] Building C object CMakeFiles/quake3e.ded.dir/code/unix/linux_signals.c.o
[100%] Linking C executable quake3e.ded
[100%] Built target quake3e.ded

Alex20129 avatar Jan 31 '25 17:01 Alex20129

You should avoid the cmake unless someone improves it TBH. It's contributed by 3rd party, unmaintained with no support for things that have been added to makefile.

Expected build is with the makefile still.

Also commenting out those forced function versions will make it compile. Must be conflicting with newer glibc.

ensiform avatar Jan 31 '25 18:01 ensiform

There is no problem with CMake itself. As far as I understand:

  • The first problem (q_shared.h:417) is just some ancient hack, the meaning and essence of which is incomprehensible to me.
  • The second problem (undefined reference to "S_WriteLinearBlastStereo16_SSE_x64") is because there is no such function "S_WriteLinearBlastStereo16_SSE_x64" anywhere in the entire project.

Alex20129 avatar Jan 31 '25 19:01 Alex20129

There is no problem with CMake itself. As far as I understand:

  • The first problem (q_shared.h:417) is just some ancient hack, the meaning and essence of which is incomprehensible to me.
  • The second problem (undefined reference to "S_WriteLinearBlastStereo16_SSE_x64") is because there is no such function "S_WriteLinearBlastStereo16_SSE_x64" anywhere in the entire project.

I didn't state or intend to that cmake as a whole is broken but the implementation of it here is not great and you should absolutely avoid it when the build steps in readme/build readme tells you to use makefile IMHO. The cmake files here are use at your own risk/ymmv.

The S_WriteLinearBlastStereo16_SSE_x64 does in fact exist, in hand crafted assembly files which aren't included or ran through the assembly tool with cmake files presently, in fact none of the asm optimized versions are included.

See: https://github.com/ec-/Quake3e/blob/master/code%2Fasm%2Fsnd_mix_x86_64.s

ensiform avatar Jan 31 '25 21:01 ensiform

I ran it using make and it worked fine. I forgot to report that here.

oitzujoey avatar Feb 01 '25 02:02 oitzujoey

I'm using Arch and I wrote a script that fetches latest version of Quake3e source and compiles using make.

https://github.com/Trismegist0sq3/install_latest_quake3e

Trismegist0sq3 avatar Feb 02 '25 03:02 Trismegist0sq3

There's also the aur quake3e git package

ensiform avatar Feb 02 '25 13:02 ensiform