Closed nandahkrishna closed 2 years ago
Does it actually work without it?
I know old MacOS required it in order to work - it would compile and install, but fail to run as symbols were unable to resolve.
I'd forgotten to pass dynamic_lookup
to -undefined
, which means symbols are resolved at runtime. I then tried building and testing 0.2.93 with Homebrew, and I was able to play audio without problems. Are there any additional/comprehensive tests that I should run to be sure?
0.2.94?
Hm, 0.2.94 fails to build but the error seems unrelated to this change:
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C cdfs TOPDIR=../.././
clang -g -O2 -fno-common -fPIC -Wall -I../.././ audio.c -o audio.o -c
audio.c:135:2: error: expected statement
}
^
1 error generated.
make[2]: *** [audio.o] Error 1
make[1]: *** [all] Error 2
make: *** [dirs] Error 2
Add a before ; before the }
Some C compilers are more strict than others. A Label seems to must have a statement after it, even if it is empty.
I will merge this PR after I fix that semicolon (keeping this PR open as a reminder to myself until next time I'm at a computer)
I'd forgotten to pass dynamic_lookup to -undefined, What did you mean by this (I'm not a Mac user/developer)?
What did you mean by this (I'm not a Mac user/developer)?
In a previous version of the changes I'd proposed here, I'd forgotten to update the argument to -undefined
from suppress
to dynamic_lookup
. We need to change this because omitting the -flat_namespace
flag will build shared libraries with a two-level namespace, and this does not support -undefined suppress
. By specifying dynamic_lookup
, we indicate that the dynamic linker will resolve undefined symbols at runtime.
Fixed the issue you encountered in audio.c, and regenerated ./configure too :-) Thank you for the PR
Thanks! 😄
Apple discourages the use of
-flat_namespace
, and the only reason it continues to exist is for compatibility with very old versions of OS X. Unless the program being built specifically requires the benefits of a flat namespace, it is best to avoid the flag to prevent linker errors, e.g. due to name collisions, as discussed here. (Note: An Apple staff member mentions that the flag is effectively deprecated.)This PR aims to fix the flat namespace audit failure at Homebrew/homebrew-core#95769.