Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fteqcc with -Ovectorcalls segfaults on FrogBot source #300

Open
DrLex0 opened this issue Dec 17, 2024 · 1 comment
Open

fteqcc with -Ovectorcalls segfaults on FrogBot source #300

DrLex0 opened this issue Dec 17, 2024 · 1 comment

Comments

@DrLex0
Copy link

DrLex0 commented Dec 17, 2024

I was trying to rebuild the FrogBot qwprogs.dat from source in Ubuntu, and it is essential to enable -Ovectorcalls to build this for a large number of maps. Without this option, the numpr_globals limit is exceeded and fteqcc switches to a format incompatible with engines like ezQuake.

The problem is that both the old fteqcc that can be installed in Ubuntu through APT, as well as recent source I downloaded and compiled from the https://www.fteqcc.org/ page, crash with a segfault 💥 when attempting to build FrogBot source by running fteqcc -O3 -Ovectorcalls. When I replace -O3 with -O0, it hangs at 100% CPU.
Maybe the FrogBot code does contain something fishy, but then it should exit with a helpful error instead of just going kaboom.

(Yes, FrogBot code is fishy and badly needs a rework to avoid having to recompile the whole thing just to add a map, with waypoint data consisting of QC code that adds about 200 globals per map, but this is what we're currently stuck with until someone dares to take a deep dive in the code.)

If you want to give it a shot, the FB source can be found here (via Mick's guide). I had to fix some #include paths to get it to build at all, but maybe that was only needed for the older version. Note that this source includes an old Windows build of fteqcc with explicit instructions to use that one because it won't crash.

@DrLex0
Copy link
Author

DrLex0 commented Dec 23, 2024

This is no longer ‘urgent’ (insofar it ever was). When modifying the Frogbot code to pass the arguments to the N() function as 3 floats instead of a vector, adding a new map waypoint file results in way fewer new globals, probably the same effect as compiling the old code with -Ovectorcalls.

DrLex0 added a commit to DrLex0/quake-frogbots that referenced this issue Dec 26, 2024
Change `N()` to take 3 floats instead of a vector.

Also add some extra info to waypoint print and QC dump.

The script can convert waypoints from the old format (`-t` option).
The new waypoint tool outputs the new format.

Background:
Each unique vector constant produces 3 new globals, because of reasons.
The `-Ovectorcalls` option of fteqcc allowed to work around this, but
recent versions break when building with Trinca's 379 maps
(fte-team/fteqw#300).
This fix introduces **no** new globals when calling `N()` with whatever
arguments, and makes `-Ovectorcalls` unnecessary.

For Trinca's 379 maps, we went from about 88k `pr_globals` to 10k.
The limit for engines like ezQuake is 65k.

Until we hit another limit, we can now probably build the Frogbot
qwprogs with more waypoints than the community can ever create
(challenge accepted?)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant