Skip to content
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

Fix shell argument limit #1731

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ze2j
Copy link

@ze2j ze2j commented Mar 6, 2025

Fix 1729

Tested on Linux only.

Note: I didn't manage to remove the ar command print in non verbose builds.
output

@ze2j ze2j requested a review from a team as a code owner March 6, 2025 12:41
@@ -162,6 +163,23 @@ def scons_generate_bindings(target, source, env):
return None


def _build_static_lib_with_rsp(target, source, env):
target_lib = str(target[0])
rsp_fd, rsp_path = tempfile.mkstemp(suffix=".rsp")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason you aren't using with TemporaryFile(suffix=".rsp") as rsp_file? Using that would allow you to skip the finally step of clean up because it cleans up after itself.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a left over of a bad example I copy pasted during my experimentations. Will fix, nice catch!

@enetheru
Copy link
Collaborator

enetheru commented Mar 6, 2025

aww linux only, i was hoping to test it for msys and mingw on windows see if it helps mingw link times at all(unlikely)

@dsnopek
Copy link
Collaborator

dsnopek commented Mar 6, 2025

Thanks for starting on a PR for this!

This should work on MSYS with mingw, since I think it uses GNU binutils. And, I'm not sure this will work on Linux if using ar from LLVM. So, I suspect specifically targeting this to Linux isn't the right way to go, I think we probably want to check for ar from GNU binutils.

Have you tried building on other platforms? I suspect this is a problem on Windows and MacOS too, and, in fact, my guess would be that Windows has a smaller limit than Linux.

Ideally, any solution to this would address all platforms and tool chains - unless this isn't a problem on other platforms and tool chains

@enetheru
Copy link
Collaborator

enetheru commented Mar 6, 2025

I'm not sure this will work on Linux if using ar from LLVM.

https://llvm.org/docs/CommandGuide/llvm-ar.html

@<FILE>

    Read command-line options and commands from response file <FILE>.

@dsnopek
Copy link
Collaborator

dsnopek commented Mar 6, 2025

https://llvm.org/docs/CommandGuide/llvm-ar.html

@enetheru Oh, awesome, thanks for looking that up!

I guess this means it'll work when building for Android too, because I think the Android tool chain uses clang

@ze2j ze2j force-pushed the fix_shell_argument_limit branch from 13cf09a to 5458596 Compare March 7, 2025 12:23
@ze2j
Copy link
Author

ze2j commented Mar 7, 2025

I made the suggested fixes and included MinGW.

@dsnopek I’ve only ever built my project on Linux, so I’m not sure if this issue can be reproduced on other platforms. Windows seems to have an 8192 limit, so my guess is that there’s no issue.

I took a very pragmatic approach here, but if you prefer a more general one, I won’t be offended if you decide to close this PR. I won’t be able to spend time implementing a more general solution, but I can help test it on my project if someone comes up with one.

@enetheru
Copy link
Collaborator

enetheru commented Mar 8, 2025

I can't get the test integration compiling for mingw64 but everything else appears to work.

@ze2j
Copy link
Author

ze2j commented Mar 9, 2025

@enetheru Should I drop the mingw inclusion or there is still some hope to make it work?

@enetheru
Copy link
Collaborator

enetheru commented Mar 9, 2025

I'm not very experienced on the scons side, perhaps someone else can test? but if it's going to block merging I would drop it as it's not required to fix your issue yeah?

@enetheru enetheru added the topic:buildsystem Related to the buildsystem or CI setup label Mar 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic:buildsystem Related to the buildsystem or CI setup
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot build my GDExtension with Godot 4.4
4 participants