Giter Site home page Giter Site logo

Building with GCC on Linux about rehlds HOT 2 CLOSED

lexzor avatar lexzor commented on May 27, 2024
Building with GCC on Linux

from rehlds.

Comments (2)

anzz1 avatar anzz1 commented on May 27, 2024 1

It seems you have this ./libstdc++.so.6 in the rehlds folder brought in from somewhere which doesn't mach the GLIBCXX version installed on your system and used by GCC. Removing this file or removing the export LD_LIBRARY_PATH=".:$LD_LIBRARY_PATH" from top of your hlds run script should do the trick.

There is another problem in the GCC build the way it currently is however, CMake is pretty crap and the GCC build flags are all over the place because of multiple CMakeLists.txt strewn around everywhere in the project.

Some of the problems because of this is that different parts of the projects end up being compiled with different sets of optimization flags, and also that the project configuration does not take into account the stupid decisions made by distro administrators like changing GCC default flags to use crap like ASLR and stack canaries by default.

So while the CMakeLists.txt does have this portion commented as trying to avoid -fPIC: https://github.com/dreamstalker/rehlds/blob/master/rehlds/CMakeLists.txt#L29-L31
This isn't actually enough and you have to explicitly state gcc: -fno-pic for all libraries and gcc: -fno-pic -fno-pie ld: -no-pie for all executables which currently isn't done. The rehlds main executable ends up being compiled as PIE code since only -no-pie LD flag is specified but no -fno-pie GCC flag which is also required.

Also CMake being CMake you can't actually set these globally from the command line since the options are set in the CMakeLists.txt without bringing in any flags from the command line. So in my personal build I've copy-pasted the ASLR disablings -fno-stack-protector -fno-pic -fno-pie -no-pie and additional compiler flags (for example, you'd want to use -march=native to properly optimize the build for your processor capabilities) to each CMakeLists.txt separately but this is a fucking mess.

To address this correctly would be to scrap CMake and use something simpler and more robust like a good ol' Makefile or even better: a simple shell script.

For the time being, I'd advise to use the latest release version which is properly compiled without stack protectors and other ASLR crap. Building it yourself without changes to the compiler flags will not yield the same result in most of the popular distros. Using the precompiled version does lose you the additional optimizations allowed by -march=native though.

from rehlds.

lexzor avatar lexzor commented on May 27, 2024

Thanks, worked by deleting the export from build.sh file.

from rehlds.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.