CoD4x compile error Ubuntu 64-Bit

Hello everyone!

I wonder if anyone is facing the same problem.
I am trying to compile cod4x18_dedrun (version 21.2) on an Ubunut 64-bit (22.04) machine, following the instructions given in CoD4x_Server GitHub-repository (CoD4x_Server/README.md at 21.2 · callofduty4x/CoD4x_Server · GitHub).

When running the command “make”, I will get this error:

src/sv_bots.cpp: In function ‘void scr_botweapon(scr_entref_t)’:
src/sv_bots.cpp:194:5: error: reference to ‘byte’ is ambiguous
  194 |     byte weapInt;
      |     ^~~~
In file included from /usr/include/c++/11/cmath:42,
                 from /usr/include/c++/11/math.h:36,
                 from src/q_shared.h:45,
                 from src/g_public_mp.h:4,
                 from src/player.h:28,
                 from src/sv_bots.h:4,
                 from src/sv_bots.cpp:1:
/usr/include/c++/11/bits/cpp_type_traits.h:404:30: note: candidates are: ‘enum class std::byte’
  404 |   enum class byte : unsigned char;
      |                              ^~~~
In file included from src/g_public_mp.h:4,
                 from src/player.h:28,
                 from src/sv_bots.h:4,
                 from src/sv_bots.cpp:1:
src/q_shared.h:129:23: note:                 ‘typedef unsigned char byte’
  129 | typedef unsigned char byte;
      |                       ^~~~
src/sv_bots.cpp:216:5: error: ‘weapInt’ was not declared in this scope; did you mean ‘weapon’?
  216 |     weapInt = (byte)G_GetWeaponIndexForName(weapon);
      |     ^~~~~~~
      |     weapon
src/sv_bots.cpp:216:16: error: reference to ‘byte’ is ambiguous
  216 |     weapInt = (byte)G_GetWeaponIndexForName(weapon);
      |                ^~~~
In file included from /usr/include/c++/11/cmath:42,
                 from /usr/include/c++/11/math.h:36,
                 from src/q_shared.h:45,
                 from src/g_public_mp.h:4,
                 from src/player.h:28,
                 from src/sv_bots.h:4,
                 from src/sv_bots.cpp:1:
/usr/include/c++/11/bits/cpp_type_traits.h:404:30: note: candidates are: ‘enum class std::byte’
  404 |   enum class byte : unsigned char;
      |                              ^~~~
In file included from src/g_public_mp.h:4,
                 from src/player.h:28,
                 from src/sv_bots.h:4,
                 from src/sv_bots.cpp:1:
src/q_shared.h:129:23: note:                 ‘typedef unsigned char byte’
  129 | typedef unsigned char byte;
      |                       ^~~~
make: *** [makefile:224: obj/sv_bots.o] Error 1

This error is saying, that there is a conflict:
type ‘byte’ is defined as ‘unsigned char’ in ‘src/q_shared.h’
type ‘byte’ is defined as ‘unsigned char’ in ‘/usr/include/c++/11/bits/cpp_type_traits.h’

The compiler does not know which one to use, so it throws an error.
I don’t know why this happens, I did not apply any changes in the source code from here. Either I am doing something wrong or the instructions (for Ubunut 64-bit) contain errors.

Anyways, I tried to change ‘byte’ to ‘unsigned char’ in the affected areas from the error (sv_bots.cpp / sv_bots.h), since this is the same.
Tried to compile again and faced another error. This one is a bit hard to describe, the log output is very long to post here, so I will only post a snap of it:

You build CoD4 version: 21.2
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
Server start
make mbedtls
make[1]: Entering directory '/home/CoD4x_Server-21.2/src/mbedtls'
Mbedtls start
Mbedtls done
make[1]: Leaving directory '/home/CoD4x_Server-21.2/src/mbedtls'
make tomcrypt
make[1]: Entering directory '/home/CoD4x_Server-21.2/src/tomcrypt'
TomCrypt start
TomCrypt done
make[1]: Leaving directory '/home/CoD4x_Server-21.2/src/tomcrypt'
gcc obj/version.o -DCOD4X18UPDATE -DBUILD_NUMBER=0 -DBUILD_BRANCH=no-branch -DBUILD_REVISION=no-revision -D_GNU_SOURCE
gcc bin/cod4x18_dedrun
/usr/bin/ld: obj/sv_main.o:(.bss+0xa276848): multiple definition of `g_motd'; obj/g_sv_main.o:(.bss+0x39c): first defined here
/usr/bin/ld: obj/bg_jump.o:(.bss+0x10): multiple definition of `jump_height'; obj/g_sv_main.o:(.bss+0x54): first defined here
/usr/bin/ld: obj/bg_jump.o:(.bss+0x8): multiple definition of `jump_slowdownEnable'; obj/g_sv_main.o:(.bss+0x4c): first defined here

[...]

src/asmsource/_bg_mantle.asm:(.bss+0x0): multiple definition of `mantle_enable'; obj/g_sv_main.o:(.bss+0x40): first defined here
/usr/bin/ld: obj/_bg_mantle.o: in function `mantle_view_yawcap':
src/asmsource/_bg_mantle.asm:(.bss+0x4): multiple definition of `mantle_view_yawcap'; obj/g_sv_main.o:(.bss+0x2c): first defined here
/usr/bin/ld: obj/_bg_mantle.o: in function `mantle_debug':
src/asmsource/_bg_mantle.asm:(.bss+0xc): multiple definition of `mantle_debug'; obj/g_sv_main.o:(.bss+0x3c): first defined here

[...]

/usr/bin/ld: obj/sv_client.o: in function `SV_ReceiveStats_f':
sv_client.c:(.text+0x1401): undefined reference to `rijndael_setup'
/usr/bin/ld: sv_client.c:(.text+0x14e6): undefined reference to `rijndael_ecb_decrypt'
/usr/bin/ld: sv_client.c:(.text+0x151e): undefined reference to `rijndael_done'
/usr/bin/ld: warning: creating DT_TEXTREL in a PIE
collect2: error: ld returned 1 exit status
make: *** [makefile:199: bin/cod4x18_dedrun] Error 1

‘multiple definition’ anywhere in the error.
Now, after trying to fixing for many hours, I am about to give up.
I also tried it on an Ubuntu 64-Bit (20.04) machine, Ubuntu 32-Bit machine (with the instruction for that machine) and Windows (instruction for Windows), but getting other errors.
Maybe some smart people are here and know some solutions. Thanks for any help!

Hi @R34N
Contact me, i will help you.

I get a different error when using make on ubuntu

nasm obj/_bg_misc.o
src/asmsource/_bg_misc.asm:2859: error: symbol `bgShockDvarNames’ redefined
makefile:231: recipe for target ‘obj/_bg_misc.o’ failed
make: *** [obj/_bg_misc.o] Error 1

can anyone help?

1 Like

Send me pm, i will help you.

my problem is resolved by updating ubuntu to version 20..04 now i no longer get the error on make..

Sorry frog I missed the message to pm you for help.

I would strongly recommend to update to at least 22.04, as 20.04 end of life.

But better to upgrade to 24.04 if you can.

I told you…. You have problem with version.

Hi Alex, I am thinking of moving to 22.04 from 20.04. How much will this mess with NeHo’s Webadmin and anything else I have installed. I seem to remember doing this on opther versions many moons ago and it did not go well haha. Any advice appreciated.

For info I went ahead and did it. A couple of problems with node version and mongo but in the end all ok updating to 22.04 and NeHo’s webadmin.

1 Like

Nice, it should work on 24.04 as well no issues.

i upgraded as well but killed neho’s webadmin in doing so luckly that i had a backup of 20.04 on another hard drive. and was able to reverse the problem. I did the update again and as long as I did not do an npm install of the webadmin all was ok. that is what killed my webadmin on my first upgrade.