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 on Mac fails finding static zlib #12

Open
ryanbreen opened this issue Oct 22, 2024 · 0 comments
Open

Build on Mac fails finding static zlib #12

ryanbreen opened this issue Oct 22, 2024 · 0 comments

Comments

@ryanbreen
Copy link

cargo build
   Compiling roead v1.0.0 (/Users/wrb/fun/code/roead)
error: could not find native static library `zlib`, perhaps an -L flag is missing?

error: could not compile `roead` (lib) due to 1 previous error

This is on:
Apple Silicon (M3 Max)
MacOS Sequoia 15.0.1
cargo 1.81.0
cmake (3.30.5) etc provided by homebrew, all up to date

More detailed output:

   Compiling roead v1.0.0 (/Users/wrb/fun/code/roead)
     Running `CARGO=/Users/wrb/.rustup/toolchains/stable-aarch64-apple-darwin/bin/cargo CARGO_CRATE_NAME=roead CARGO_MANIFEST_DIR=/Users/wrb/fun/code/roead CARGO_PKG_AUTHORS='Caleb Smith <c.smith@tuta.io>' CARGO_PKG_DESCRIPTION='Rust port of oead C++ library for common Nintendo formats' CARGO_PKG_HOMEPAGE='' CARGO_PKG_LICENSE=GPL-3.0-or-later CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=roead CARGO_PKG_README=README.md CARGO_PKG_REPOSITORY='https://github.com/NiceneNerd/roead' CARGO_PKG_RUST_VERSION=1.80 CARGO_PKG_VERSION=1.0.0 CARGO_PKG_VERSION_MAJOR=1 CARGO_PKG_VERSION_MINOR=0 CARGO_PKG_VERSION_PATCH=0 CARGO_PKG_VERSION_PRE='' CARGO_PRIMARY_PACKAGE=1 DYLD_FALLBACK_LIBRARY_PATH='/Users/wrb/fun/code/roead/target/debug/deps:/Users/wrb/.rustup/toolchains/stable-aarch64-apple-darwin/lib:/Users/wrb/lib:/usr/local/lib:/usr/lib' OUT_DIR=/Users/wrb/fun/code/roead/target/debug/build/roead-1f86214fc142874b/out /Users/wrb/.rustup/toolchains/stable-aarch64-apple-darwin/bin/rustc --crate-name roead --edition=2021 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=216 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C split-debuginfo=unpacked --warn=unexpected_cfgs --cfg 'feature="aamp"' --cfg 'feature="almost"' --cfg 'feature="binrw"' --cfg 'feature="byml"' --cfg 'feature="cxx"' --cfg 'feature="cxx-build"' --cfg 'feature="default"' --cfg 'feature="indexmap"' --cfg 'feature="num-integer"' --cfg 'feature="num-traits"' --cfg 'feature="sarc"' --cfg 'feature="serde"' --cfg 'feature="serde_json"' --cfg 'feature="yaz0"' --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values("aamp", "aamp-names", "almost", "base64", "binrw", "byml", "cxx", "cxx-build", "default", "indexmap", "lexical", "lexical-core", "num-integer", "num-traits", "parking_lot", "ryml", "sarc", "scc", "serde", "serde_json", "with-serde", "yaml", "yaz0"))' --check-cfg 'cfg(CHANNEL_NIGHTLY)' -C metadata=bf483a546d092cdc -C extra-filename=-bf483a546d092cdc --out-dir /Users/wrb/fun/code/roead/target/debug/deps -C incremental=/Users/wrb/fun/code/roead/target/debug/incremental -L dependency=/Users/wrb/fun/code/roead/target/debug/deps --extern almost=/Users/wrb/fun/code/roead/target/debug/deps/libalmost-b8b15f5c928418b1.rmeta --extern binrw=/Users/wrb/fun/code/roead/target/debug/deps/libbinrw-7e723390a1ed65c9.rmeta --extern cxx=/Users/wrb/fun/code/roead/target/debug/deps/libcxx-7619a95e526bbda1.rmeta --extern indexmap=/Users/wrb/fun/code/roead/target/debug/deps/libindexmap-f65f4448dffbd4e2.rmeta --extern join_str=/Users/wrb/fun/code/roead/target/debug/deps/libjoin_str-2c64a397a4243548.dylib --extern num_integer=/Users/wrb/fun/code/roead/target/debug/deps/libnum_integer-8c676987d151bfa7.rmeta --extern num_traits=/Users/wrb/fun/code/roead/target/debug/deps/libnum_traits-8a135097afa2e3ae.rmeta --extern rustc_hash=/Users/wrb/fun/code/roead/target/debug/deps/librustc_hash-e736f9ba2a8d0711.rmeta --extern serde=/Users/wrb/fun/code/roead/target/debug/deps/libserde-3a5eea5d68835869.rmeta --extern serde_json=/Users/wrb/fun/code/roead/target/debug/deps/libserde_json-2bfb4e11a969de2b.rmeta --extern smartstring=/Users/wrb/fun/code/roead/target/debug/deps/libsmartstring-d1b4a2e6b4b3e3ac.rmeta --extern thiserror=/Users/wrb/fun/code/roead/target/debug/deps/libthiserror-e9989f756f43bfcc.rmeta -L native=/Users/wrb/fun/code/roead/target/debug/build/roead-1f86214fc142874b/out -L native=/Users/wrb/fun/code/roead/lib/zlib-ng -l static=zlib -l static=roead -L native=/Users/wrb/fun/code/roead/target/debug/build/cxx-ea20074a926da7b2/out -L native=/Users/wrb/fun/code/roead/target/debug/build/link-cplusplus-83ed326ba6360fdd/out --cfg CHANNEL_STABLE --check-cfg 'cfg(CHANNEL_STABLE)'`
error: could not find native static library `zlib`, perhaps an -L flag is missing?

I've attempted to build the static zlib-ng after fetching that git submodule and configuring for compile:

cmake .
./configure
make

But that hits this compiler error:

make
gcc -O2  -std=c99 -Wall -DHAVE_VISIBILITY_HIDDEN -DHAVE_VISIBILITY_INTERNAL -DHAVE_BUILTIN_CTZL -DHAVE_SYS_SDT_H -DARM_GETAUXVAL  -DWITH_GZFILEOP -I/Users/wrb/fun/code/roead/lib/zlib-ng -c -o example.o /Users/wrb/fun/code/roead/lib/zlib-ng/test/example.c
/Users/wrb/fun/code/roead/lib/zlib-ng/test/example.c:63:88: error: too few arguments to function call, expected 6, have 4
   63 |     err = PREFIX(compress)(compr, &comprLen, (const unsigned char*)hello, (z_size_t)len);
      |           ~~~~~~~~~~~~~~~~                                                             ^
/Users/wrb/fun/code/roead/lib/zlib-ng/zlib-ng.h:1213:21: note: 'zng_compress' declared here
 1213 | ZEXTERN ZEXPORT int zng_compress(unsigned char* dest, size_t* destLen, const unsigned char* source,
      |                     ^            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1214 |                                  size_t sourceLen, handle_match_func handle_match,
      |                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1215 |                                  void* handle_match_userdata);
      |                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make: *** [example.o] Error 1

Not sure if that's the root cause, though, or whether I made some mistake in my cmake / configure / make commands or have some missing dependencies.

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