Sneaker 17 Posted February 26 Report Share Posted February 26 I'm trying to build a debug trunk build (which I've been able to do in the past). I'm doing a "cmake -DCMAKE_BUILD_TYPE="Debug" ..", then "make" in a subdirectory called build, but make bails at the linking of the binary: [100%] Linking CXX executable thedarkmod.x64 /usr/bin/ld: cannot find -lstdc++ collect2: error: ld returned 1 exit status make[2]: *** [CMakeFiles/TheDarkMod.dir/build.make:8080: thedarkmod.x64] Error 1 make[1]: *** [CMakeFiles/Makefile2:96: CMakeFiles/TheDarkMod.dir/all] Error 2 make: *** [Makefile:104: all] Error 2 The libstdc++.so is installed and exists /lib/gcc/x86_64-redhat-linux/10/libstdc++.so. I'm not really familiar with cmake, so I'm not sure the proper way to get things linked up... any ideas? (Now that I think about it, I think the last time I built darkmod (last year) was applying a scons patch, which I rather just get the correct way to build darkmod working...) Quote Link to post Share on other sites
nbohr1more 2236 Posted February 26 Report Share Posted February 26 I presume you went through the compiling guide? https://wiki.thedarkmod.com/index.php?title=The_Dark_Mod_-_Compilation_Guide Quote Please visit TDM's IndieDB site and help promote the mod: http://www.indiedb.com/mods/the-dark-mod (Yeah, shameless promotion... but traffic is traffic folks...) Link to post Share on other sites
Sneaker 17 Posted February 26 Author Report Share Posted February 26 Yup, that's what I'm following. Except for "Release" I used "Debug", and I just used "make" without "-j" cause it went into a memory hog partway through the compile at first. Quote Link to post Share on other sites
nbohr1more 2236 Posted February 26 Report Share Posted February 26 Try removing and re-installing "libstdc" then try updating build-essential. ( I presume you have CMAKE 3.12 or newer ?) Does it work if you specify your game directory ? : -DGAME_DIR=../../darkmod Quote Please visit TDM's IndieDB site and help promote the mod: http://www.indiedb.com/mods/the-dark-mod (Yeah, shameless promotion... but traffic is traffic folks...) Link to post Share on other sites
Sneaker 17 Posted February 26 Author Report Share Posted February 26 No go. I reinstalled "gcc-c++/libstdc++/libstdc++-devel", they also all verified ok. On fedora, we don't have a "build-essential" package, but I've generally built some things successfully with this install (still possible a package might be missing though, I have no idea what). cmake version is: cmake-3.17.4-2.fc32.x86_64, so newer. did use the "GAME_DIR" variable, but didn't outwardly seem to change anything. Thanks for the help. Gotta take a break, my junky pc takes a long time to compile. Quote Link to post Share on other sites
stgatilov 1310 Posted February 26 Report Share Posted February 26 "libstdc++" is the default C++ runtime library of GCC compiler. There is also another C++ runtime library called "libc++", which is default library of Clang. I think GCC can also use it if explicitly said so, or maybe depending of distribution settings. The CMakeLists for TDM does not mention "libstdc++" explicitly. Instead, GCC adds it automatically to the list of libraries, because... well, that's runtime library You might want to build empty file with "int main() {}" using simple "gcc a.c -o a" command and verify that it works. I'm not good in Linux world. But I might speculate that it is possible that your GCC uses "libc++" by default, but TDM for some reason forces it to use "libstdc++" which does not work. Although it sounds like a stupid idea. Another important fact is that TDM links runtime libraries statically. The .so files which you found are dynamic libraries: when you link C++ program against .so file, the resulting executable cannot run without that .so file. The static libraries normally have ".a" extension. I cannot say if GCC can magically link .so file statically as some smart special case: Visual C++ definitely cannot. So you might want to look up how static runtime libraries are named and search for them. You might want to look here for explanations or particular compiler arguments to link statically. If static linking becomes a problem for you, then you can find and remove/command out the following string in CMakeLists.txt: ucm_set_runtime(STATIC) I think then compiler will link runtimes dynamically, since that is default mode. Quote Link to post Share on other sites
Sneaker 17 Posted February 26 Author Report Share Posted February 26 11 hours ago, stgatilov said: Another important fact is that TDM links runtime libraries statically. Ah ha... the package that needs to be installed is "libstdc++-static". I was able to build a dynamically linked binary also. Thank you! Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.