- Notifications
You must be signed in to change notification settings - Fork2.5k
cli: fix undefined alloca() on CYGWIN#7022
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Merged
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
I tried to build my libgit2-1.9.0 package for CYGWIN but I got an error. This message appears when compiling:[199/671] Building C object src/cli/CMakeFiles/git2_cli.dir/opt.c.olibgit2-1.9.0/src/cli/opt.c: In function ‘cli_opt_parse’:libgit2-1.9.0/src/cli/opt.c:564:23: warning: implicit declaration of function ‘alloca’; did you mean ‘malloc’? [-Wimplicit-function-declaration] 564 | given_specs = alloca(sizeof(const cli_opt_spec *) * (args_len + 1)); | ^~~~~~ | mallocand later the linker emits this error message:[668/671] Linking C executable git2.exeFAILED: git2.exe/usr/x86_64-pc-cygwin/bin/ld: src/cli/CMakeFiles/git2_cli.dir/opt.c.o: in function `cli_opt_parse':/usr/src/debug/libgit2-1.9.0-1/src/cli/opt.c:564:(.text+0xce3): undefined reference to `alloca'collect2: error: ld returned 1 exit statusThe error is fixed by adding alloca.h to included headers.Hopefully, opt.c already allows to add alloca.h for some platforms, so I just added an additional test for the preprocessor for checking if the target is CYGWIN.
9046535
intolibgit2:main 19 checks passed
Uh oh!
There was an error while loading.Please reload this page.
Thanks! |
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I tried to build my libgit2-1.9.0 package for CYGWIN but I got an error.
This message appears when compiling:
and later the linker emits this error message:
The error is fixed by adding
alloca.h
to included headers.Hopefully,
opt.c
already allows to addalloca.h
for some platforms, so I just added an additional test for the preprocessor for checking if the target is CYGWIN.