-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
go native: Add support for linking static libs #9063
Conversation
This would be nice to add. |
Would it make sense to do this by simple extending e.g.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just tried running this on the Helm project and am getting /usr/local/bin/compile_native_go_fuzzer: line 33: ADDITIONAL_LIBS: unbound variable
Does what David suggest above solve your problem?
@DavidKorczynski I tried a few approaches: The only way I got this to work was to pass on the statically built lib as the last arg. For the fuzzing we don't really activate the execution paths that touch libgit2, so maybe we could even ignore undefined symbols. But I could not get that to work when building the fuzzers. |
@AdamKorcz I now ensure that the new var has a default value. With the latest, this seem to work against fluxcd and helm. For flux I tested this in combination with other changes I am submitting to the project. |
Some specific projects (FluxCD) may require the linking of static libraries. The new environment variable ADDITIONAL_LIBS enables multiple space separated libs to be linked. Signed-off-by: Paulo Gomes <pjbgf@linux.com>
Sounds good -- I'll give it a try shortly |
@DavidKorczynski thank you. For a quicker test, you may want to leave only The location for the lib we depend on is: |
Thanks @pjbgf -- I think I have a solution. If you add this to your
Add it right after
The problem is indeed the ordering of statically compiled libraries matter. Ideally, |
@pjbgf my testing just finished and the build passed using the above |
@pjbgf just to clarify on the above logic, the key thing I did was add the libgit2.a logic from the source controller and then the following line to include it in the native go fuzzer compilation: |
@DavidKorczynski that's brilliant, thank you very much. I will give this a try right away. |
@DavidKorczynski it all worked, thank you very much for your help. I am making the required changes on the repositories, once they are merged we should be able to retest the other PR. Therefore I will close this as no longer needed. |
That's great @pjbgf -- thanks for the patience and hints too! That said, it may be useful to have $LIB_FUZZING_ENGINE after $fuzzer.a in the compile_native_go_fuzzer as it adds a level of flexibility when having to deal with problems of ordering. I guess we don't have to do anything atm, but if it becomes an issue then ping and we can fix it |
Some specific projects (FluxCD) may require the linking of static libraries. The new environment variable
ADDITIONAL_LIBS
enables multiple space separated libs to be linked.This is to remove the current hack within the Flux project that enables the linking of
libgit2.a
during fuzz compilation.