dtolnay / cxx

Safe interop between Rust and C++
https://cxx.rs
Apache License 2.0
5.81k stars 330 forks source link

cxx will not link to libc++ after setting link-cplusplus dep #733

Open evopen opened 3 years ago

evopen commented 3 years ago
[cxx 1.0.32] TARGET = Some("x86_64-unknown-linux-gnu")
[cxx 1.0.32] OPT_LEVEL = Some("3")
[cxx 1.0.32] HOST = Some("x86_64-unknown-linux-gnu")
[cxx 1.0.32] CXX_x86_64-unknown-linux-gnu = None
[cxx 1.0.32] CXX_x86_64_unknown_linux_gnu = None
[cxx 1.0.32] HOST_CXX = None
[cxx 1.0.32] CXX = Some("clang++")
[cxx 1.0.32] CXXFLAGS_x86_64-unknown-linux-gnu = None
[cxx 1.0.32] CXXFLAGS_x86_64_unknown_linux_gnu = None
[cxx 1.0.32] HOST_CXXFLAGS = None
[cxx 1.0.32] CXXFLAGS = Some("")
[cxx 1.0.32] CRATE_CC_NO_DEFAULTS = None
[cxx 1.0.32] DEBUG = Some("false")
[cxx 1.0.32] CXX_x86_64-unknown-linux-gnu = None
[cxx 1.0.32] CXX_x86_64_unknown_linux_gnu = None
[cxx 1.0.32] HOST_CXX = None
[cxx 1.0.32] CXX = Some("clang++")
[cxx 1.0.32] CXXFLAGS_x86_64-unknown-linux-gnu = None
[cxx 1.0.32] CXXFLAGS_x86_64_unknown_linux_gnu = None
[cxx 1.0.32] HOST_CXXFLAGS = None
[cxx 1.0.32] CXXFLAGS = Some("")
[cxx 1.0.32] CRATE_CC_NO_DEFAULTS = None
[cxx 1.0.32] running: "clang++" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=x86_64-unknown-linux-gnu" "-std=c++11" "-o" "/home/dhh/Dev/rust/stdl/target/release/build/cxx-8ac59763f8999995/out/src/cxx.o" "-c" "src/cxx.cc"
[cxx 1.0.32] exit code: 0
[cxx 1.0.32] AR_x86_64-unknown-linux-gnu = None
[cxx 1.0.32] AR_x86_64_unknown_linux_gnu = None
[cxx 1.0.32] HOST_AR = None
[cxx 1.0.32] AR = None
[cxx 1.0.32] running: "ar" "cq" "/home/dhh/Dev/rust/stdl/target/release/build/cxx-8ac59763f8999995/out/libcxxbridge1.a" "/home/dhh/Dev/rust/stdl/target/release/build/cxx-8ac59763f8999995/out/src/cxx.o"
[cxx 1.0.32] exit code: 0
[cxx 1.0.32] running: "ar" "s" "/home/dhh/Dev/rust/stdl/target/release/build/cxx-8ac59763f8999995/out/libcxxbridge1.a"
[cxx 1.0.32] exit code: 0
[cxx 1.0.32] cargo:rustc-link-lib=static=cxxbridge1
[cxx 1.0.32] cargo:rustc-link-search=native=/home/dhh/Dev/rust/stdl/target/release/build/cxx-8ac59763f8999995/out
[cxx 1.0.32] cargo:rerun-if-changed=src/cxx.cc
[cxx 1.0.32] cargo:rerun-if-changed=include/cxx.h
[cxx 1.0.32] cargo:rustc-cfg=built_with_cargo
[cxx 1.0.32] cargo:HEADER=/home/dhh/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/cxx-1.0.32/include/cxx.h
[dependencies]
link-cplusplus = { version = "1.0", features = ["libc++"] }
cxx = "1.0"

[build-dependencies]
link-cplusplus = { version = "1.0", features = ["libc++"] }
cxx-build = "1.0"

[lib]
crate-type = ["staticlib"]
// src/lib.rs
extern crate link_cplusplus;

i have to manually set CXXFLAGS to stdlib=libc++

rockwotj commented 1 year ago

I also am running into this - so thankful you pointed a workaround @evopen