Open cstkingkey opened 1 year ago
following packages are installed in the custom image libx11-dev:arm64 libxext-dev:arm64 libxft-dev:arm64 libxinerama-dev:arm64 libxcursor-dev:arm64 libxrender-dev:arm64 libxfixes-dev:arm64 libwayland-dev:arm64 wayland-protocols libdbus-1-dev:arm64 libxkbcommon-dev:arm64 libpango1.0-dev:arm64 libgl1-mesa-dev:arm64 libglu1-mesa-dev:arm64
Image is built with cross aa59bf243a1c525c3533570202013a299345a08a using cargo build-docker-image
How exactly are you installing these dependencies in the custom image built with cargo build-docker-image
?
How exactly are you installing these dependencies in the custom image built with
cargo build-docker-image
?
get the base image with cargo build-docker-image, then build the custom image with following Dockerfile
FROM ghcr.io/cross-rs/aarch64-unknown-linux-gnu:local
ENV DEBIAN_FRONTEND=noninteractive
RUN dpkg --add-architecture arm64 && \ apt-get update && \ apt-get install --assume-yes --no-install-recommends \ libx11-dev:arm64 libxext-dev:arm64 libxft-dev:arm64 \ libxinerama-dev:arm64 libxcursor-dev:arm64 \ libxrender-dev:arm64 libxfixes-dev:arm64 \ libwayland-dev:arm64 wayland-protocols libdbus-1-dev:arm64 libxkbcommon-dev:arm64 \ libpango1.0-dev:arm64 libgl1-mesa-dev:arm64 libglu1-mesa-dev:arm64
Alright, this might be an issue with how fltk-sys
(or really the cmake build) discovers packages.
Any reason you're using cargo build-docker-image
and not any of the options listed in the wiki?
Does setting X11_X11_INCLUDE_PATH
and X11_X11_LIB
solve the issue?
It should be X11_X11_LIB=/usr/lib/aarch64-linux-gnu/
and X11_X11_INCLUDE_PATH=/usr/include/X11/
Alright, this might be an issue with how
fltk-sys
(or really the cmake build) discovers packages.Any reason you're using
cargo build-docker-image
and not any of the options listed in the wiki?Does setting
X11_X11_INCLUDE_PATH
andX11_X11_LIB
solve the issue?It should be
X11_X11_LIB=/usr/lib/aarch64-linux-gnu/
andX11_X11_INCLUDE_PATH=/usr/include/X11/
No, same error log. The reason is not very straightforward. I try to build macos image. Then I try to update the linux arm64 image as the one I'm using is pretty old which is based on rustembedded/cross:aarch64-unknown-linux-gnu.
comment out following code in toolchain.cmake will make it work if(DEFINED ENV{CROSS_SYSROOT}) set(CMAKE_FIND_ROOT_PATH "$ENV{CROSS_SYSROOT}" "${CMAKE_PREFIX_PATH}") set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) endif()
The set(CMAKE_FIND_ROOT_PATH "$ENV{CROSS_SYSROOT}" "${CMAKE_PREFIX_PATH}")
seems wrong.
CMAKE_PREFIX_PATH is empty by default, and is only filled if a path is given using set(CMAKE_PREFIX_PATH some/path)
or using the command-line: cmake -B bin -DCMAKE_PREFIX_PATH=some/path
.
Also for example on aarch64-linux-gnu, CROSS_SYSROOT
is set to /usr/aarch64-linux-gnu
, this makes searching for libs and headers happen in $CROSS_SYSROOT/include
and $CROSS_SYSROOT/lib
, while in reality, they are installed in /usr/include/aarch64-linux-gnu/
and /usr/lib/aarch64-linux-gnu
.
I can confirm fltk-rs used to build using cross-rs, but currently it doesn't with:
FROM ghcr.io/cross-rs/aarch64-unknown-linux-gnu:edge
ENV DEBIAN_FRONTEND=noninteractive
RUN dpkg --add-architecture arm64 && \
apt-get update && \
apt-get install --assume-yes --no-install-recommends \
libx11-dev:arm64 libxext-dev:arm64 libxft-dev:arm64 \
libxinerama-dev:arm64 libxcursor-dev:arm64 \
libxrender-dev:arm64 libxfixes-dev:arm64 libgl1-mesa-dev:arm64 \
libglu1-mesa-dev:arm64 libasound2-dev:arm64 libpango1.0-dev:arm64
and Cross.toml:
[target.aarch64-unknown-linux-gnu]
dockerfile = "./arm64-dockerfile"
cross build --target aarch64-unknown-linux-gnu
I think cross-rs shouldn't be passing a CMAKE_TOOLCHAIN_FILE to every build since that breaks any repo which uses its own toolchain file or using a toolchain file provided by a vendor, like the android cmake toolchain file for example.
A minimal repro using the cmake crate (only requiring X11, no fltk):
|
|__csrc
| |_lib.c
| |_CMakeLists.txt
|_src
| |_main.rs
|
|_Cargo.toml
|
|_Cross.toml
|
|_build.rs
|
|_arm64-dockerfile
// build.rs
fn main() {
let out_dir = std::path::PathBuf::from(std::env::var("OUT_DIR").unwrap());
let _dst = cmake::Config::new("csrc").build();
println!(
"cargo:rustc-link-search=native={}",
out_dir.join("lib").display()
);
println!("cargo:rustc-link-lib=static=cx11");
}
# Cargo.toml
[package]
name = "cros2"
version = "0.1.0"
edition = "2021"
[build-dependencies]
cmake = "*"
# Cross.toml
[target.aarch64-unknown-linux-gnu]
dockerfile = "./arm64-dockerfile"
# arm64-dockerfile
FROM ghcr.io/cross-rs/aarch64-unknown-linux-gnu:edge
ENV DEBIAN_FRONTEND=noninteractive
RUN dpkg --add-architecture arm64 && \
apt-get update && \
apt-get install --assume-yes --no-install-recommends \
libx11-dev:arm64
// csrc/lib.c
int cmain() {
return 0;
}
# csrc/CMakeLists.txt
cmake_minimum_required(VERSION 3.14)
project(cx11)
find_package(X11 REQUIRED) # this will fail
add_library(cx11 lib.c)
# cmake-rs requires an install target
install(TARGETS cx11
EXPORT cx11Config
ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
)
// src/main.rs
fn main() {
println!("Hello, world!");
}
build with cross build --target=aarch64-unknown-linux-gnu
will also fail with a similar error.
Checklist
Describe your issue
build fltk-rs (https://github.com/fltk-rs/fltk-rs) with https://github.com/fltk-rs/fltk-rs run into -- Could NOT find X11 (missing: X11_X11_INCLUDE_PATH X11_X11_LIB) -- Looking for pthread.h -- Looking for pthread.h - found -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed -- Looking for pthread_create in pthreads -- Looking for pthread_create in pthreads - not found -- Looking for pthread_create in pthread -- Looking for pthread_create in pthread - found -- Found Threads: TRUE -- Pango requires Xft but Xft library or headers could not be found. -- Please install Xft development files and try again or disable OPTION_USE_PANGO. -- Configuring incomplete, errors occurred!
What target(s) are you cross-compiling for?
No response
Which operating system is the host (e.g computer cross is on) running?
What architecture is the host?
What container engine is cross using?
cross version
cross 0.2.4
Example
No response
Additional information / notes
No response