Closed A1-Triard closed 4 years ago
Thanks so much for the report! I'll put this in ASAP. I've got a local FreeBSD VM that I can test this in, though I've not done any Rust development on FreeBSD (and am something of a Rust novice either way), so I might not be able to confirm it very quickly.
Any Rust feedback you can provide as you go along will be invaluable, by the way! Those Rust wrappers are very raw indeed.
on the way to reproducing this...
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("true")
CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
running: "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-Wall" "-Wextra" "-o" "/usr/home/dank/notcurses/rust/libnotcurses-sys/target/debug/build/libnotcurses-sys-54e73c7a48e88c61/out/stdout.o" "-c" "stdout.c"
exit code: 0
AR_x86_64-unknown-freebsd = None
AR_x86_64_unknown_freebsd = None
HOST_AR = None
AR = None
running: "ar" "crs" "/usr/home/dank/notcurses/rust/libnotcurses-sys/target/debug/build/libnotcurses-sys-54e73c7a48e88c61/out/libstdout.a" "/usr/home/dank/notcurses/rust/libnotcurses-sys/target/debug/build/libnotcurses-sys-54e73c7a48e88c61/out/stdout.o"
exit code: 0
cargo:rustc-link-lib=static=stdout
cargo:rustc-link-search=native=/usr/home/dank/notcurses/rust/libnotcurses-sys/target/debug/build/libnotcurses-sys-54e73c7a48e88c61/out
cargo:warning=couldn't execute `llvm-config --prefix` (error: No such file or directory (os error 2))
cargo:warning=set the LLVM_CONFIG_PATH environment variable to the full path to a valid `llvm-config` executable (including the executable itself)
--- stderr
wrapper.h:1:10: fatal error: 'notcurses/notcurses.h' file not found
wrapper.h:1:10: fatal error: 'notcurses/notcurses.h' file not found, err: true
thread 'main' panicked at 'Unable to generate bindings: ()', build.rs:23:20
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[freebsd](101) $
i'll continue to post updates
Compiling libloading v0.5.2
Compiling regex v1.3.9
Compiling cexpr v0.4.0
Compiling env_logger v0.7.1
Compiling libnotcurses-sys v1.6.1 (/usr/home/dank/notcurses/rust/libnotcurses-sys)
error: failed to run custom build command for `libnotcurses-sys v1.6.1 (/usr/home/dank/notcurses/rust/libnotcurses-sys)`
Caused by:
process didn't exit successfully: `/usr/home/dank/notcurses/rust/libnotcurses-sys/target/debug/build/libnotcurses-sys-fde5b65d24cb2836/build-script-build` (exit code: 101)
--- stdout
cargo:rerun-if-env-changed=NOTCURSES_NO_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG
cargo:rerun-if-env-changed=NOTCURSES_STATIC
cargo:rerun-if-env-changed=NOTCURSES_DYNAMIC
cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-unknown-freebsd
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_unknown_freebsd
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-unknown-freebsd
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_unknown_freebsd
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-freebsd
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_freebsd
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
--- stderr
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Failure { command: "\"pkg-config\" \"--libs\" \"--cflags\" \"notcurses\" \"notcurses >= 1.4.2\"", output: Output { status: ExitStatus(ExitStatus(256)), stdout: "", stderr: "Package notcurses was not found in the pkg-config search path.\nPerhaps you should add the directory containing `notcurses.pc\'\nto the PKG_CONFIG_PATH environment variable\nPackage \'notcurses\', required by \'virtual:world\', not found\nPackage \'notcurses\', required by \'virtual:world\', not found\n" } }', build.rs:8:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[freebsd](101) $
So I've got the pkgconfig in build.rs:
pkg_config::Config::new()
.atleast_version("1.6.1")
.probe("notcurses")
.unwrap();
I think the issue is that I'm possibly installing the pkgconfig files into the wrong place on FreeBSD (I'm also not using the results of this pkgconfig search, so far as I can tell, instead hand-coding -I ../../
).
It looks like FreeBSD wants .pc files in /usr/local/libdata/pkgconfig
, and we install them into /usr/local/lib/pkgconfig
:
[freebsd](1) $ find /usr/local/ -iname \*.pc | grep not
/usr/local/lib/pkgconfig/notcurses++.pc
/usr/local/lib/pkgconfig/notcurses.pc
[freebsd](0) $
Interestingly, our actual Port does install them to the proper location:
libdata/pkgconfig/notcurses++.pc
libdata/pkgconfig/notcurses.pc
so I'm guessing the Ports system's cmake config file sets an option that we're not supplying.
If I move those files to /usr/local/libdata/pkgconfig
, I reproduce the problem as reported by @A1-Triard :+1:
exit code: 0
AR_x86_64-unknown-freebsd = None
AR_x86_64_unknown_freebsd = None
HOST_AR = None
AR = None
running: "ar" "crs" "/usr/home/dank/notcurses/rust/libnotcurses-sys/target/debug/build/libnotcurses-sys-54e73c7a48e88c61/out/libstdout.a" "/usr/home/dank/notcurses/rust/libnotcurses-sys/target/debug/build/libnotcurses-sys-54e73c7a48e88c61/out/stdout.o"
exit code: 0
cargo:rustc-link-lib=static=stdout
cargo:rustc-link-search=native=/usr/home/dank/notcurses/rust/libnotcurses-sys/target/debug/build/libnotcurses-sys-54e73c7a48e88c61/out
--- stderr
wrapper.h:1:10: fatal error: 'notcurses/notcurses.h' file not found
wrapper.h:1:10: fatal error: 'notcurses/notcurses.h' file not found, err: true
thread 'main' panicked at 'Unable to generate bindings: ()', build.rs:23:20
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[freebsd](101) $
If I get past this, I run into:
Compiling parking_lot_core v0.7.2
Compiling parking_lot v0.10.2
Compiling serial_test_derive v0.4.0
Compiling serial_test v0.4.0
Compiling libnotcurses-sys v1.6.1 (/usr/home/dank/notcurses/rust/libnotcurses-sys)
error[E0412]: cannot find type `_IO_FILE` in this scope
--> src/lib.rs:72:34
|
72 | fn libc_stdout() -> *mut _IO_FILE;
| ^^^^^^^^ not found in this scope
error: aborting due to previous error
I'm now able to run cargo build
and cargo test
from within libnotcurses-sys
, so long as the .pc files are in /usr/local/libdata/pkgconfig
(as installed by the Port). I'm going to create a new bug about getting them installed in the right place, but I think the main issue that was giving you problems ought be handled.
I fixed #792, and believe the libnotcurses-sys
crate will now properly build.
[freebsd](0) $ cargo build
Compiling libnotcurses-sys v1.6.1 (/usr/home/dank/notcurses/rust/libnotcurses-sys)
warning: `extern` block uses type `u128`, which is not FFI-safe
--> /usr/home/dank/notcurses/rust/libnotcurses-sys/target/debug/build/libnotcurses-sys-54e73c7a48e88c61/out/bindings.rs:1846:70
|
1846 | pub fn wcstold(arg1: *const wchar_t, arg2: *mut *mut wchar_t) -> u128;
| ^^^^ not FFI-safe
|
= note: `#[warn(improper_ctypes)]` on by default
= note: 128-bit integers don't currently have a known stable ABI
warning: `extern` block uses type `u128`, which is not FFI-safe
--> /usr/home/dank/notcurses/rust/libnotcurses-sys/target/debug/build/libnotcurses-sys-54e73c7a48e88c61/out/bindings.rs:3090:10
|
3090 | ) -> u128;
| ^^^^ not FFI-safe
|
= note: 128-bit integers don't currently have a known stable ABI
warning: 2 warnings emitted
Finished dev [unoptimized + debuginfo] target(s) in 3.12s
[freebsd](0) $
The secondary notcurses
crate doesn't build unless you point the libnotcurses-sys
dep at a properly build version of the latter, but that is to be expected.
@A1-Triard, i believe this issue to be fixed. If you could test and verify, I'd be deeply appreciative. Thanks for the report!
@dankamongmen, I don't know how to check it without actual port updated :-(
@A1-Triard fair enough. I'm waiting on my update to the port to be reviewed (https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=247770), though that will only take FreeBSD to 1.6.1, and I believe I fixed this in 1.6.2 (not yet released). I've been testing with a source checkout on FreeBSD, where this seems to work.
I'm probably going to cut 1.6.2 shortly. Maybe I'll do it today. I'll push a Ports upgrade as soon as I have done so. Sorry about the delay :(. I'm going to mark this as fixed for now, as I'm pretty certain it is. If problems persist, please reopen it.
build.rs should use pkg-config for detecting correct include cflags.