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

[SOLVED] Build error rust project with clickhouse as dependency, what is missing ? #86

Closed
blandger opened this issue Sep 21, 2023 · 2 comments

Comments

@blandger
Copy link

blandger commented Sep 21, 2023

Hi
I have following build error on compiling closed source project.

I have an x64 linux OS:

cat /etc/os-release

NAME="Linux Mint"
VERSION="21.2 (Victoria)"
ID=linuxmint
ID_LIKE="ubuntu debian"
PRETTY_NAME="Linux Mint 21.2"
VERSION_ID="21.2"
VERSION_CODENAME=victoria
UBUNTU_CODENAME=jammy

Cargo.toml contains deps:
[dependencies]
...............
clickhouse = "0.11.5"
clickhouse-rs-cityhash-sys = "0.1.2" // was added later, but it doesn't matter, error exists
[dev-dependencies]
clickhouse = { version = "0.11.5", features = ["test-util"] }

gcc --version
g++ --version

gcc (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

cmake --version

cmake version 3.22.1

clang --version

Ubuntu clang version 14.0.0-1ubuntu1.1
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

I have installed ClickHouse DEB libraries for server and client by using official docs from here

I stil have an error in attachment.
failed_bulld_tester.log

Can someone suggest what a FFI is missing to build code ?

.............
   Compiling clickhouse-rs-cityhash-sys v0.1.2
The following warnings were emitted during compilation:

warning: c++: fatal error: cannot execute ‘cc1plus’: execvp: No such file or directory
warning: compilation terminated.

error: failed to run custom build command for `clickhouse-rs-cityhash-sys v0.1.2`

Caused by:
  process didn't exit successfully: `/media/rust_projects/tester/target/debug/build/clickhouse-rs-cityhash-sys-7f8b1c514218fdb5/build-script-build` (exit status: 1)
  --- stdout
  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 = None
  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
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
  running: "sccache" "c++" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-m64" "-Wall" "-Wextra" "-o" "/media/rust_projects/tester/target/debug/build/clickhouse-rs-cityhash-sys-578c329a2376118a/out/src/cc/city.o" "-c" "src/cc/city.cc"
  cargo:warning=c++: fatal error: cannot execute ‘cc1plus’: execvp: No such file or directory
  cargo:warning=compilation terminated.
  exit status: 1

@blandger
Copy link
Author

SOLVED by myself.
GCC 12 version was my default compiler in system. I had a gcc - 9, 10, 11, 12 versions installed locally.

I tried to execute:

find /usr -name "cc1plus"

as it was mentioned in error...
result was:
/usr/lib/gcc/x86_64-linux-gnu/9/cc1plus
/usr/lib/gcc/x86_64-linux-gnu/11/cc1plus

So I gave a try to switch default systems' compiler from gcc 12 to 11 version. I used approach from here - https://askubuntu.com/a/26502/1663996

That solved the compilation problem.

@blandger blandger changed the title Build error rust project with clickhouse as dependency, what is missing ? [SOLVED] Build error rust project with clickhouse as dependency, what is missing ? Sep 21, 2023
@loyd
Copy link
Owner

loyd commented Sep 27, 2023

I will move to pure rust implementation to avoid dependency on GCC.

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