Repository navigation
Why is the LuaJIT vcpkg port so complicated? #49521
Replies: 6 comments 12 replies
|
+1 Been having problems with the vcpkg luajit port for unknown reasons on macOS and debugging why has been very weedy. Haven't raised an issue as no root cause has been identified. Using a simpler custom port works (OpenMW/openmw-deps-build@ca07558 example) so it's something with the vcpkg luajit port specifically that's causing macOS run-time failures and...why is hard to figure out. One salient example of how simply using vcpkg settings would make things simpler is the fact that this https://github.com/microsoft/vcpkg/blob/master/ports/luajit/003-do-not-set-macosx-deployment-target.patch could be replaced with just setting it to https://learn.microsoft.com/en-us/vcpkg/users/triplets#vcpkg_osx_deployment_target for example. |
|
You could take a look at https://github.com/microsoft/vcpkg/pulls?q=is%3Apr+luajit+is%3Aclosed+in%3Atitle. The luajit port is complicated because its "pretty straightforward" build system is incompatible with vcpkg principle of "host binaries in the host triplet" and the resulting strict build order. Cf. #30608 (comment): The build needs a host tool to determine target properties to build the next host tool. In vcpkg, host artifacts cannot depend on target artifacts. Ignoring the vcpkg triplet separation isn't an option for ports in the curated registry. #30608 is also the PR labeled "Use common build functions". The reason is not a bureaucracy exercise, but the fact that these functions are the primary, carefully maintained facility to determine tools, flags, and environment variables based on detected properties of the CMake toolchain. Most of the properties are passed to configure, not build, so the port got a trivial script to capture the configuration in a Makefile which takes care of the actual build time enviroment variables. This is a significant simplification with regard to portability and build types. arm64-windows might simply work in a native build after a port update. However vcpkg CI doesn't offer native arm64 windows builds, so the success would need to be verified outside vcpkg CI. It might also be possible to add polyfill to help with arm64-on-x64 builds, such as preconfigured
Good reporting of problems is an indication of interest in improvments. (Admittedly, I check issues and discussions only occassionally. To many bad reports for my free time.) |
|
I have looked at all of that before posting this, and I'm unconvinced that what you're saying matches reality. The current port looks more like theatre to give the impression of the goals you're describing being achieved rather than something that achieves those goals because the goals don't seem to have been achieved. None of the cross-compilation attempts we've made have worked, even trivial ones like building As far as we can tell, some of the native triplets checked in CI do not produce a build that actually runs. Initially, we thought we were somehow using something incorrectly, but we've eliminated every possibility other than that the Mac build wouldn't work for anyone and hasn't been tested. Before #30608, the blame would have clearly been on the upstream build system, and we know that works, so it seems from our end like #30608 broke Macs. The port is more fragile than the upstream build system so updating the port to support new things that work upstream isn't as simple as just changing the commit it refers to. It's calling into the upstream makefile, but with variables pre-set in undocumented and unsupported ways, so there's no reason why Mike Pall would ensure that they're still interpreted the same way and used for the same things. This makes it much harder for anyone who has problems with the vcpkg port to try and fix it themselves, or even do basic troubleshooting like working out if they're hitting an upstream problem that upstream LuaJIT has fixed, or something specific to how vcpkg is packaging it. This kind of thing means that users of the vcpkg port (or people who want to become users of the port) don't have the tools to create good issue reports. There's not really a middle ground between I tried using the vcpkg port and now my application crashes but I don't know why and I have investigated the LuaJIT vcpkg port so thoroughly that I think I'm qualified to take over maintenance, and the journey from one to the other involves making stressed-out discussions posts. I don't like being on the receiving end of this doesn't work and I don't know why reports, so I don't like submitting them. Otherwise, you'd probably have had several by now.
What you're describing is an exercise in bureaucracy. Not every project has a build system with a distinct build and configure step, and vcpkg forcing that convention upon them is a decision made by a human rather than a fundamental technical limitation with how computers work. Fundamentally, it seems to me like the only viable route to a maintainable LuaJIT port is to campaign for the vcpkg rules to be changed, or at least for an exception to be carved out for this package. I can't see how the current rules are doing this particular package more good than harm, and rules that mainly do harm are bad and should be abolished. |
|
FYI #49565 introduces a simple test port. |
|
I've got some build flags that are definitely different that might be causing the problems when using the same LuaJIT commit. If I pick a file, I'm seeing the upstream build system do: whereas the vcpkg port does so obviously:
There are possibly other files with more differences, but they don't stand out in my diff compared to the files that get built in a different order or skipped altogether. |
|
I'm currently working on a project where I also have a lot of heavy assembly file and my buildsytem of choice was plain make. It wins CMake in such scenarios, where portability and low-level control of build flow is important. Even though I think cmake is cool, it's just not applicable sometimes. Somehow I found this discussion and feel like it could be related. I'm also trying to make a port for vcpkg. I'd say it's gets complicated to get something non-cmake-ish working with it. There is so much things to be worked around. I think there should be some kind of official way to porting/supporting such kind of libraries. |
Uh oh!
There was an error while loading. Please reload this page.
The upstream build system is pretty straightforward - if using GCC or Clang, you run a makefile (potentially with some environment variables set), and if using MSVC, you run a batch file (again, potentially with some environment variables set). It figures out the host details based on some sensible defaults and the environment variables, and if the right environment variables are set to specify a different target, it figures out the target details based on sensible defaults and the environment variables. This seems to work for every platform that LuaJIT supports, and as an assembly-heavy project, it's not going to work anywhere that upstream doesn't support.
Without knowing the details as to why it doesn't, I'd have expected the vcpkg port to set the environment variables the upstream build system uses based on the triplet settings (and any general vcpkg settings, e.g. using
/Z7for Debug and Release with MSVC instead of/Zifor just Debug) and called either the Makefile or batch file from upstream once for Debug and once for Release.Instead, the port jumps through an awful lot of hoops to set things up that the upstream build system would have dealt with itself before eventually calling into it anyway. This seems to lead to some problems, e.g. Windows Arm builds don't work, despite being supported upstream, and might be the root cause of other problems we've hit, but it makes investigating that much harder as it's a nuisance to try and find out exactly how the vcpkg port has been built differently to an upstream build.
The closest thing I can find to an answer is that maybe someone decided they had to have a
configurescript so they could callvcpkg_configure_makebeforevcpkg_build_make, like the docs suggest, even though upstream doesn't have aconfigurescript as its build system is controlled by build-time environment variables. If so, that would be bureaucracy rather than a technical reason, and would suggest that a rule needs to change to fit the real world rather than making the port unnecessarily complicated.All reactions