mastercomfig / tf2-patches

Team Fortress 2, but with a lot of fixes, QoL improvements and performance optimizations!
Other
218 stars 27 forks source link

Linux Server Issues "configure: error: C compiler cannot create executables" #619

Closed ghost closed 1 year ago

ghost commented 2 years ago

Description

While going through Linux Build Instructions, encountered error: "configure: error: C compiler cannot create executables". Still troubleshooting, although it could be helpful if the documentation were updated a bit more clearly (once I get this fixed and working, I might make a shell script to automate the entire process).

Got project working on Windows (client and server), attempting to run a TC2 server on Linux for testing/gaming purposes. I have experience with running Linux TF2 Servers, so I'm fairly familiar with the general process. Has anyone else encountered this issue?

ghost commented 2 years ago

Looks like the same error as before:

---- LINKING EXE ../../game/srcds_linux [release] ---- /usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libtcmalloc_minimal.so when searching for -ltcmalloc_minimal /usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libtcmalloc_minimal.a when searching for -ltcmalloc_minimal /usr/bin/ld: cannot find -ltcmalloc_minimal: No such file or directory /usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libtcmalloc_minimal.so when searching for -ltcmalloc_minimal collect2: error: ld returned 1 exit status make[2]: [../devtools/makefile_base_posix.mak:595: ../../game/srcds_linux] Error 1 make[1]: [games.mak:106: dedicated_main] Error 2 make: *** [games.mak:65: all] Error 2

real 0m0.934s user 0m0.677s sys 0m0.240s

Going to try removing the line from source_exe_posix_base.vpc again

ghost commented 2 years ago

fatal error: ft2build.h: No such file or directory fixed with sudo apt-get install libfreetype6-dev

ghost commented 2 years ago

fatal error: fontconfig/fontconfig.h: No such file or directory fixed with sudo apt-get install libfontconfig1-dev

ghost commented 2 years ago

Building: vguimatsurface ---- LINKING obj_vguimatsurface_linux32/release/vguimatsurface.so [release] ---- /usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libfontconfig.so when searching for -lfontconfig /usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libfontconfig.a when searching for -lfontconfig /usr/bin/ld: cannot find -lfontconfig: No such file or directory /usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libfontconfig.so when searching for -lfontconfig /usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libfreetype.so when searching for -lfreetype /usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libfreetype.a when searching for -lfreetype /usr/bin/ld: cannot find -lfreetype: No such file or directory /usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libfreetype.so when searching for -lfreetype collect2: error: ld returned 1 exit status make[2]: [../devtools/makefile_base_posix.mak:583: obj_vguimatsurface_linux32/release/vguimatsurface.so] Error 1 make[1]: [games.mak:250: vguimatsurface] Error 2 make: *** [games.mak:65: all] Error 2

real 0m2.675s user 0m1.970s sys 0m0.671s

ghost commented 2 years ago

Combination of the following fixed it, looks good to run, will test:

Manually downloading / sudo dpkg -i from this url: http://mirrors.kernel.org/ubuntu/pool/main/f/fontconfig/fontconfig_2.13.1-4.2ubuntu5_i386.deb sudo apt install libfontconfig1-dev sudo apt --fix-broken

ghost commented 2 years ago

trb@tc2:~/team-comtress-2-main$ ./link.sh ../game fatal: not a git repository (or any of the parent directories): .git ln: failed to create symbolic link './game/hl2': File exists ln: failed to create symbolic link './game/platform': File exists ln: failed to create symbolic link './game/tf/maps': File exists mkdir: cannot create directory './game/tf/materials': File exists ln: failed to create symbolic link './game/tf/materials/models': File exists ln: failed to create symbolic link './game/tf/materials/vgui': File exists ln: failed to create symbolic link './game/tf/media': File exists ln: failed to create symbolic link './game/tf/resource': File exists ln: failed to create symbolic link './game/tf/scripts': File exists ln: failed to create symbolic link './game/tf/tf2_misc_000.vpk': File exists ln: failed to create symbolic link './game/tf/tf2_misc_001.vpk': File exists ln: failed to create symbolic link './game/tf/tf2_misc_002.vpk': File exists ln: failed to create symbolic link './game/tf/tf2_misc_003.vpk': File exists ln: failed to create symbolic link './game/tf/tf2_misc_004.vpk': File exists ln: failed to create symbolic link './game/tf/tf2_misc_005.vpk': File exists ln: failed to create symbolic link './game/tf/tf2_misc_006.vpk': File exists ln: failed to create symbolic link './game/tf/tf2_misc_007.vpk': File exists ln: failed to create symbolic link './game/tf/tf2_misc_008.vpk': File exists ln: failed to create symbolic link './game/tf/tf2_misc_009.vpk': File exists ln: failed to create symbolic link './game/tf/tf2_misc_010.vpk': File exists ln: failed to create symbolic link './game/tf/tf2_misc_011.vpk': File exists ln: failed to create symbolic link './game/tf/tf2_misc_012.vpk': File exists ln: failed to create symbolic link './game/tf/tf2_misc_013.vpk': File exists ln: failed to create symbolic link './game/tf/tf2_misc_014.vpk': File exists ln: failed to create symbolic link './game/tf/tf2_misc_015.vpk': File exists ln: failed to create symbolic link './game/tf/tf2_misc_016.vpk': File exists ln: failed to create symbolic link './game/tf/tf2_misc_017.vpk': File exists ln: failed to create symbolic link './game/tf/tf2_misc_018.vpk': File exists ln: failed to create symbolic link './game/tf/tf2_misc_019.vpk': File exists ln: failed to create symbolic link './game/tf/tf2_misc_020.vpk': File exists ln: failed to create symbolic link './game/tf/tf2_misc_021.vpk': File exists ln: failed to create symbolic link './game/tf/tf2_misc_022.vpk': File exists ln: failed to create symbolic link './game/tf/tf2_misc_023.vpk': File exists ln: failed to create symbolic link './game/tf/tf2_misc_024.vpk': File exists ln: failed to create symbolic link './game/tf/tf2_misc_dir.vpk': File exists ln: failed to create symbolic link './game/tf/tf2_sound_misc_dir.vpk': File exists ln: failed to create symbolic link './game/tf/tf2_sound_vo_english_dir.vpk': File exists ln: failed to create symbolic link './game/tf/tf2_textures_dir.vpk': File exists ln: failed to create symbolic link './game/tf/modelsounds.cache': File exists ln: failed to create symbolic link './game/tf/tf2_sound_misc.vpk.sound.cache': File exists ln: failed to create symbolic link './game/tf/tf2_sound_vo_english.vpk.sound.cache': File exists cp: cannot stat '../game/tf/gamestate.txt': No such file or directory cp: cannot stat '../game/tf/glshaders.cfg': No such file or directory cp: cannot stat '../game/tf/videoconfig_linux.cfg': No such file or directory

ghost commented 2 years ago

trb@tc2:~/team-comtress-2-main$ ./run.sh error: XDG_RUNTIME_DIR not set in the environment.

Assuming this is due to being a linux server, not a client w/monitor.

ghost commented 2 years ago

Do I need two copies of TF2? One generated from the ./build.sh, and one to link to using ./link.sh? Not sure my 25 GB storage on the Digital Ocean droplet is sufficient.

ghost commented 2 years ago

I think I can get around this by downloading the linux version using depotdownloader onto my windows gaming pc, then remove unnecessary large files such as unused maps, then go through the linking process again.

To remove all symlinks: find -type l -delete

ghost commented 2 years ago

decided to pay for extra 20GB block storage, installing tf2 there, then I'll use link.sh after.

melvyn2 commented 2 years ago

Personally I'd delete the game folder, rebuild, and re-link. I should add a check to link.sh to see if tc2 has been built, but meanwhile it should only ever be run after building fully. Yes, you need the stock tf2 assets to run it. However, you don't need two copies of the game assets, it's just symlinks.

ghost commented 2 years ago

I guess what I meant was the team-comtress-main folder was about 15-20 GB by itself, and TF2 would be another 20 GB. I'll try what you mentioned if I can't get it to work with block storage.

ghost commented 2 years ago

Just ran ./build.sh again

Building: dedicated make[2]: No rule to make target '../lib/public/linux32/libSDL2.so', needed by 'obj_dedicated_linux32/release/dedicated.so'. Stop. make[1]: [games.mak:102: dedicated] Error 2 make: *** [games.mak:65: all] Error 2

real 0m0.882s user 0m0.652s sys 0m0.218s

melvyn2 commented 2 years ago

https://github.com/mastercomfig/team-comtress-2/blob/main/src/lib/public/linux32/libSDL2.so It should be there.

ghost commented 2 years ago

Where is your version of the team-comtress-2 main.zip? I just unzipped the official main.zip, and now I'm back at the beginning where we had issues with min vs. std::min.

Edit: I'll try https://github.com/melvyn2/team-comtress-2/archive/refs/heads/for-pr.zip again, but I think it might be missing the libSDL2.so, not sure why it would have disappeared otherwise.

Edit 2: Hrm, so I guess I didn't originally download your complete zip, which confuses me because that's what I thought I exactly did. Had to run sudo apt-get install autoconf

melvyn2 commented 2 years ago

you should definitely try cloning from the repo. Use a shallow clone if you're worried about space. In fact, I think your issue stems from the zips maybe not including symlinks.

melvyn2 commented 2 years ago

Also, troubleshooting of this sort could be easier to finish on discord, if you have the choice: https://discord.gg/CuPb2zV

ghost commented 2 years ago

:) Trying to sign up right now, getting an infinite beep boop captcha.

ghost commented 2 years ago

Welp got a violation for TOS/Community guidelines, guess discord is a no-go. Apparently it didn't like the infinite captcha either.

ghost commented 2 years ago

I'll keep building your complete for-pr build, see if I make more progress. I'll try to keep commenting to a minimum.

ghost commented 2 years ago

Got the same error as before, not sure how to fix it:

---- main.cpp ---- ---- LINKING EXE ../../game/srcds_linux [release] ---- /usr/bin/ld: cannot find -ltcmalloc_minimal: No such file or directory collect2: error: ld returned 1 exit status

melvyn2 commented 2 years ago

You still didn't install it, only the x86_64 version.

ghost commented 2 years ago

Manually downloaded package:

dpkg -i libtcmalloc-minimal4_2.5-2.2ubuntu3_i386.deb (Reading database ... 18330 files and directories currently installed.) Preparing to unpack libtcmalloc-minimal4_2.5-2.2ubuntu3_i386.deb ... Unpacking libtcmalloc-minimal4:i386 (2.5-2.2ubuntu3) over (2.5-2.2ubuntu3) ... dpkg: dependency problems prevent configuration of libtcmalloc-minimal4:i386: libtcmalloc-minimal4:i386 depends on libc6 (>= 2.4). libtcmalloc-minimal4:i386 depends on libgcc1 (>= 1:3.0). libtcmalloc-minimal4:i386 depends on libstdc++6 (>= 5.2).

dpkg: error processing package libtcmalloc-minimal4:i386 (--install): dependency problems - leaving unconfigured Processing triggers for libc-bin (2.35-0ubuntu3) ... Errors were encountered while processing: libtcmalloc-minimal4:i386

melvyn2 commented 2 years ago

again, I would recommend not using ubuntu, clearly it has dropped too many i386 packages to be reasonably usable

ghost commented 2 years ago

Gotcha, I'll try debian.

ghost commented 2 years ago

bash: line 1: /bin/ar: No such file or directory

ghost commented 2 years ago

also, I'm testing this in a docker container on windows, running Debian (this lets me test faster).

melvyn2 commented 2 years ago

Did you run the dependency install commands? If you did, I know where the issue is, I'll commit a fix when I get home.

ghost commented 2 years ago

I get the following:

E: Unable to locate package fontconfig:i386 E: Unable to locate package libcurl4-gnutls-dev:i386 E: Unable to locate package libedit2:i386 E: Unable to locate package libfontconfig1:i386 E: Unable to locate package libfontconfig1-dev:i386 E: Unable to locate package libfreetype-dev:i386 E: Unable to locate package libncurses-dev:i386 E: Unable to locate package libopenal-dev:i386 E: Unable to locate package libopenal1:i386 E: Unable to locate package libtcmalloc-minimal4:i386 E: Unable to locate package libunwind-dev:i386 E: Unable to locate package libx11-dev:i386 E: Unable to locate package mesa-common-dev:i386

So I installed the non-i386 versions of them

ghost commented 2 years ago

Manually installed the packages:

dpkg -i fontconfig_2.13.1-4.2_i386.deb (Reading database ... 20926 files and directories currently installed.) Preparing to unpack fontconfig_2.13.1-4.2_i386.deb ... Unpacking fontconfig:i386 (2.13.1-4.2) over (2.13.1-4.2) ... dpkg: dependency problems prevent configuration of fontconfig:i386: fontconfig:i386 depends on libc6 (>= 2.4). fontconfig:i386 depends on libfontconfig1 (>= 2.13.0). fontconfig:i386 depends on libfreetype6 (>= 2.8.1).

dpkg: error processing package fontconfig:i386 (--install): dependency problems - leaving unconfigured Errors were encountered while processing: fontconfig:i386

melvyn2 commented 2 years ago

You definitely should not install the packages manually, it's never going to work right that way. You did add the i386 arch and run apt update?

ghost commented 2 years ago

yup, I did dpkg --add-architecture i386 then apt update.

melvyn2 commented 2 years ago

Which debian version?

ghost commented 2 years ago

Latest Version 11.3; which one should I use?

melvyn2 commented 2 years ago

You've misconfigured something, those packages definitely exist: https://packages.debian.org/search?suite=all&arch=i386&searchon=names&keywords=mesa-common-dev Check your /etc/apt/sources.list

ghost commented 2 years ago

/etc/apt/sources.list contents:

"# deb http://snapshot.debian.org/archive/debian/20220418T000000Z bullseye main deb http://deb.debian.org/debian bullseye main "# deb http://snapshot.debian.org/archive/debian-security/20220418T000000Z bullseye-security main deb http://security.debian.org/debian-security bullseye-security main "# deb http://snapshot.debian.org/archive/debian/20220418T000000Z bullseye-updates main deb http://deb.debian.org/debian bullseye-updates main

Ignore the quotation marks, that's just so github doesn't format to make the hashtags huge titles

melvyn2 commented 2 years ago

remove the lines with the snapshot urls and apt update. I'll note that this is really past the scope of this issue tracker, these are wider issues you seem to be having. I'll try to still help for now.

ghost commented 2 years ago

Gotcha; looks like removing the commented lines in the sources.list allowed me to properly apt get all the prerequisites (learned something new!)

Looks like the current issue on this Debian 11 Docker build is /bin/ar: no such file or directory

---- decompress.c ---- bash: line 1: /bin/ar: No such file or directory make[2]: [../../devtools/makefile_base_posix.mak:544: lzma.a] Error 127 make[1]: [games.mak:142: lzma] Error 2 make[1]: *** Waiting for unfinished jobs....

---- halton.cpp ---- cp -f pch_tier0.h ./obj_tier0_linux32/release/pch_tier0.h bash: line 1: /bin/ar: No such file or directory make[2]: [../../devtools/makefile_base_posix.mak:544: bzip2.a] Error 127 make[1]: [games.mak:86: bzip2] Error 2

-P-- platform_posix.cpp ---- bash: line 1: /bin/ar: No such file or directory make[2]: [../devtools/makefile_base_posix.mak:544: appframework.a] Error 127 make[1]: [games.mak:74: appframework] Error 2

-P-- memdbg.cpp ---- bash: line 1: /bin/ar: No such file or directory make[2]: [../devtools/makefile_base_posix.mak:544: tier1.a] Error 127 make[1]: [games.mak:222: tier1] Error 2

-P-- minidump.cpp ---- ---- LINKING obj_tier0_linux32/release/libtier0.so [release] ---- /usr/bin/ld: ./obj_tier0linux32/release/vprof.o: warning: relocation against ` ZN10CVProfNode9MarkFrameEv' in read-only section `.text' /usr/bin/ld: warning: creating DT_TEXTREL in a shared object ---- COPYING TO ../../game/bin/libtier0.so [release] ---- ../devtools/gendbg.sh: line 40: /bin/objcopy: No such file or directory ../devtools/gendbg.sh: line 41: /bin/objcopy: No such file or directory ---- COPYING TO IMPORT LIBRARY ../lib/public/linux32/libtier0.so ---- make: *** [games.mak:65: all] Error 2

real 0m0.659s user 0m2.949s sys 0m0.790s

melvyn2 commented 2 years ago

pull from my branch, I committed a likely fix

ghost commented 2 years ago

gotcha, gimme a bit to download/unzip

ghost commented 2 years ago

Building: vstdlib ---- LINKING EXE ../../game/hl2_linux [release] ---- ---- LINKING EXE ../../game/srcds_linux [release] ---- /usr/bin/ld: cannot find -ltcmalloc_minimal collect2: error: ld returned 1 exit status /usr/bin/ldmake[2]: [../devtools/makefile_base_posix.mak:595: ../../game/hl2_linux] Error 1 make[1]: [games.mak:138: launcher_main] Error 2 make[1]: Waiting for unfinished jobs.... : cannot find -ltcmalloc_minimal collect2: error: ld returned 1 exit status make[2]: [../devtools/makefile_base_posix.mak:595: ../../game/srcds_linux] Error 1 make[1]: [games.mak:106: dedicated_main] Error 2 ---- LINKING EXE ../../../game/simdtest [release] ---- /usr/bin/ld: cannot find -ltcmalloc_minimal collect2: error: ld returned 1 exit status make[2]: [../../devtools/makefile_base_posix.mak:595: ../../../game/simdtest] Error 1 make[1]: [games.mak:194: simdtest] Error 2 make: [games.mak:65: all] Error 2

real 0m0.131s user 0m0.567s sys 0m0.156s

ghost commented 2 years ago

apt-get install libtcmalloc-minimal4:i386 Reading package lists... Done Building dependency tree... Done Reading state information... Done libtcmalloc-minimal4:i386 is already the newest version (2.8.1-1). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

melvyn2 commented 2 years ago

hmm, try sudo ln -s /usr/lib/i386-linux-gnu/libtcmalloc_minimal.so.4 /usr/lib/i386-linux-gnu/libtcmalloc_minimal.so

ghost commented 2 years ago

Nice, seems to be progressing more. Got histedit.h missing, fixed again with apt-get install libedit-dev.

ghost commented 2 years ago

Got the following: ---- memoverride.cpp ---- ---- memoverride.cpp ---- /usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libedit.so when searching for -ledit /usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libedit.a when searching for -ledit /usr/bin/ld: cannot find -ledit /usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libedit.so when searching for -ledit collect2: error: ld returned 1 exit status make[2]: [../devtools/makefile_base_posix.mak:583: obj_dedicated_linux32/release/dedicated.so] Error 1 make[1]: [games.mak:102: dedicated] Error 2 make[1]: *** Waiting for unfinished jobs....

ghost commented 2 years ago

apt install libedit-dev Reading package lists... Done Building dependency tree... Done Reading state information... Done libedit-dev is already the newest version (3.1-20191231-2+b1). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

apt install libedit2:i386 Reading package lists... Done Building dependency tree... Done Reading state information... Done libedit2:i386 is already the newest version (3.1-20191231-2+b1). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

melvyn2 commented 2 years ago

try libedit-dev:i386

ghost commented 2 years ago

Hey, that looks like it worked! Looks like it 100% built.

./link.sh /home/trb/TC2 ./link.sh: line 33: git: command not found cp: cannot stat '/home/trb/TC2/tf/gamestate.txt': No such file or directory cp: cannot stat '/home/trb/TC2/tf/glshaders.cfg': No such file or directory cp: cannot stat '/home/trb/TC2/tf/videoconfig_linux.cfg': No such file or directory

Not sure how to run this as a server from here (I'm assuming the above can be ignored) When I follow the TF2 Wiki Linux Server to make the bash script, first off in the /game folder there is no srcds_run

!/bin/sh

./srcds_run -console -game tf +sv_pure 1 +randommap +maxplayers 24

second, if I change it to ./srcds_linux, I get Failed to open dedicated.so (dedicated.so: cannot open shared object file: No such file or directory)

melvyn2 commented 2 years ago

first, you need to clone with git, as I told you...

ghost commented 2 years ago

Gotcha, sorry been really busy today so I was probably distracted; just git cloned, got the following:

autoreconf: 'configure.ac' or 'configure.in' is required