Open lfnoise opened 1 year ago
I am trying to build the example given in the README, and there are some problems with linking the C++ code. I'm not very experienced with linking to C++ code using cargo.
Cargo.toml line is:
[dependencies] inkwell = { git = "https://github.com/TheDan64/inkwell", branch = "master", features = ["llvm15-0"] }
Results of a build:
> cargo build --verbose Fresh regex-syntax v0.7.1 Fresh lazy_static v1.4.0 Fresh cc v1.0.79 Fresh autocfg v1.1.0 Fresh unicode-ident v1.0.8 Fresh cfg-if v1.0.0 Fresh smallvec v1.10.0 Fresh scopeguard v1.1.0 Fresh once_cell v1.17.1 Fresh either v1.8.1 Fresh memchr v2.5.0 Fresh aho-corasick v1.0.1 Fresh semver v1.0.17 Fresh libc v0.2.142 Fresh proc-macro2 v1.0.56 Fresh regex v1.8.1 Fresh quote v1.0.26 Fresh parking_lot_core v0.9.7 Fresh lock_api v0.4.9 Fresh syn v2.0.15 Fresh parking_lot v0.12.1 Fresh inkwell_internals v0.7.0 (https://github.com/TheDan64/inkwell?branch=master#13c6c3bb) Fresh llvm-sys v150.0.5 Fresh inkwell v0.1.1 (https://github.com/TheDan64/inkwell?branch=master#13c6c3bb) Compiling inkwell-test v0.1.0 (/Users/xxuserxx/Dropbox/rustdev/inkwell-test) Running `rustc --crate-name inkwell_test --edition=2021 src/main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C metadata=a8c0bea72dbf1522 -C extra-filename=-a8c0bea72dbf1522 --out-dir /Users/xxuserxx/Dropbox/rustdev/inkwell-test/target/debug/deps -C incremental=/Users/xxuserxx/Dropbox/rustdev/inkwell-test/target/debug/incremental -L dependency=/Users/xxuserxx/Dropbox/rustdev/inkwell-test/target/debug/deps --extern inkwell=/Users/xxuserxx/Dropbox/rustdev/inkwell-test/target/debug/deps/libinkwell-cc1bb93a3255b159.rlib -L native=/Users/xxuserxx/Dropbox/rustdev/inkwell-test/target/debug/build/llvm-sys-3693369a5afbcfe7/out -L 'native=/usr/local/Cellar/llvm@15/15.0.7/lib'` error: linking with `cc` failed: exit status: 1 | = note: "cc" "-m64" "-arch" "x86_64" "/var/folders/f2/60_p_n308xlc8w006s6p4sc00000gn/T/rustcSsxnAY/symbols.o" "/Users/xxuserxx/Dropbox/rustdev/inkwell-test/target/debug/deps/inkwell_test-a8c0bea72dbf1522.12ikoapl3nqzaosu.rcgu.o" "/Users/xxuserxx/Dropbox/rustdev/inkwell-test/target/debug/deps/inkwell_test-a8c0bea72dbf1522.131vjbc0ls5wew65.rcgu.o" "/Users/xxuserxx/Dropbox/rustdev/inkwell-test/target/debug/deps/inkwell_test-a8c0bea72dbf1522.13m4n76ln0woqjij.rcgu.o" "/Users/xxuserxx/Dropbox/rustdev/inkwell-test/target/debug/deps/inkwell_test-a8c0bea72dbf1522.1d5q7hgafiv7vj2o.rcgu.o" "/Users/xxuserxx/Dropbox/rustdev/inkwell-test/target/debug/deps/inkwell_test-a8c0bea72dbf1522.1vkdkevihp4nhjyp.rcgu.o" "/Users/xxuserxx/Dropbox/rustdev/inkwell-test/target/debug/deps/inkwell_test-a8c0bea72dbf1522.2a3vxxvvdbtzxtl3.rcgu.o" "/Users/xxuserxx/Dropbox/rustdev/inkwell-test/target/debug/deps/inkwell_test-a8c0bea72dbf1522.2fxxpkw5augn2590.rcgu.o" "/Users/xxuserxx/Dropbox/rustdev/inkwell-test/target/debug/deps/inkwell_test-a8c0bea72dbf1522.2km8j3pdcb022b75.rcgu.o" "/Users/xxuserxx/Dropbox/rustdev/inkwell-test/target/debug/deps/inkwell_test-a8c0bea72dbf1522.2mnaqh0xan0kj902.rcgu.o" "/Users/xxuserxx/Dropbox/rustdev/inkwell-test/target/debug/deps/inkwell_test-a8c0bea72dbf1522.2pp59cqgyn1h7zxw.rcgu.o" "/Users/xxuserxx/Dropbox/rustdev/inkwell-test/target/debug/deps/inkwell_test-a8c0bea72dbf1522.30h0t4jjjatjt2az.rcgu.o" "/Users/xxuserxx/Dropbox/rustdev/inkwell-test/target/debug/deps/inkwell_test-a8c0bea72dbf1522.35n735tsewehp52c.rcgu.o" "/Users/xxuserxx/Dropbox/rustdev/inkwell-test/target/debug/deps/inkwell_test-a8c0bea72dbf1522.3gdiw46n0flv08si.rcgu.o" "/Users/xxuserxx/Dropbox/rustdev/inkwell-test/target/debug/deps/inkwell_test-a8c0bea72dbf1522.3ib7bqe12e098qn7.rcgu.o" "/Users/xxuserxx/Dropbox/rustdev/inkwell-test/target/debug/deps/inkwell_test-a8c0bea72dbf1522.3kjet73iaxpxjo7x.rcgu.o" "/Users/xxuserxx/Dropbox/rustdev/inkwell-test/target/debug/deps/inkwell_test-a8c0bea72dbf1522.3m7gjw0cfqjaxz2a.rcgu.o" "/Users/xxuserxx/Dropbox/rustdev/inkwell-test/target/debug/deps/inkwell_test-a8c0bea72dbf1522.47241bcu17h6p276.rcgu.o" "/Users/xxuserxx/Dropbox/rustdev/inkwell-test/target/debug/deps/inkwell_test-a8c0bea72dbf1522.479en8wgqxdt6lpx.rcgu.o" "/Users/xxuserxx/Dropbox/rustdev/inkwell-test/target/debug/deps/inkwell_test-a8c0bea72dbf1522.4nujvwfgmva1darb.rcgu.o" "/Users/xxuserxx/Dropbox/rustdev/inkwell-test/target/debug/deps/inkwell_test-a8c0bea72dbf1522.4slgyoxqlanl89ij.rcgu.o" "/Users/xxuserxx/Dropbox/rustdev/inkwell-test/target/debug/deps/inkwell_test-a8c0bea72dbf1522.4t469vi1wonynrw2.rcgu.o" "/Users/xxuserxx/Dropbox/rustdev/inkwell-test/target/debug/deps/inkwell_test-a8c0bea72dbf1522.4v30quh75hcdhqpg.rcgu.o" "/Users/xxuserxx/Dropbox/rustdev/inkwell-test/target/debug/deps/inkwell_test-a8c0bea72dbf1522.jkntyj995fuldxe.rcgu.o" "/Users/xxuserxx/Dropbox/rustdev/inkwell-test/target/debug/deps/inkwell_test-a8c0bea72dbf1522.qduapbqwtuydyfs.rcgu.o" "/Users/xxuserxx/Dropbox/rustdev/inkwell-test/target/debug/deps/inkwell_test-a8c0bea72dbf1522.xfl8qq05naj66xk.rcgu.o" "/Users/xxuserxx/Dropbox/rustdev/inkwell-test/target/debug/deps/inkwell_test-a8c0bea72dbf1522.ywob2u3c485p41s.rcgu.o" "/Users/xxuserxx/Dropbox/rustdev/inkwell-test/target/debug/deps/inkwell_test-a8c0bea72dbf1522.52uyilf0v5tttoq1.rcgu.o" "-L" "/Users/xxuserxx/Dropbox/rustdev/inkwell-test/target/debug/deps" "-L" "/Users/xxuserxx/Dropbox/rustdev/inkwell-test/target/debug/build/llvm-sys-3693369a5afbcfe7/out" "-L" "/usr/local/Cellar/llvm@15/15.0.7/lib" "-L" "/Users/xxuserxx/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/Users/xxuserxx/Dropbox/rustdev/inkwell-test/target/debug/deps/libinkwell-cc1bb93a3255b159.rlib" "/Users/xxuserxx/Dropbox/rustdev/inkwell-test/target/debug/deps/libeither-80f926e010bcdacc.rlib" "/Users/xxuserxx/Dropbox/rustdev/inkwell-test/target/debug/deps/libparking_lot-f3ead2ad21e91413.rlib" "/Users/xxuserxx/Dropbox/rustdev/inkwell-test/target/debug/deps/libparking_lot_core-4bb9526e9a880a1b.rlib" "/Users/xxuserxx/Dropbox/rustdev/inkwell-test/target/debug/deps/libcfg_if-89cb16fc176d2309.rlib" "/Users/xxuserxx/Dropbox/rustdev/inkwell-test/target/debug/deps/libsmallvec-c01779971ae3817a.rlib" "/Users/xxuserxx/Dropbox/rustdev/inkwell-test/target/debug/deps/liblock_api-a6e534c5627263b2.rlib" "/Users/xxuserxx/Dropbox/rustdev/inkwell-test/target/debug/deps/libscopeguard-21323d145333e807.rlib" "/Users/xxuserxx/Dropbox/rustdev/inkwell-test/target/debug/deps/libonce_cell-156fe7cadf182844.rlib" "/Users/xxuserxx/Dropbox/rustdev/inkwell-test/target/debug/deps/libllvm_sys-fa328efed9c6211f.rlib" "/Users/xxuserxx/Dropbox/rustdev/inkwell-test/target/debug/deps/liblibc-6983b2c7774553cb.rlib" "/Users/xxuserxx/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd-994d85144f760efb.rlib" "/Users/xxuserxx/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libpanic_unwind-c1133c6668acdcf0.rlib" "/Users/xxuserxx/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libobject-9725e7dd2849e8e7.rlib" "/Users/xxuserxx/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libmemchr-df789b9281441958.rlib" "/Users/xxuserxx/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libaddr2line-62428818a923053b.rlib" "/Users/xxuserxx/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libgimli-f413757a494e5537.rlib" "/Users/xxuserxx/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_demangle-caeb371515035776.rlib" "/Users/xxuserxx/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd_detect-76c501690b40dd80.rlib" "/Users/xxuserxx/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libhashbrown-457561e2e266d752.rlib" "/Users/xxuserxx/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libminiz_oxide-85bc751190b44729.rlib" "/Users/xxuserxx/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libadler-02c9e7db7c2d136d.rlib" "/Users/xxuserxx/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_alloc-6a6c2babfaf316dd.rlib" "/Users/xxuserxx/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libunwind-42cc5a335299a591.rlib" "/Users/xxuserxx/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcfg_if-5ea4e48bf429a601.rlib" "/Users/xxuserxx/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liblibc-8615751a74bfc03b.rlib" "/Users/xxuserxx/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc-d386101ba5b2dc76.rlib" "/Users/xxuserxx/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_core-1bf2f523c1bee03d.rlib" "/Users/xxuserxx/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcore-d0a8c087921eb265.rlib" "/Users/xxuserxx/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcompiler_builtins-b7c6a2ea5448bcac.rlib" "-lffi" "-lm" "-lz" "-lzstd" "-lcurses" "-lxml2" "-lc++" "-liconv" "-lSystem" "-lresolv" "-lc" "-lm" "-liconv" "-L" "/Users/xxuserxx/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "-o" "/Users/xxuserxx/Dropbox/rustdev/inkwell-test/target/debug/deps/inkwell_test-a8c0bea72dbf1522" "-Wl,-dead_strip" "-nodefaultlibs" = note: Undefined symbols for architecture x86_64: "std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> >::str() const", referenced from: (anonymous namespace)::AsmParser::parseStatement((anonymous namespace)::ParseStatementInfo&, llvm::MCAsmParserSemaCallback*) in libllvm_sys-fa328efed9c6211f.rlib(AsmParser.cpp.o) "VTT for std::__1::basic_ostringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >", referenced from: (anonymous namespace)::AsmParser::parseStatement((anonymous namespace)::ParseStatementInfo&, llvm::MCAsmParserSemaCallback*) in libllvm_sys-fa328efed9c6211f.rlib(AsmParser.cpp.o) "vtable for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> >", referenced from: (anonymous namespace)::AsmParser::parseStatement((anonymous namespace)::ParseStatementInfo&, llvm::MCAsmParserSemaCallback*) in libllvm_sys-fa328efed9c6211f.rlib(AsmParser.cpp.o) NOTE: a missing vtable usually means the first non-inline virtual member function has no definition. "vtable for std::__1::basic_ostringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >", referenced from: (anonymous namespace)::AsmParser::parseStatement((anonymous namespace)::ParseStatementInfo&, llvm::MCAsmParserSemaCallback*) in libllvm_sys-fa328efed9c6211f.rlib(AsmParser.cpp.o) NOTE: a missing vtable usually means the first non-inline virtual member function has no definition. ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) error: could not compile `inkwell-test` due to previous error Caused by: process didn't exit successfully: `rustc --crate-name inkwell_test --edition=2021 src/main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C metadata=a8c0bea72dbf1522 -C extra-filename=-a8c0bea72dbf1522 --out-dir /Users/xxuserxx/Dropbox/rustdev/inkwell-test/target/debug/deps -C incremental=/Users/xxuserxx/Dropbox/rustdev/inkwell-test/target/debug/incremental -L dependency=/Users/xxuserxx/Dropbox/rustdev/inkwell-test/target/debug/deps --extern inkwell=/Users/xxuserxx/Dropbox/rustdev/inkwell-test/target/debug/deps/libinkwell-cc1bb93a3255b159.rlib -L native=/Users/xxuserxx/Dropbox/rustdev/inkwell-test/target/debug/build/llvm-sys-3693369a5afbcfe7/out -L 'native=/usr/local/Cellar/llvm@15/15.0.7/lib'` (exit status: 1)
iMac Pro 2017, Mac OS 13.3.1 llvm 15.0.7 installed via Homebrew.
I don't have access to a Mac so I can't really help unfortunately
An example: LLVM_SYS_170_PREFIX=/usr/local/opt/llvm cargo build --features llvm17-0
LLVM_SYS_170_PREFIX=/usr/local/opt/llvm cargo build --features llvm17-0
I am trying to build the example given in the README, and there are some problems with linking the C++ code. I'm not very experienced with linking to C++ code using cargo.
Cargo.toml line is:
Results of a build:
iMac Pro 2017, Mac OS 13.3.1 llvm 15.0.7 installed via Homebrew.