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
Removal of OSX CC hack (MACOSX_DEPLOYMENT_TARGET) #422
Comments
This code area got a very small change in 02e8bbd but the issue still remains. |
|
At a minimum, can we change from using the environmental var to using the CFLAG |
|
for (1), it is more idiomatic in shell to set environment variables for a single command invocation using the CC='env MACOSX_DEPLOYMENT_TARGET=10.8 gcc'note also that invocations of $CC can never safely split on whitespace (and indeed shell itself never splits a dollar expansion) because the user could legitimately set CC to, say 'cc -stdc99'. |
|
-mmacos-version-min is clang specific precludes the use of other current or future compilers on MacOS, so I recommend against that... unless it is preceded by a feature test to make sure the compiler doesn't bail out with an unsupported option error before actual use. Even then, |
I'm happy with the env solution too; they're equivalent for my uses. Do we want to get that commited for now, and then argue over whether we need anything at all later? |
|
I have no issues with the env approach. (I'm on the phone now though) |
|
regarding (3): MACOSX_DEPLOYMENT_TARGET causes the Apple compiler, even in 10.11 betas, to change conformance with SUSv3 and legacy (pre-10.5) header declarations at compile time, and also turns on weak linking to prevent generating a binary with a load-time dependency on (indirect) API symbols not yet available in the stated target release... that is, if you compile without the setting on 10.11, and someone running 10.10 installs your binary, it may not work for them even though your source code does not directly call any 10.11 only APIs. Removing it from Luarocks entirely seems like a mistake to me, especially as it might seem to work for a large set of recent OS releases and Lua bindings; until it doesn't. 10.8 seems like a good value already as it doesn't predate __thread support, while being recent enough not to exclude any significant portion of the Mac OS/Luarocks user base (IMHO). Something else to consider is that child processes inherit the parent's environment in POSIX, if only we had |
I question if anyone is actually distributing binary rocks outside of windows. On linux, I already have to take precautions if I'm going to distribute a binary (usually building on a system with a sufficiently old glibc but a new kernel..., I know people that keep ubuntu edgy vms around for this purpose...) |
|
I have no idea about binary rock distribution numbers. You may be right that the only people who care about this already know how to use it... but it doesn't cost anything to leave existing code in place that might help someone who doesn't know they need it, does it? I'll bet those Linux distributors would love to have a UBUNTU_DEPLOYMENT_TARGET feature ;-) I mean REDHAT_DEPLOYMENT_TARGET, err ANDROID_.. oh well, that must be why they don't :-> |
The cost is not being able to use new APIs on OSX. |
|
[edited] local version = os.getenv "MACOSX_DEPLOYMENT_TARGET"
if version == nil then
local sw_version = io.popen("sw_vers -productVersion"):read("*l")
local versionminor = tonumber(sw_version and sw_version:match("^[^.]+%.([^.]+)")) or 3
if versionminor >= 10 then
version = "10.8"
elseif versionminor >= 5 then
version = "10.5"
else
version = sw_version
end
end
defaults.variables.CC = "env MACOSX_DEPLOYMENT_TARGET="..version.." gcc"
defaults.variables.LD = "env MACOSX_DEPLOYMENT_TARGET="..version.." gcc"? |
|
let's just change to env in LR2, but make the deployment target settable via rockspec somehow in LR3. |
Fair enough. |
|
Totally fine with me too :) |
|
Is there an LR3 TODO list we should track this on? |
|
@daurnimator, no but I've got a nice untested patch for the luarocks-3 branch which I'd love if you gave it a spin :) |
Sorry, I don't personally run a mac, I just debug other people's when they try and install my software... Misc comments:
|
These don't sound right to me, because of the time when they are evaluated.
This sounds like an option, but entails a lot more work (then people will feel entitled to write "windows >= vista" and expect it to work, too).
Why? They're specific to this function.
It's the best way to do it, for it to work for every build type. |
Actually... why shouldn't it? |
Are you submitting a patch with version checks for every supported OS? ;) Wonder what one would use for versioning Linux distros ;) (Seriously speaking now: OS version check for Linux is a terrible idea. One should keep versioning at a per library basis.) Anyway, we're drifting here. Since your issue and Gary's seem to be fixed by the env change, I'm closing this for now. |
I can if you want. Will you accept it? :)
Kernel version...
Yeah, most things actually need e.g. a libc new enough.
Fair enough to close the issue; the immediate issue of an invalid |
Probably so, if checks are not too hacky! :D |
|
I had a go at adding this tonight; but finding the right place to slot it in was tricky.
|
Note: the below is an email I sent to the luarocks list back on January 16 2015; but it got no replies.
I can't see it in the sourceforge archives: did it get stuck in some spam filter?
Currently luarocks uses a hack of defining
CC="export MACOSX_DEPLOYMENT_TARGET=10.<version>; gcc"Where
<version>maxes out at5.https://github.com/keplerproject/luarocks/blob/02eff158f095ed95cf3c889fb0e9c2efd06beeb9/src/luarocks/cfg.lua#L525
There are several problems with this:
CCas multiple commands breaks shell scripts; it should be only set to a single command to run.A workaround for this issue alone is to instead use:
env MACOSX_DEPLOYMENT_TARGET=10.<version> gccMACOSX_DEPLOYMENT_TARGETis needlessly limited to 10.5; Some features important features are only available in later targets.e.g.
__threadsupport is only available for 10.7 and above.MACOSX_DEPLOYMENT_TARGETisn't required in 10.5+(according to Luiz, June 2012)
I propose that we drop this
CC/LDhack completely, and if someone wants to compile for an old osx version (pre 2007), they can take the 5 seconds to configure their variables manually.Is someone perhaps more versed in OSX compilation able to say if this is a good/bad idea?
The text was updated successfully, but these errors were encountered: