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

Build failure: requires libc++ #65

Closed
0-wiz-0 opened this issue Feb 14, 2025 · 9 comments
Closed

Build failure: requires libc++ #65

0-wiz-0 opened this issue Feb 14, 2025 · 9 comments

Comments

@0-wiz-0
Copy link
Contributor

0-wiz-0 commented Feb 14, 2025

I was packaging ouch for pkgsrc and compiling ouch on NetBSD.
The build failed trying to link against libc++. NetBSD only provides libstdc++.

In the ouch bugreport a simple test was suggested to try if the problem is in unrar.rs, and the test seems to indicate that.

I'm not sure what the best fix is.
IIRC, libstdc++ is even automatically linked in when using the c++ binary to compile code, but I may be mistaken.

@muja
Copy link
Owner

muja commented Feb 18, 2025

Unfortunately I cannot reproduce this so I won't be able to fix it. Is there a docker image or something similar where the issue can be reproduced?
Otherwise I would suggest "trialing and erroring" with the build flags (which is exactly what I'd do), I personally have no idea which ones are necessary and which ones can be thrown out... the GitHub build matrix will find out any regressions.

@0-wiz-0
Copy link
Contributor Author

0-wiz-0 commented Feb 18, 2025

I fixed the build failure (of 'cargo test') on NetBSD with #66
I think the case for OpenBSD is also wrong; FreeBSD might be right or not, I'm not sure.

I get a couple test failures:

     Running tests/utf8.rs (target/debug/deps/utf8-14284d5dbd0a3e88)

running 7 tests
test unicode_list ... ok
test unicode_file ... FAILED
test unicode_extract_to ... FAILED
test extract_with_unicode_base ... FAILED
test unicode_entry_extract ... FAILED
test unicode_entry ... ok
test unicode_entry_process_mode ... ok

failures:

---- unicode_file stdout ----
thread 'unicode_file' panicked at tests/utf8.rs:12:84:
called `Result::unwrap()` on an `Err` value: EOpen@Open (Could not open archive)

---- unicode_extract_to stdout ----
thread 'unicode_extract_to' panicked at tests/utf8.rs:23:69:
read failed: Os { code: 2, kind: NotFound, message: "No such file or directory" }

---- extract_with_unicode_base stdout ----
thread 'extract_with_unicode_base' panicked at tests/utf8.rs:40:62:
read failed: Os { code: 2, kind: NotFound, message: "No such file or directory" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

---- unicode_entry_extract stdout ----
thread 'unicode_entry_extract' panicked at tests/utf8.rs:67:5:
assertion `left == right` failed
  left: "unicodefilename"
 right: "unicodefilename❤\u{fe0f}.txt"


failures:
    extract_with_unicode_base
    unicode_entry_extract
    unicode_extract_to
    unicode_file

test result: FAILED. 3 passed; 4 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

but it at least gets this far! Before it didn't even link.

@0-wiz-0
Copy link
Contributor Author

0-wiz-0 commented Feb 18, 2025

Btw, here is an example if you want to set up a NetBSD runner in github CI:
https://github.com/nih-at/libzip/blob/main/.github/workflows/bsd.yml
for a C project, it will need some adaptations for this rust project.

@muja muja closed this as completed in 8d29b6e Feb 19, 2025
@0-wiz-0
Copy link
Contributor Author

0-wiz-0 commented Feb 19, 2025

Thank you! Can I please have a new release with the fix included, so I can go back to ouch and let them pull in that version with the fix? :-)

@muja
Copy link
Owner

muja commented Feb 19, 2025

Thank you! Can I please have a new release with the fix included, so I can go back to ouch and let them pull in that version with the fix? :-)

Done, 0.5.8 is released

@0-wiz-0
Copy link
Contributor Author

0-wiz-0 commented Feb 19, 2025

Thank you!

@0-wiz-0
Copy link
Contributor Author

0-wiz-0 commented Feb 19, 2025

While the build of 0.5.8 itself works fine now, when I try using as a dependency, I still get the same link error.
This commit fixes it, but I guess you might need this on other operating systems and I don't know how to make it conditional. Any ideas?

@muja
Copy link
Owner

muja commented Feb 19, 2025

it's possible that you might have to run cargo update
I probably should've pinned [email protected] as a dependency, right now it's happy with any 0.5.x version i guess... does that help?

@0-wiz-0
Copy link
Contributor Author

0-wiz-0 commented Feb 19, 2025

Ah, that was it - thank you, I hadn't understood that this was split into multiple crates.

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

2 participants