luarocks / hererocks

Python script for installing Lua/LuaJIT and LuaRocks into a local directory
MIT License
71 stars 12 forks source link

macos error: Makefile:319: *** missing: export MACOSX_DEPLOYMENT_TARGET=XX.YY. Stop. #31

Closed tenturestept closed 5 months ago

tenturestept commented 5 months ago

an error when building luajit:

python3 ~/Downloads/hererocks.py --verbose test --compat none -j @v2.1 --patch -r latest
Cloning LuaJIT from https://github.com/LuaJIT/LuaJIT @v2.1 (cached)
Running git rev-parse --quiet --verify v2.1
d06beb0480c5d1eb53b3343e78063950275aa281
Running git checkout v2.1
Already on 'v2.1'
Your branch is up to date with 'origin/v2.1'.
Running git symbolic-ref -q HEAD
refs/heads/v2.1
Running git pull --rebase
Already up to date.
Running git rev-parse HEAD
d06beb0480c5d1eb53b3343e78063950275aa281
Building LuaJIT @d06beb0
Running make
==== Building LuaJIT 2.1 ====
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C src
Makefile:319: *** missing: export MACOSX_DEPLOYMENT_TARGET=XX.YY.  Stop.
make: *** [default] Error 2
Error: got exitcode 2 from command make
hishamhm commented 5 months ago

Makefile:319: *** missing: export MACOSX_DEPLOYMENT_TARGET=XX.YY. Stop.

try running the command export MACOSX_DEPLOYMENT_TARGET=XX.YY for your XX.YY version of macOS first?

hishamhm commented 5 months ago

@un-def if the LuaJIT rolling release is now requiring this, perhaps it can be automatically set if not already present?

A tricky thing is that this defines the lowest macOS version the generated binaries are compatible with, and this affects the available system APIs.

I think Lua modules can set their own deployment target (people have contributed a feature so that Mac-specific rockspecs can set that value, so that seems to be the case), so possibly one could set thins to the lowest value that still builds luajit on a modern system.

According to the LuaRocks source code, you can check the running version with sw_vers -productVersion (so it needs to be no greater than that). This is how LuaRocks picks its default, people haven't complained lately:

      local version = util.popen_read("sw_vers -productVersion")
      if not (version:match("^%d+%.%d+%.%d+$") or version:match("^%d+%.%d+$")) then
         version = "10.3"
      end
      version = vers.parse_version(version)
      if version >= vers.parse_version("11.0") then
         version = vers.parse_version("11.0")
      elseif version >= vers.parse_version("10.10") then
         version = vers.parse_version("10.8")
      elseif version >= vers.parse_version("10.5") then
         version = vers.parse_version("10.5")
      else
         -- interesting, but at this point supporting macOS < 10.5
         -- falls under retrocomputing :)
         defaults.gcc_rpath = false
      end
un-def commented 5 months ago

This is not related to rolling release changes, this env variable has always been required. On CI I used some artibrary value: https://github.com/luarocks/hererocks/blob/c5f78495359f766bea2ca6f7ca5bcc74a4108447/.github/workflows/test.yml#L40

I think we can do the following:

I don't have a macOS device at hand, I'll check later and make a PR.

un-def commented 5 months ago

Is this LuaJIT-specific, or PUC-Rio Lua requires MACOSX_DEPLOYMENT_TARGET as well?

tenturestept commented 5 months ago

Makefile:319: *** missing: export MACOSX_DEPLOYMENT_TARGET=XX.YY. Stop.

try running the command export MACOSX_DEPLOYMENT_TARGET=XX.YY for your XX.YY version of macOS first?

yes that works

Is this LuaJIT-specific, or PUC-Rio Lua requires MACOSX_DEPLOYMENT_TARGET as well?

this is luajit-specific

un-def commented 5 months ago

@tenturestept could you check again with a fresh copy of hererocks.py, please? The variable is set automatically now, you don't need to export MACOSX_DEPLOYMENT_TARGET=XX.YY anymore.

tenturestept commented 5 months ago

Yep it works!