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

ncurses support? #6

Open
097115 opened this issue Dec 6, 2021 · 2 comments
Open

ncurses support? #6

097115 opened this issue Dec 6, 2021 · 2 comments

Comments

@097115
Copy link

097115 commented Dec 6, 2021

Is it possible to use your image for cross-compilig a project that uses ncurses?

I tried issuing apt-get install libncurses5-dev libncursesw5-dev (in my CI @ GitLab) but it failed with: the following:

$ apt-get install libncurses5 libncurses5-dev libncursesw5-dev
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package libncurses5
E: Unable to locate package libncurses5-dev
E: Unable to locate package libncursesw5-dev

Would be grateful for some advice :)

@joseluisq
Copy link
Owner

I did pick up the Hello World example and with this below it compiles only for Linux (dynamically linked) binary.

root@98c165d333de:~/src# apt-get update
# Get:1 http://security.debian.org/debian-security bullseye-security InRelease [44.1 kB]
# Get:2 http://deb.debian.org/debian bullseye InRelease [116 kB]
# Get:3 http://deb.debian.org/debian bullseye-updates InRelease [39.4 kB]
# Get:4 http://security.debian.org/debian-security bullseye-security/main amd64 Packages [97.5 kB]
# Get:5 http://deb.debian.org/debian bullseye/main amd64 Packages [8180 kB]
# Get:6 http://deb.debian.org/debian bullseye-updates/main amd64 Packages [2592 B]
# Fetched 8479 kB in 3s (2866 kB/s)                         
root@98c165d333de:~/src# apt-get install libc-dev libncurses-dev libncursesw6 ncurses-base
# Reading package lists... Donecurses-dev libncursesw6 ncurses-base
# Reading package lists... Done
# Building dependency tree... Done
# Reading state information... Done
# Note, selecting 'libc6-dev' instead of 'libc-dev'
# libc6-dev is already the newest version (2.31-13+deb11u2).
# libc6-dev set to manually installed.
# libncursesw6 is already the newest version (6.2+20201114-2).
# libncursesw6 set to manually installed.
# ncurses-base is already the newest version (6.2+20201114-2).
# ncurses-base set to manually installed.
# Suggested packages:
#   ncurses-doc
# The following NEW packages will be installed:
#   libncurses-dev
# 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
# Need to get 344 kB of archives.
# After this operation, 2407 kB of additional disk space will be used.
# Do you want to continue? [Y/n] y
# Get:1 http://deb.debian.org/debian bullseye/main amd64 libncurses-dev amd64 6.2+20201114-2 [344 kB]
# Fetched 344 kB in 0s (1339 kB/s)      
# debconf: delaying package configuration, since apt-utils is not installed
# Selecting previously unselected package libncurses-dev:amd64.
# (Reading database ... 19895 files and directories currently installed.)
# Preparing to unpack .../libncurses-dev_6.2+20201114-2_amd64.deb ...
# Unpacking libncurses-dev:amd64 (6.2+20201114-2) ...
# Setting up libncurses-dev:amd64 (6.2+20201114-2) ...
root@98c165d333de:~/src# CC=o64-clang CXX=o64-clang++ \
    cargo build --verbose --release --target=x86_64-unknown-linux-gnu 
#   Compiling cc v1.0.72
#   Compiling libc v0.2.109
#   Compiling pkg-config v0.3.23
#     Running `rustc --crate-name build_script_build /root/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.109/build.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debug-assertions=off --cfg 'feature="default"' --cfg 'feature="std"' -C metadata=827aeb01c32c5acb -C extra-filename=-827aeb01c32c5acb --out-dir /root/src/target/release/build/libc-827aeb01c32c5acb -L dependency=/root/src/target/release/deps --cap-lints allow`
#     Running `rustc --crate-name pkg_config /root/.cargo/registry/src/github.com-1ecc6299db9ec823/pkg-config-0.3.23/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debug-assertions=off -C metadata=ee5a0a1751b50362 -C extra-filename=-ee5a0a1751b50362 --out-dir /root/src/target/release/deps -L dependency=/root/src/target/release/deps --cap-lints allow`
#     Running `rustc --crate-name cc --edition=2018 /root/.cargo/registry/src/github.com-1ecc6299db9ec823/cc-1.0.72/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debug-assertions=off -C metadata=facab8ecbf9ea3b4 -C extra-filename=-facab8ecbf9ea3b4 --out-dir /root/src/target/release/deps -L dependency=/root/src/target/release/deps --cap-lints allow`
#     Running `/root/src/target/release/build/libc-827aeb01c32c5acb/build-script-build`
#     Running `rustc --crate-name libc /root/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.109/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C linker-plugin-lto --cfg 'feature="default"' --cfg 'feature="std"' -C metadata=b61d92c8da6ac69f -C extra-filename=-b61d92c8da6ac69f --out-dir /root/src/target/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/root/src/target/x86_64-unknown-linux-gnu/release/deps -L dependency=/root/src/target/release/deps --cap-lints allow --cfg freebsd11 --cfg libc_priv_mod_use --cfg libc_union --cfg libc_const_size_of --cfg libc_align --cfg libc_core_cvoid --cfg libc_packedN --cfg libc_cfg_target_vendor --cfg libc_non_exhaustive --cfg libc_ptr_addr_of`
#   Compiling ncurses v5.101.0
#     Running `rustc --crate-name build_script_build /root/.cargo/registry/src/github.com-1ecc6299db9ec823/ncurses-5.101.0/build.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debug-assertions=off --cfg 'feature="default"' -C metadata=15097c1fbbdb97fb -C extra-filename=-15097c1fbbdb97fb --out-dir /root/src/target/release/build/ncurses-15097c1fbbdb97fb -L dependency=/root/src/target/release/deps --extern cc=/root/src/target/release/deps/libcc-facab8ecbf9ea3b4.rlib --extern pkg_config=/root/src/target/release/deps/libpkg_config-ee5a0a1751b50362.rlib --cap-lints allow`
#     Running `/root/src/target/release/build/ncurses-15097c1fbbdb97fb/build-script-build`
#     Running `rustc --crate-name ncurses /root/.cargo/registry/src/github.com-1ecc6299db9ec823/ncurses-5.101.0/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C linker-plugin-lto --cfg 'feature="default"' -C metadata=55fb7de5fd48fab1 -C extra-filename=-55fb7de5fd48fab1 --out-dir /root/src/target/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/root/src/target/x86_64-unknown-linux-gnu/release/deps -L dependency=/root/src/target/release/deps --extern libc=/root/src/target/x86_64-unknown-linux-gnu/release/deps/liblibc-b61d92c8da6ac69f.rmeta --cap-lints allow -l ncurses -l tinfo -l dl`
#   Compiling helloworld v0.0.0 (/root/src)
#     Running `rustc --crate-name helloworld --edition=2018 src/main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C opt-level=3 -C lto -C metadata=b62da1e72c50c2e3 -C extra-filename=-b62da1e72c50c2e3 --out-dir /root/src/target/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/root/src/target/x86_64-unknown-linux-gnu/release/deps -L dependency=/root/src/target/release/deps --extern ncurses=/root/src/target/x86_64-unknown-linux-gnu/release/deps/libncurses-55fb7de5fd48fab1.rlib`
#    Finished release [optimized] target(s) in 8.38s
root@98c165d333de:~/src# ls -lah target/x86_64-unknown-linux-gnu/release/helloworld
# -rwxr-xr-x 2 root root 1.5M Dec  6 21:28 target/x86_64-unknown-linux-gnu/release/helloworld
root@98c165d333de:~/src# target/x86_64-unknown-linux-gnu/release/helloworld

Note: CC=o64-clang CXX=o64-clang++ is needed because your crate require C bindings. See Building *-sys crates

For Musl and Darwin you need more setup and headers in-place to compile. Unfortunately ncurses C lib is not included in this Docker image. But it could be a kind of feature request for future inclusion.

@joseluisq
Copy link
Owner

I'm not fully aware about ncurses-rs however looking around, it seems to have some difficulties building for ARM targets.
So some people suggest termion since it is bindless. So maybe is what you want to have a look too.

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