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

Fail to build in Rust nightly #217

Open
qjerome opened this issue Oct 7, 2024 · 2 comments
Open

Fail to build in Rust nightly #217

qjerome opened this issue Oct 7, 2024 · 2 comments

Comments

@qjerome
Copy link
Contributor

qjerome commented Oct 7, 2024

Trying to build the project under Rust nightly fails with the following error

          >>> referenced by yara_x.1d0ae0f25a4d2322-cgu.05
          >>>               yara_x-0871b011ab05dce0.yara_x.1d0ae0f25a4d2322-cgu.05.rcgu.o:(yara_x::wasm::WASM_EXPORTS::h112242e6a917df1a) in archive project/target/x86_64-unknown-linux-gnu/debug/deps/libyara_x-0871b011ab05dce0.rlib
          >>> did you mean: __start_linkme_WASM_EXPORTS
          >>> defined in: <internal>
          >>> the encapsulation symbol needs to be retained under --gc-sections properly; consider -z nostart-stop-gc (see https://lld.llvm.org/ELF/start-stop-gc)
          
          rust-lld: error: undefined symbol: __stop_linkm2_WASM_EXPORTS
          >>> referenced by yara_x.1d0ae0f25a4d2322-cgu.05
          >>>               yara_x-0871b011ab05dce0.yara_x.1d0ae0f25a4d2322-cgu.05.rcgu.o:(yara_x::wasm::WASM_EXPORTS::h112242e6a917df1a) in archive project/target/x86_64-unknown-linux-gnu/debug/deps/libyara_x-0871b011ab05dce0.rlib
          >>> did you mean: __stop_linkme_WASM_EXPORTS
          >>> defined in: <internal>
          collect2: error: ld returned 1 exit status

Expected behaviour: not to fail when trying to build with Rust nightly

@qjerome
Copy link
Contributor Author

qjerome commented Oct 7, 2024

A workaround is to use RUSTFLAGS="-C link-args=-znostart-stop-gc" as mentioned in dtolnay/linkme#94

@qjerome
Copy link
Contributor Author

qjerome commented Oct 7, 2024

Proposal: create a build.rs script to build the library properly with rust nightly so that it doesn't explodes in the hands of the end user.

Update: it is not possible to create a build.rs in yara-x to solve this issue as this flag seems to be needed when building the end-project embedding yara-x.

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

No branches or pull requests

1 participant