Skip to content

fails to build on debian sid #59

@ju1ius

Description

@ju1ius

Hi,

Building ada-url on debian sid fails.
Running the following commands:

git clone --depth=1 https://github.com/ada-url/rust.git ada-url
cd ada-url
cargo build
Produces the following output:
   Compiling ada-url v2.2.1 (/ada-url)
The following warnings were emitted during compilation:

warning: [email protected]: In file included from ./deps/ada.cpp:3:
warning: [email protected]: ./deps/ada.h:20:10: fatal error: 'string' file not found
warning: [email protected]: #include <string>
warning: [email protected]:          ^~~~~~~~
warning: [email protected]: 1 error generated.

error: failed to run custom build command for `ada-url v2.2.1 (/ada-url)`

Caused by:
  process didn't exit successfully: `/ada-url/target/debug/build/ada-url-ba3156cf87bc7d44/build-script-build` (exit status: 1)
  --- stdout
  OPT_LEVEL = Some("0")
  TARGET = Some("x86_64-unknown-linux-gnu")
  HOST = Some("x86_64-unknown-linux-gnu")
  cargo:rerun-if-env-changed=CXX_x86_64-unknown-linux-gnu
  CXX_x86_64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=CXX_x86_64_unknown_linux_gnu
  CXX_x86_64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=HOST_CXX
  HOST_CXX = None
  cargo:rerun-if-env-changed=CXX
  CXX = Some("clang++")
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  cargo:rerun-if-env-changed=CXXFLAGS_x86_64-unknown-linux-gnu
  CXXFLAGS_x86_64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=CXXFLAGS_x86_64_unknown_linux_gnu
  CXXFLAGS_x86_64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=HOST_CXXFLAGS
  HOST_CXXFLAGS = None
  cargo:rerun-if-env-changed=CXXFLAGS
  CXXFLAGS = None
  running: "clang++" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "--target=x86_64-unknown-linux-gnu" "-std=c++17" "-I" "./deps/ada.h" "-I" "./deps/ada_c.h" "-Wall" "-Wextra" "-o" "/ada-url/target/debug/build/ada-url-b4939785ec9bcc43/out/./deps/ada.o" "-c" "./deps/ada.cpp"
  cargo:warning=In file included from ./deps/ada.cpp:3:

  cargo:warning=./deps/ada.h:20:10: fatal error: 'string' file not found

  cargo:warning=#include <string>

  cargo:warning=         ^~~~~~~~

  cargo:warning=1 error generated.

  exit status: 1

  --- stderr


  error occurred: Command "clang++" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "--target=x86_64-unknown-linux-gnu" "-std=c++17" "-I" "./deps/ada.h" "-I" "./deps/ada_c.h" "-Wall" "-Wextra" "-o" "/ada-url/target/debug/build/ada-url-b4939785ec9bcc43/out/./deps/ada.o" "-c" "./deps/ada.cpp"with args "clang++" did not execute successfully (status code exit status: 1).

It seems that clang cannot find the c++ stdlib... 🤔
Moreover, the build script unconditionally sets the compiler to clang++, which makes trying another compiler (or another clang version) impossible.

If I comment out the aforementioned line and build with CXX=g++ cargo build, the library builds correctly and tests pass:

$ CXX=g++ cargo build
   Compiling ada-url v2.2.1 (/ada-url)
warning: [email protected]: cc1plus: warning: ./deps/ada.h: not a directory
warning: [email protected]: cc1plus: warning: ./deps/ada_c.h: not a directory
    Finished dev [unoptimized + debuginfo] target(s) in 3.57s

Also note the warnings caused by the build script's passing files to cc::Build::include() instead of directories.

IMO, the build script should let the cc crate detect the correct compiler on UNIX platforms.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions