dreamstalker / rehlds

Reverse-engineered HLDS
GNU General Public License v3.0
647 stars 167 forks source link

GCC support? #205

Closed Fedcomp closed 6 years ago

Fedcomp commented 8 years ago

Apparently rehlds does not support gcc: fresh and clear ubuntu:14.04

apt-get update
apt-get install -y build-essential openjdk-7-jdk openjdk-7-jre-headless git

git clone https://github.com/dreamstalker/rehlds.git
cd rehlds
./gradlew --max-workers=1 clean buildRelease

And the error:

:dep/bzip2:compileReleaseBzip2StaticLibraryBzip2Bz2_main FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':dep/bzip2:compileReleaseBzip2StaticLibraryBzip2Bz2_main'.
> Could not find C compiler '/opt/intel/bin/icc' in system path.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

How do i compile project then? apparently intel compiler is not in free access.

theAsmodai commented 8 years ago

You need to buy icc or use attached to this repository buildserver.

txdv commented 8 years ago

Why are you using the intel compiler? Is it for some special optimizations?

Fedcomp commented 8 years ago

It is considered to be very fast, and it's better optimized for intel cpu's. But considering icc status (no public access), sources in this repo are worthless unless you have intel compiler. Which is kinda dumb imo.

theAsmodai commented 8 years ago

@txdv, yes. Also icc uses Intel's inline assembler syntax and supports naked functions. It is was necessary at the reversing stage.

IgnacioFDM commented 8 years ago

GCC support (or clang) would be quite needed indeed

Fedcomp commented 8 years ago

clang is good too :+1:

txdv commented 8 years ago

Guys, I know the intel c compiler is a bummer in some sense, but as asmodai already said, if you really want some other compiler, chip in, write the patch.

Fedcomp commented 8 years ago

It's complicated.

theAsmodai commented 8 years ago

1) Gradle is a very convenient to install and to use. It's also produces unit tests and compatibility tests with original hlds. 2) There's nothing to broke. 3) Valve used gcc to compile hlds, so gcc build will be more compatible than others.

IgnacioFDM commented 8 years ago

Also it's not like reHLDS is really that tied to icc. It supports MSVC++ for windows as an example.

After a small peak, there is only one naked function that should be worked around, and about 15 inline assembly instances that should be changed a bit to support GCC syntax (which is very similar, you can use intel asm with -masm intel)

I could try to make it work but have no time currently (and also don't really need this since I run windows server). If nobody patches this I'll do it in a few months.

theAsmodai commented 8 years ago

I know GAS syntax but it's still annoying even with the Intel's operands order :disappointed:. Also need to correct Gradle scripts. Okay, I will do.

IgnacioFDM commented 8 years ago

AT&T syntax is absolutely disgusting

mittorn commented 8 years ago

I can not unerstand why it is so difficult to do??? Was written for 288a8d8f19c79beacb093ad4f093282799830bd9 gcc.txt

theAsmodai commented 8 years ago

We need fix a lot of compile errors.

mittorn commented 8 years ago

All assembly inlines was in 288a8d8 was not needed for gcc and fixing some defines was enough to get build it. But it was a year ago,

ghost commented 8 years ago

Someone fix this because I have to run a cs server on xash3d on the pi and Id like to run a steam version too

mittorn commented 8 years ago

Someone fix this because I have to run a cs server on xash3d on the pi and Id like to run a steam version too

It will not help. rehlds uses steam libraries and even does not have own launcher, it is only engine.so BTW, it has JIT compiler and mmx/sse optimizations, so porting it to non-x86 would be difficult.

ghost commented 8 years ago

Yes before I converted to xash3d I tried to compile it and installed the Java sdk for the JIT compiler on the pi. I even got an Intel license for ICC Intel compiler, but didn't see an ARM specific version of it.

The launcher is small and could be adapted to rehlds. The better question is will xash3d add a steam repository for dedicated servers?

theAsmodai commented 8 years ago

This project was designed for production game servers. For fun use Xash3D.

ghost commented 8 years ago

What I believe is that they are making it difficult to replicate and modify as a way to control the binaries and justified it with supposed performance improvements. The latest versions of gcc produce faster code, support easier coding of multithreading with cilk, and better use of simd (sse/neon). That's not even including better support of debugging and cross platform compatibility. Then if you read about gcc 7 it's going to include automatic GPU computation support with open acc. What I've generally found is that silly bugs are introduced in the code as a way to prevent script kiddies from producing binaries at the cost of limiting creativity and performance.

theAsmodai commented 8 years ago

ICC doesn't have a decent competitors on x86. In that case a limited number of supported platforms is a benefit for optimization. I often have to work with disassembled code and see the difference between different compilers. Almost all innovations of GCC team are the similarity of existing Intel's technologies.

ghost commented 7 years ago

I pulled down this repo and tried to build. The build failed in some gradle test step. I didn't even get to the part where I find out I need to pay for the Intel compiler.

There are several lessons here:

As someone else mentioned, this is obviously geared toward having control over your binaries. In that case, why is this even on github?

Saying your project is for 'production game servers' when the code doesn't even build and the target is a 20 year old dead game is pretty weak. What is a 'production game server' to Half-Life?

Why does someone who reverse-engineers Valve's closed-source IP (hlds) care about using a proprietary compiler? If it's really about optimization and so on, show some benchmarks or information.

I can honestly say this is the first C/C++ program I've seen in a public github repo that isn't built using a FOSS compiler. Shame on you!

mittorn commented 7 years ago

@johnstt You may apply my patch (it contains makefile) and fork this repo. I just has no time to keep it up to date Someone should make rehldslite that runs without blobs and compiles with all compilers. Authors of rehlds seems just do not want someone other to compile this.

IgnacioFDM commented 7 years ago

@johnstt

I agree ReHLDS is a pain in the ass to build (on windows I simply gave up on gradle, and luckily VS project files work). Amxmodx is also a pain in the ass on windows with that AMBuild. Absolutely overkill and unnecesary when CMake would do the job and everybody knows how to use it.

Saying your project is for 'production game servers' when the code doesn't even build and the target is a 20 year old dead game is pretty weak. What is a 'production game server' to Half-Life?

CS 1.6 is not dead, and many of us run hundreds of slots and even make money with it. So yeah, you can definitely have "production game servers".

ReHLDS and ReGamedll are amazing projects that took a lot of work and luckily are hosted here on github, and not some closed source binaries on some russian forum.

I'm sure if you or anybody PRs a patch that makes ReHLDS build with GCC in addition to ICC it will get accepted. I would really like to have GCC support. Complaining in such an entitled manner doesn't help really.

LevShisterov commented 7 years ago

Branch with GCC support: https://github.com/dreamstalker/rehlds/tree/gcc Use -PuseGcc switch to compile with GCC.

In-line commented 6 years ago

GCC support was implemented a long time ago. Closing as non active.