Jump to content
The Dark Mod Forums

link build error, can't find -lstdc++ (fedora 32)


Sneaker
 Share

Recommended Posts

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...)

Link to comment
Share on other sites

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

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 comment
Share on other sites

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. :)

Link to comment
Share on other sites

"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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recent Status Updates

    • nbohr1more

      Anyone have any luck with light.setShader( string ) ? It seems to make whichever light you apply it to full-bright on the initial invoke?
      · 0 replies
    • thebigh

      I'm starting to think we need another mapping contest.
      · 4 replies
    • kano

      Don't you hate it when there's a quality discussion on a forum somewhere online about something, but then two disagreeing users derail and transform it into a back-and-forth poo slinging competition at one another?
      · 8 replies
    • Diego

      Oh look the status updates are back! 
      · 2 replies
    • JackFarmer

      After watching the first three and a half episodes of "The Sandman" last night, I realize once again that overly imaginative narratives are not for me. Also, the main actor looks like he has a toothache.
      Which makes me wonder, is there a Dark Mod mission with a medieval dentist?
      · 4 replies
×
×
  • Create New...