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

Add env var to select c++ std lib #56

Merged
merged 2 commits into from
Jan 16, 2020
Merged

Conversation

jfoote
Copy link
Contributor

@jfoote jfoote commented Jan 15, 2020

Apologies in advance for this hack job.

As part of bytecodealliance/wasmtime#611 I am building wasmtime fuzz targets in the google/oss-fuzz build container. This environment supplies the LLVM c++ standard library rather than the GCC one. It is specified in CXXFLAGS and presumably linked in the version of libfuzzer they supplied (libFuzzingEngine.a).

It looks like rust-fuzz/libfuzzer currently links the GCC standard library when using an external libfuzzer library, which causes a linker error when linking in the oss-fuzz compilation environment.

This PR adds an environment variable that lets the user select whether they'd like to link the GCC c++ standard library (the default, for backward compatibility), the installed (LLVM) c++ standard library, or not link one at all. If you'd rather control this another way or do something different please feel free.

I wasn't able to easily test rust-fuzz/libfuzzer with the wasmtime fuzz targets due to an incompatibility with the arbitrary crate; I didn't attempt to resolve this as part of this PR. I smoke-tested this change by using an old version of libfuzzer, before arbitrary was upgraded (actually 0c45075, the last functional commit made to rust-fuzz/libfuzzer-sys, which is what I was developing against before I realized it was deprecated : ).

Please let me know how you'd like to proceed -- thanks!

Copy link
Member

@fitzgen fitzgen left a comment

Choose a reason for hiding this comment

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

Thanks @jfoote!

One little tweak (see below) and I think this is good to land.

build.rs Outdated Show resolved Hide resolved
@jfoote
Copy link
Contributor Author

jfoote commented Jan 16, 2020

Thanks @fitzgen! Fixed. Your patch works verbatim.

Copy link
Member

@fitzgen fitzgen left a comment

Choose a reason for hiding this comment

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

Awesome, thanks!

@fitzgen fitzgen merged commit ce97662 into rust-fuzz:master Jan 16, 2020
@fitzgen
Copy link
Member

fitzgen commented Jan 16, 2020

Published 0.2.1 with this change!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants