premake / premake-core

Premake
https://premake.github.io/
BSD 3-Clause "New" or "Revised" License
3.22k stars 620 forks source link

macOS: --debugger fails to load luasocket #1158

Open youaresoomean opened 6 years ago

youaresoomean commented 6 years ago

Hi, i was very pleased to find out that mobdebug is now built-in premake. It works like a charm on windows. On macOS i am not able to get it working since i fails to load luasocket. I tried to rename libluasocket.dylib to vairous variants but it's never found/picked up:

Loading luasocket...
Error: [string "src/base/_foundation.lua"]:57: module 'luasocket' not found:
    no field package.preload['luasocket']
    no file '/usr/local/share/lua/5.3/luasocket.lua'
    no file '/usr/local/share/lua/5.3/luasocket/init.lua'
    no file '/usr/local/lib/lua/5.3/luasocket.lua'
    no file '/usr/local/lib/lua/5.3/luasocket/init.lua'
    no file './luasocket.lua'
    no file './luasocket/init.lua'
    no file '/usr/local/lib/lua/5.3/luasocket.so'
    no file '/usr/local/lib/lua/5.3/loadall.so'
    no file './luasocket.so'
redorav commented 6 years ago

@youaresoomean I integrated this but couldn't test on MacOS as I don't have a build environment set up. Out of interest did you build your own version of premake on the Mac or are you using alpha12? I'll see if I can find some time this weekend to look at it.

samsinsane commented 6 years ago

This looks relatively simple to resolve. Firstly, we'll need to update this so that it has a macOS branch, or update this to match the example (specifically, targetprefix and targetextension). Secondly, we'll need to swap these so that the debugger looks beside the Premake binary as well as the other locations.

The default C path is defined here. For non-Windows it boils down to: /usr/local/lib/lua/5.3/?.so;/usr/local/lib/lua/5.3/loadall.so;./?so". Given that we tend to shy away from modifying the 3rd party code, I'm not sure if we should use dylib even though it's the standard on macOS. @starkos @tdesveauxPKFX @tvandijck @TurkeyMan thoughts? If we support dylib we should probably add the C path again but with dylib instead of so, this will impact performance for loading binary modules on macOS.

youaresoomean commented 6 years ago

@redorav Thanks alot for the integration! Was extremely helpful when debugging actions on windows. Unfortunately our custom xcode action does not work with the recent version anymore so I tried to debug directly on macOS.

Built the binary on my own. Based on end-of-july snapshot of github/master.