FNA-XNA / FAudio

FAudio - Accuracy-focused XAudio reimplementation for open platforms
https://fna-xna.github.io/
Other
556 stars 77 forks source link

Bool size in Darwin ppc ABI is 4-byte (Windows too?) #319

Open barracuda156 opened 1 year ago

barracuda156 commented 1 year ago

Apparently on Windows bool is also 4-byte, according to: https://github.com/FNA-XNA/FAudio/commit/d0a90be6984cde9ea37715b2607930eb227877c1 However tests header defined bool as uint8_t: https://github.com/FNA-XNA/FAudio/blob/c5f82468756471ec23efea1481e559038f01317b/tests/FAudio_compat.h#L5

I am not sure about how it works on Windows; to accommodate Darwin ppc it will be needed to do smth like:

#if defined(__APPLE__) && defined(__ppc__)
typedef uint32_t BOOL;
#else
typedef uint8_t BOOL;
#endif
flibitijibibo commented 1 year ago

I think the typedef is just to alias the BOOL name, since FAudio itself uses uint8_t, but if making it uint32_t makes it work for ppc I can merge that in!

barracuda156 commented 1 year ago

@flibitijibibo Thank you for responding (and for merging the PR!).

I got some issue with running tests: once launched, the binary does nothing, essentially freezing, and GDB does not show any meaningful output (it also hangs after Reading symbols for shared libraries). So no need to change bool there right now, I think. Unless tests actually run (even with failures), that is pointless anyway.

P. S. It is quite possible our SDL2 is not working correctly on PPC (it is in experimental status), but I would expect tests failing, if so, but not being unable to even start. Apparently something unrelated to SDL2 is broken, but I have no idea what.

flibitijibibo commented 1 year ago

Not sure about the tests, but the utils might narrow it down a bit - the utils don't do any winapi mapping so it should be possible to run those and get some output without any alignment weirdness happening.

barracuda156 commented 1 year ago

@flibitijibibo Sorry for a silly question, where to find those utils? They are not installed, and I am not sure they are built by default.

flibitijibibo commented 1 year ago

I think the CMake option is BUILD_UTILS, it won't be on by default (phoneposting atm).

barracuda156 commented 1 year ago

I should have looked into CMakeLists, will try it now.

UPD. facttool launches, for example, but looks like this (may be SDL2 issue though): faudio (initial dyld error is caused by library paths set in the binaries – they point to install prefix, while I ran binary without installing libs first; so ignore that).

P. S. I wonder if FAudio works on macOS at all. Portfile has a note that utils segfaulted, and be sure, this was not on PowerPC: https://github.com/macports/macports-ports/blob/380698f05626c4949bb30834dda86039d707bbc0/audio/FAudio/Portfile#L42-L43

barracuda156 commented 1 year ago

@flibitijibibo So utilities launch and at least their menus work, though fonts are displayed in a barely readable fashion. Ironically, this did not help in any way to understand why tests do not start, since utilities are kind of okay.

barracuda156 commented 1 year ago

When I run with GDB, I get this (and I have to interrupt the process, as it freezes):

36-25% sudo gdb ./faudio_tests                                                 GNU gdb 6.3.50-20050815 (Apple version gdb-1314.1) (Sun Nov 16 22:48:12 UTC 2008)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "powerpc-apple-darwin"...Reading symbols for shared libraries .... done

(gdb) run
Starting program: /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_audio_FAudio/FAudio/work/build/faudio_tests 
Reading symbols for shared libraries +++................................................................................................... done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
^C
Program received signal SIGINT, Interrupt.
0x00250e18 in semaphore_timedwait_signal_trap ()