Skip to content

Compiling on Linux #1

@apocalyptech

Description

@apocalyptech

Hello!

I'm honestly writing this more for informational purposes, in case someone else wants to compile on Linux and wants a few pointers. Getting it compiling on Linux requires a few code changes, and I don't know the best way to make something like this more crossplatform (my C/C++ is extraordinarily rusty). I also wouldn't expect you to support an extra OS or anything, of course. :)

Anyway, this compiles and runs just fine on Linux with a few minor changes:

  1. Case-sensitivity: #include "ReVorb.h" at the top of revorb.cpp needs to be #include "revorb.h" instead (that, or the header file renamed to have the capital letters)
  2. Lack of "safe" C11 Annex K functions (the *_s functions) in glibc/gcc. There's more than one Linux implementation of these out there, but the one I used was https://github.com/rurban/safeclib - this won't be found by default on most Linux machines. After installing/compiling that, add #include <libsafec/safe_lib.h> and #include <libsafec/safe_str_lib.h> to revorb.h
  3. Other header changes: In revorb.h, remove the include for io.h and substitute unistd.h
  4. _unlink doesn't exit -- just change those instances to unlink instead, in revorb.cpp. There's two instances. (This is what unistd.h provides)
  5. Linux doesn't distinguish between text/binary while reading from STDIN, and doesn't have _setmode (or _fileno). Just comment out those lines in revorb.cpp entirely. There's two instances of that. I did verify that reading in the file via stdin produces the same output as from a file.

So, do all that, and it compiles/runs just fine with:

g++ -o revorb -logg -lvorbis -lsafec-3.6.0 revorb.cpp

I'm attaching a patch with all the changes that I mentioned. As I say, not expecting any of this to get merged in or whatever. If I ever get enthusiastic enough to draft up a "proper" PR for this, I'll submit it that way.

revorb_linux.patch.gz

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions