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

Failing to build on NetBSD #221

Closed
pfr-dev opened this issue Jul 14, 2020 · 15 comments
Closed

Failing to build on NetBSD #221

pfr-dev opened this issue Jul 14, 2020 · 15 comments

Comments

@pfr-dev
Copy link

pfr-dev commented Jul 14, 2020

Hopefully someone running ncspot on OpenBSD can help me here. I'm really keen to get this working on my NetBSD machine but I get a build error:

$ cargo run --no-default-features --features portaudio_backend,cursive/pancurses-backend 
...
error: failed to run custom build command for `ncurses v5.99.0`

Caused by:
  process didn't exit successfully: `/home/dave/Downloads/ncspot/target/debug/build/ncurses-cca56809b8b206f2/build-script-build` (exit code: 101)
--- stdout
cargo:rerun-if-env-changed=PKG_CONFIG_PATH
cargo:rustc-link-lib=ncursesw
OPT_LEVEL = Some("0")
TARGET = Some("x86_64-unknown-netbsd")
HOST = Some("x86_64-unknown-netbsd")
CC_x86_64-unknown-netbsd = None
CC_x86_64_unknown_netbsd = None
HOST_CC = None
CC = None
CFLAGS_x86_64-unknown-netbsd = None
CFLAGS_x86_64_unknown_netbsd = None
HOST_CFLAGS = None
CFLAGS = None
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("true")
CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")

--- stderr
/home/dave/Downloads/ncspot/target/debug/build/ncurses-c07513f36080cdf7/out/chtype_size.c:6:10: fatal error: ncurses.h: No such file or directory
 #include <ncurses.h>
          ^~~~~~~~~~~
compilation terminated.
thread 'main' panicked at 'assertion failed: command.status().expect("compilation failed").success()', /home/dave/.cargo/registry/src/github.com-1ecc6299db9ec823/ncurses-5.99.0/build.rs:105:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

warning: build failed, waiting for other jobs to finish...
error: build failed

Poraudio & ncurses are installed

$ pkgin list | grep portaudio                                                            
portaudio-190600.20161030nb5 Portable cross-platform audio API
$ pkgin list | grep ncurses                                                              
ncurses-6.2nb2       CRT screen handling and optimization package
@natejank
Copy link

While I'm not running NetBSD, but I think I might have a solution. I'm not sure if the situation is different for you, but on my system (Fedora) you need different packages compile ncurses programs from the ones you need to run them. For me those packages are ncurses for running them and ncurses-devel for compiling them.

@hrkfdn
Copy link
Owner

hrkfdn commented Jul 22, 2020

Do you have pkg-config installed?

@pfr-dev
Copy link
Author

pfr-dev commented Jul 22, 2020

While I'm not running NetBSD, but I think I might have a solution. I'm not sure if the situation is different for you, but on my system (Fedora) you need different packages compile ncurses programs from the ones you need to run them. For me those packages are ncurses for running them and ncurses-devel for compiling them.

AFAIK NetBSD does not split packages, i.e. development headers are included in the packages.

Do you have pkg-config installed?

$ pkgin list | grep pkg-config 
pkgconf-1.6.0        API-driven pkg-config replacement

@pfr-dev
Copy link
Author

pfr-dev commented Jul 23, 2020

FYI if anyone is interested, Pin (total champ) has pushed this to pkgsrc-wip where hopefully someone will figure it out.

@pfr-dev
Copy link
Author

pfr-dev commented Aug 17, 2020

UPDATE: Tobias Nygren worked his magic and got it working. Still currently in pkgsrc-wip for now.

However, some strange characters displaying ... Why?

08-17-2020-18-55

@ghost
Copy link

ghost commented Aug 17, 2020

@hrkfdn Do you have any suggestions to what might be causing this?

I was the one packaging ncspot for NetBSD with the valuble help of tnn as already mentioned, but I would like to know why this is happening before importing the package to pkgsrc. TIA.
/pin

@hrkfdn
Copy link
Owner

hrkfdn commented Aug 18, 2020

Nice work! Hmm, it looks like it's having problems with the special characters (bars, dotted lines, etc.).

Are you running this in an UTF-8 capable environment? You could also try the ncurses-backend instead of pancurses.

@ghost
Copy link

ghost commented Aug 19, 2020

Nice work!

Thanks!

Are you running this in an UTF-8 capable environment?

Probably not. NetBSD supports too many old archs where enabling it by dafault would not be adviseble. It can be enabled though. @Ramiferous, please try enabling it.

You could also try the ncurses-backend

You mean patching Cargo.toml, change the default backend and re-compiling, right?
NetBSD splitsncurses in two packages, ncurses and ncursesw, where w stands for wide. I wonder what the syntax should be to get it right... But, hopefully enabling UTF-8 will be enough.
Thanks for your reply and hint.

@hrkfdn
Copy link
Owner

hrkfdn commented Aug 19, 2020

Yes, you can select the backend in Cargo.toml. These are available: https://github.com/gyscos/Cursive/wiki/Backends

@ghost
Copy link

ghost commented Aug 19, 2020

@Ramiferous please enable unicode and test. If this does not work, I'll patch it. Thx!

@ghost
Copy link

ghost commented Aug 20, 2020

ncspot has been imported into pkgsrc.
Feel free to close this issue.

@hrkfdn
Copy link
Owner

hrkfdn commented Aug 20, 2020

Awesome, out of curiosity: how was the issue with the incorrectly displayed characters fixed?

@hrkfdn hrkfdn closed this as completed Aug 20, 2020
@ghost
Copy link

ghost commented Aug 20, 2020

Awesome, out of curiosity: how was the issue with the incorrectly displayed characters fixed?

It hasn't really, I don't have a Spotify account, but I'm convinced its an UTF-8 issue.
I've decided to import the package and if it happens to someone else, take it from there.

@Ramiferous also said the software has been working fine for him otherwise.

@pfr-dev
Copy link
Author

pfr-dev commented Aug 20, 2020

As Pin said, I couldn't get UTF-8 supported working on NetBSD yet. Will keep trying and once resolved will report back here.

I had a thought though, is it possible to implement an option for no UTF-8 support and to just use normal text symbols in their place? a kind of fallback mode if you will? I don't really need the fancy characters, but I'd like it to look neat at least.

@pfr-dev
Copy link
Author

pfr-dev commented Aug 22, 2020

Update & ust an FYI incase anyone's interested. It appears that is not a problem with NetBSD not supporting UTF-8 but rather an issue with cursive on NetBSD. See the issue raised here:
gyscos/cursive#494

This all began here:
https://www.unitedbsd.com/d/233-spotify/44

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Aug 23, 2020
hrkfdn added a commit that referenced this issue Aug 29, 2020
* Use libc for setlocale() to fix non-ASCII

character printing.
#221

* move string instantiation outside unsafe block

update libc crate while at it

Co-authored-by: Henrik Friedrichsen <henrik@affekt.org>
mtshrmn pushed a commit to mtshrmn/ncspot that referenced this issue Sep 8, 2020
* Use libc for setlocale() to fix non-ASCII

character printing.
hrkfdn#221

* move string instantiation outside unsafe block

update libc crate while at it

Co-authored-by: Henrik Friedrichsen <henrik@affekt.org>
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

3 participants