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

Cannot build proj with newer images #1270

Open
8 of 11 tasks
Emilgardis opened this issue May 29, 2023 · 2 comments
Open
8 of 11 tasks

Cannot build proj with newer images #1270

Emilgardis opened this issue May 29, 2023 · 2 comments
Labels
A-cmake Area: Cmake compiler c-cpp-deps-issue
Milestone

Comments

@Emilgardis
Copy link
Member

Emilgardis commented May 29, 2023

Checklist

Describe your issue

Its not possible to compile proj-sys with cross using the newer images

What target(s) are you cross-compiling for?

armv7-unknown-linux-gnueabihf

Which operating system is the host (e.g computer cross is on) running?

  • macOS
  • Windows
  • Linux / BSD
  • other OS (specify in description)

What architecture is the host?

  • x86_64 / AMD64
  • arm32
  • arm64 (including Mac M1)

What container engine is cross using?

  • docker
  • podman
  • other container engine (specify in description)

cross version

cross 0.2.5

Example

cargo new proj-sys-cross
# Cargo.toml
[package]
name = "proj-cross-build"
version = "0.1.0"
edition = "2021"

[dependencies]
proj-sys = { version = "0.23.1" }

[package.metadata.cross.target.armv7-unknown-linux-gnueabihf]
image = "ghcr.io/cross-rs/armv7-unknown-linux-gnueabihf:main"
pre-build = [
    "dpkg --add-architecture $CROSS_DEB_ARCH ",
    "apt-get update",
    "apt-get install --assume-yes libclang-10-dev clang-10 pkg-config",
    "apt-get install --assume-yes sqlite3 libsqlite3-dev:$CROSS_DEB_ARCH",
]
$ cross build --target armv7-unknown-linux-gnueabihf
[+] Building 0.1s (6/6) FINISHED                                                                                                                                                                                 
 => [internal] load build definition from Dockerfile.armv7-unknown-linux-gnueabihf-custom                                                                                                                   0.0s
 => => transferring dockerfile: 255B                                                                                                                                                                        0.0s
 => [internal] load .dockerignore                                                                                                                                                                           0.0s
 => => transferring context: 2B                                                                                                                                                                             0.0s
 => [internal] load metadata for ghcr.io/cross-rs/armv7-unknown-linux-gnueabihf:main                                                                                                                        0.0s
 => [1/2] FROM ghcr.io/cross-rs/armv7-unknown-linux-gnueabihf:main                                                                                                                                          0.0s
 => CACHED [2/2] RUN eval "set -e
dpkg --add-architecture $CROSS_DEB_ARCH 
apt-get update -o Acquire::ForceIPv4=true && apt-get -o Acquire::ForceIPv4=true install --assume-yes libclang-10-dev clang-10 p  0.0s
 => exporting to image                                                                                                                                                                                      0.0s
 => => exporting layers                                                                                                                                                                                     0.0s
 => => writing image sha256:18f3cb02dccb071e424aaf459f092789ab518c1fbc8a3292b99ce72d52f17351                                                                                                                0.0s
 => => naming to localhost/cross-rs/cross-custom-testing-proj:armv7-unknown-linux-gnueabihf-5f071-pre-build                                                                                                 0.0s
   Compiling libc v0.2.144
   Compiling memchr v2.5.0
   Compiling cfg-if v1.0.0
   Compiling glob v0.3.1
   Compiling proc-macro2 v1.0.59
   Compiling log v0.4.18
   Compiling minimal-lexical v0.2.1
   Compiling quote v1.0.28
   Compiling crc32fast v1.3.2
   Compiling unicode-width v0.1.10
   Compiling regex-syntax v0.7.2
   Compiling unicode-ident v1.0.9
   Compiling libloading v0.7.4
   Compiling textwrap v0.11.0
   Compiling either v1.8.1
   Compiling humantime v2.1.0
   Compiling bindgen v0.59.2
   Compiling bitflags v1.3.2
   Compiling adler v1.0.2
   Compiling termcolor v1.2.0
   Compiling strsim v0.8.0
   Compiling vec_map v0.8.2
   Compiling ansi_term v0.12.1
   Compiling miniz_oxide v0.7.1
   Compiling rustc-hash v1.1.0
   Compiling lazycell v1.3.0
   Compiling clang-sys v1.6.1
   Compiling cc v1.0.79
   Compiling aho-corasick v1.0.1
   Compiling nom v7.1.3
   Compiling peeking_take_while v0.1.2
   Compiling shlex v1.1.0
   Compiling atty v0.2.14
   Compiling clap v2.34.0
   Compiling xattr v0.2.3
   Compiling which v4.4.0
   Compiling filetime v0.2.21
   Compiling lazy_static v1.4.0
   Compiling cmake v0.1.50
   Compiling flate2 v1.0.26
   Compiling tar v0.4.38
   Compiling pkg-config v0.3.27
   Compiling regex v1.8.3
   Compiling cexpr v0.6.0
   Compiling env_logger v0.9.3
   Compiling proj-sys v0.23.1
error: failed to run custom build command for `proj-sys v0.23.1`

Caused by:
  process didn't exit successfully: `/target/debug/build/proj-sys-db2d115182fb046a/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=PROJ_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_armv7-unknown-linux-gnueabihf
  cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_armv7_unknown_linux_gnueabihf
  cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_ALLOW_CROSS
  cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS
  cargo:rerun-if-env-changed=PKG_CONFIG_armv7-unknown-linux-gnueabihf
  cargo:rerun-if-env-changed=PKG_CONFIG_armv7_unknown_linux_gnueabihf
  cargo:rerun-if-env-changed=TARGET_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG
  cargo:rerun-if-env-changed=PROJ_STATIC
  cargo:rerun-if-env-changed=PROJ_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_armv7-unknown-linux-gnueabihf
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_armv7_unknown_linux_gnueabihf
  cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_armv7-unknown-linux-gnueabihf
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_armv7_unknown_linux_gnueabihf
  cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_armv7-unknown-linux-gnueabihf
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_armv7_unknown_linux_gnueabihf
  cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
  CMAKE_TOOLCHAIN_FILE_armv7-unknown-linux-gnueabihf = None
  CMAKE_TOOLCHAIN_FILE_armv7_unknown_linux_gnueabihf = Some("/opt/toolchain.cmake")
  CMAKE_GENERATOR_armv7-unknown-linux-gnueabihf = None
  CMAKE_GENERATOR_armv7_unknown_linux_gnueabihf = None
  TARGET_CMAKE_GENERATOR = None
  CMAKE_GENERATOR = None
  CMAKE_PREFIX_PATH_armv7-unknown-linux-gnueabihf = None
  CMAKE_PREFIX_PATH_armv7_unknown_linux_gnueabihf = None
  TARGET_CMAKE_PREFIX_PATH = None
  CMAKE_PREFIX_PATH = None
  CMAKE_armv7-unknown-linux-gnueabihf = None
  CMAKE_armv7_unknown_linux_gnueabihf = None
  TARGET_CMAKE = None
  CMAKE = None
  running: cd "/target/armv7-unknown-linux-gnueabihf/debug/build/proj-sys-7f19be1eae7286bd/out/build" && CMAKE_PREFIX_PATH="" "cmake" "/home/emil/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proj-sys-0.23.1/PROJSRC/proj/proj-9.0.1" "-DBUILD_SHARED_LIBS=OFF" "-DBUILD_TESTING=OFF" "-DBUILD_CCT=OFF" "-DBUILD_CS2CS=OFF" "-DBUILD_GEOD=OFF" "-DBUILD_GIE=OFF" "-DBUILD_PROJ=OFF" "-DBUILD_PROJINFO=OFF" "-DBUILD_PROJSYNC=OFF" "-DENABLE_CURL=OFF" "-DENABLE_TIFF=OFF" "-DCMAKE_TOOLCHAIN_FILE=/opt/toolchain.cmake" "-DCMAKE_INSTALL_PREFIX=/target/armv7-unknown-linux-gnueabihf/debug/build/proj-sys-7f19be1eae7286bd/out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -fPIC -march=armv7-a -mfpu=vfpv3-d16" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -fPIC -march=armv7-a -mfpu=vfpv3-d16" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -fPIC -march=armv7-a -mfpu=vfpv3-d16" "-DCMAKE_BUILD_TYPE=Debug"
  -- The C compiler identification is GNU 9.4.0
  -- The CXX compiler identification is GNU 9.4.0
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Check for working C compiler: /usr/bin/arm-linux-gnueabihf-gcc - skipped
  -- Detecting C compile features
  -- Detecting C compile features - done
  -- Detecting CXX compiler ABI info
  -- Detecting CXX compiler ABI info - done
  -- Check for working CXX compiler: /usr/bin/arm-linux-gnueabihf-g++ - skipped
  -- Detecting CXX compile features
  -- Detecting CXX compile features - done
  -- Requiring C++11
  -- Requiring C++11 - done
  -- Requiring C99
  -- Requiring C99 - done
  -- Configuring PROJ:
  -- PROJ_VERSION                   = 9.0.1
  -- Looking for localeconv
  -- Looking for localeconv - found
  -- Looking for strerror
  -- Looking for strerror - found
  -- Looking for dladdr in dl
  -- Looking for dladdr in dl - found
  -- Looking for exp in m
  -- Looking for exp in m - found
  -- nlohmann/json: internal
  -- 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  
  -- Performing Test HAVE_PTHREAD_MUTEX_RECURSIVE_DEFN
  -- Performing Test HAVE_PTHREAD_MUTEX_RECURSIVE_DEFN - Failed
  -- Testing disabled
  -- Configuring proj library:
  -- ENABLE_IPO                     = OFF
  -- PROJ_CORE_TARGET_OUTPUT_NAME   = proj
  -- BUILD_SHARED_LIBS              = OFF
  -- PROJ_LIBRARIES                 = proj
  -- PROJ: Configured 'dist' target
  -- Configuring incomplete, errors occurred!
  See also "/target/armv7-unknown-linux-gnueabihf/debug/build/proj-sys-7f19be1eae7286bd/out/build/CMakeFiles/CMakeOutput.log".
  See also "/target/armv7-unknown-linux-gnueabihf/debug/build/proj-sys-7f19be1eae7286bd/out/build/CMakeFiles/CMakeError.log".

  --- stderr
  pkg-config unable to find existing libproj installation: `PKG_CONFIG_ALLOW_SYSTEM_CFLAGS="1" PKG_CONFIG_ALLOW_SYSTEM_LIBS="1" PKG_CONFIG_PATH="/usr/lib/arm-linux-gnueabihf/pkgconfig/:" "pkg-config" "--libs" "--cflags" "proj" "proj >= 9.0.0"` did not exit successfully: exit status: 1
  error: could not find system library 'proj' required by the 'proj-sys' crate

  --- stderr
  Package proj was not found in the pkg-config search path.
  Perhaps you should add the directory containing `proj.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'proj' found
  Package proj was not found in the pkg-config search path.
  Perhaps you should add the directory containing `proj.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'proj' found

  building libproj from source
  disabling tiff support
  CMake Error at CMakeLists.txt:181 (message):
    sqlite3 dependency not found!


  CMake Error at CMakeLists.txt:187 (message):
    sqlite3 >= 3.11 required!


  CMake Warning at CMakeLists.txt:206 (message):
    TIFF support is not enabled and will result in the inability to read some
    grids


  thread 'main' panicked at '
  command did not execute successfully, got: exit status: 1

  build script failed, must exit now', /home/emil/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cmake-0.1.50/src/lib.rs:1098:5
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Additional information / notes

adding

env.passthrough = ["CMAKE_TOOLCHAIN_FILE_armv7_unknown_linux_gnueabihf"]

solves this problem, suggesting something is not liking the toolchain file added in #1112

ping @prscoelho

@Emilgardis Emilgardis added c-cpp-deps-issue A-cmake Area: Cmake compiler labels May 29, 2023
prscoelho added a commit to prscoelho/proj-cross-build that referenced this issue May 29, 2023
@MoAlyousef
Copy link

MoAlyousef commented May 30, 2023

This is the same as this issue (check the last comment):
#1180

A workaround that I added to fltk-rs:

    if env::var("CROSS_SYSROOT").is_ok() {
        env::remove_var("CROSS_SYSROOT");
    }

@Emilgardis
Copy link
Member Author

Emilgardis commented May 30, 2023

Ah perfect! I remembered there was another issue with this but I couldn't locate it. Thank you @MoAlyousef

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-cmake Area: Cmake compiler c-cpp-deps-issue
Projects
None yet
Development

No branches or pull requests

2 participants