Skip to content
Snippets Groups Projects

Make execinfo.h optional (fixes musl libc build)

Merged Hanicef requested to merge Hanicef/SRB2Classic:make-execinfo-optional into next
1 unresolved thread

finally got the chance to build on Alpine Linux, which uses musl libc instead of glibc. while it was building fine for the most part, there was one place where we used execinfo.h, a non-standard header that most UNIX-systems (but not all, as demonstrated here!) support. fortunately, the header is not necessary to allow SRB2 to run, and can be safely made optional using preprocessor directives.

so, to build using musl libc, the environment variable NOEXECINFO=1 must be set using this patch. this was the easiest way to solve this and it does the job, but we're going to have to document this later on the wiki.

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
308 314 CRASHLOG_WRITE(strsignal(signal));
309 315 CRASHLOG_WRITE("\n"); // Newline for the signal name
310 316
317 #ifndef NOEXECINFO
311 318 CRASHLOG_STDERR_WRITE("\nBacktrace:\n");
312 319
313 320 // Flood the output and log with the backtrace
314 321 size = backtrace(array, BT_SIZE);
315 322 backtrace_symbols_fd(array, size, fd);
316 323 backtrace_symbols_fd(array, size, STDERR_FILENO);
324 #endif
317 325
318 326 CRASHLOG_WRITE("\n"); // Write another newline to the log so it looks nice :)
  • With NOEXECINFO, we get two \n writes in a row at the end. Is that intentional?
    (I.e. does backtrace_symbols_fd(array, size, STDERR_FILENO); end with \n? If not, then the last \n write should be in the #ifndef too.)

    Also, you may want to add NOEXECINFO information to CMakeLists.txt, src/CMakeLists.txt, and src/Makefile too, similar to MOBJCONSISTANCY and PACKETDROP.

    (Lastly, I think that this kind of merge request is [supposed to target the "master" branch] - SRB2 having two separate "target branches" is a bit confusing. :dramahog:)

  • Please register or sign in to reply
  • Yea, since this is a BUILD issue, you will need target master.

    Can you please use git rebase -i dc79b25cb90887c5347994df099c9698a39fd09a (aka, master) and remove all the other commits?

  • Also, it may be usefully to add a build job to our .gitlib-ci.yml to for build on Alpine Linux.

    We have 2 build jobs to make a binary with musl-gcc but they are not linked with SDL2. It would be better if we have artifacts for that OS.

  • OK, I had merged your changes into master branch, created a build job for Alpine. Then merged that into next branch.

    master: https://git.do.srb2.org/STJr/SRB2/-/jobs/8361

    next: https://git.do.srb2.org/STJr/SRB2/-/jobs/8372

    Did I missed anything from cherry picking your changes?

  • Logan Aerl Arias mentioned in commit 97a98d30

    mentioned in commit 97a98d30

  • added Ecosystem label

  • Please register or sign in to reply
    Loading