I want to link libzmq with my Rust program. I have this in ~\.cargo\config:
[target.x86_64-pc-windows-gnu.chainsaw]
rustc-link-search = ["C:\\Program Files\\ZeroMQ 4.0.4\\bin"]
Running cargo test results in this error:
Compiling chainsaw v0.0.1 (file:///D:/chainsaw)
error: linking with `gcc` failed: exit code: 1
|
= note: "gcc" "-Wl,--enable-long-section-names" "-fno-use-linker-plugin" "-Wl,--nxcompat" "-nostdlib" "-m64" "C:\\Rust
\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\crt2.o" "C:\\Rust\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\rsbegin.o" "-L"
"C:\\Rust\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib" "D:\\chainsaw\\target\\debug\\deps\\chainsaw-0154e16e13da8295.0.o"
"-o" "D:\\chainsaw\\target\\debug\\deps\\chainsaw-0154e16e13da8295.exe" "-Wl,--gc-sections" "-nodefaultlibs" "-L" "D:\\
chainsaw\\target\\debug\\deps" "-L" "C:\\Rust\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib" "-Wl,-Bstatic" "-Wl,-Bdynamic"
"-l" "zmq" "D:\\chainsaw\\target\\debug\\deps\\liblibc-29ef97a68464c2b7.rlib" "C:\\Rust\\lib\\rustlib\\x86_64-pc-windows
-gnu\\lib\\libtest-f5a209a9.rlib" "C:\\Rust\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libterm-f5a209a9.rlib" "C:\\Rust\
\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libgetopts-f5a209a9.rlib" "C:\\Rust\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib
\\libstd-f5a209a9.rlib" "C:\\Rust\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libpanic_unwind-f5a209a9.rlib" "C:\\Rust\\l
ib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libunwind-f5a209a9.rlib" "C:\\Rust\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\l
ibrand-f5a209a9.rlib" "C:\\Rust\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcollections-f5a209a9.rlib" "C:\\Rust\\lib\
\rustlib\\x86_64-pc-windows-gnu\\lib\\librustc_unicode-f5a209a9.rlib" "C:\\Rust\\lib\\rustlib\\x86_64-pc-windows-gnu\\li
b\\liblibc-f5a209a9.rlib" "C:\\Rust\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\liballoc-f5a209a9.rlib" "C:\\Rust\\lib\\r
ustlib\\x86_64-pc-windows-gnu\\lib\\liballoc_system-f5a209a9.rlib" "C:\\Rust\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\
libcore-f5a209a9.rlib" "C:\\Rust\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcompiler_builtins-f5a209a9.rlib" "-l" "ke
rnel32" "-l" "ws2_32" "-l" "userenv" "-l" "shell32" "-l" "advapi32" "-l" "gcc_eh" "-lmingwex" "-lmingw32" "-lgcc" "-lmsv
crt" "-luser32" "-lkernel32" "C:\\Rust\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\rsend.o"
= note: ld: cannot find -lzmq
As you can see, -L "C:\Program Files\ZeroMQ 4.0.4\bin" is not being passed to the linker.
Why does setting rustc-link-search in the Cargo config file not work?
I have already checked these things:
Cargo actually reads the config file
The directory exists
x86_64-pc-windows-gnu is my target triple
"chainsaw" is the name of my target
The same error occurs when doing a clean build
Related
After an update to the new macOS (Ventura 13.1, M1 Pro) version rust project started to crash on build when tries to link libomp. The error on cargo build -vv:
error: linking with `cc` failed: exit status: 1
|
= note: "cc" "-arch" "arm64" "/var/folders/_p/tgbl9k457tvbjbpxmb2q3r1m0000gn/T/rustc1sq6Z5/symbols.o" "/Users/vikulikov/projects/{project_path}/target/debug/deps/{project}-ec57ac4e6d4eed12.10102az2qpqlnssx.rcgu.o" "/Users/vikulikov/projects/{project_path}/target/debug/deps/{project}-ec57ac4e6d4eed12.10pmcgcmusc5twvn.rcgu.o" "/Users/vikulikov/projects/{project_path}/target/debug/deps/{project}-ec57ac4e6d4eed12.33ebzcr429zv4r69.rcgu.o" "-L" "/Users/vikulikov/projects/{project_path}/target/debug/deps" "-L" "/Users/vikulikov/projects/{project_path}/target/debug/build/ring-66285374768a0289/out" "-L" "/Users/vikulikov/projects/{project_path}/target/debug/build/clickhouse-rs-cityhash-sys-56b125abd43a1bed/out" "-L" "/Users/vikulikov/projects/{project_path}/target/debug/build/lz4-sys-b41f36414fcf3d57/out" "-L" "/Users/vikulikov/projects/{project_path}/target/debug/build/lightgbm-sys-34cf0c5853566b8c/out/lib" "-L" "/Users/vikulikov/projects/{project_path}/target/debug/build/lightgbm-sys-34cf0c5853566b8c/out" "-L" "/Users/vikulikov/projects/{project_path}/target/debug/build/bzip2-sys-55a2969129b4a854/out/lib" "-L" "/Users/vikulikov/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/librayon-a368ce40113bc0f7.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/librayon_core-d9e15259c12109dd.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/lib{project_dir}-c76f044f35528d72.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libtracing_loki-d0184819565b7bc6.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libsnap-306d8cec31a52cce.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libtracing_serde-a73889d4392e2361.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libloki_api-ddd536117f3c02da.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libprost_types-572832ad507f9de0.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libprost-e068f62c28ccc8b2.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/liborder_stat-25a20551870d634c.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libpancakeswap-4e0d114d9a2a76be.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libethers-a219b92e6641dbe1.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libethers_middleware-d29117ee6c7944b4.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libethers_signers-8eaf51178d999ed1.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libeth_keystore-b991f15c61299d1b.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libaes-85ce4a53054918f3.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libopaque_debug-69d537144a36dc89.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libscrypt-688fa31c4f28c63b.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libsalsa20-7fa37dfb872be400.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libpassword_hash-ee6e3baff74b42c1.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libpbkdf2-3d9567eefa71c45a.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libctr-f37779e2de156ab2.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libcipher-56165c31f9471ba2.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libcoins_bip39-4d851dd8aaf70dac.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libpbkdf2-5bb0582222c9e070.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libpassword_hash-e0ed827d8e9fd003.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libbase64ct-74280d3beea8da8e.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libbitvec-9423a5447ef68001.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libradium-a089b6a53f21f784.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libcoins_bip32-3a1c2a5c010b854c.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libbs58-c0142c1f88c6f8b7.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libcoins_core-245c3e946073f305.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libblake2-e9ec6e9f373c1ef4.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libbase64-908fea8ab5c201dd.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libripemd-07f318d495654f0c.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libbase58check-5df8d10f35a6bee5.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libsha2-d597d4e6775fc17f.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libdigest-96df25a861e1e14c.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libopaque_debug-c5a545cdb63802d6.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libfake_simd-66c05d9faa110044.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libblock_buffer-ca3c152eaf8294ac.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libgeneric_array-4658500995f0dba1.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libblock_padding-8c899def0159c457.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libbyte_tools-04232adcec1f2ed9.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libbase58-61c3db63dadefe01.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libbech32-ecfa67b0df0f995e.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libfutures_locks-a0acad40751b0c2c.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libethers_etherscan-cbcf7d4d7670ce82.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libsemver-10e716672a01011f.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libserde_aux-fd3d015d0a4edb77.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libethers_contract-85e3f04ebf35ee9e.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libethers_providers-573f02d8178a7edc.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libfutures_timer-fb57d40fad211b41.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libtracing_futures-d170a033d12065b3.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libethers_addressbook-2a0b7a4a7e07b1d5.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libethers_core-0019fb6c6704b519.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libunicode_xid-e7d1530a327bea76.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libstrum-0a5428bb6883f13c.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libk256-35436dc2a3673601.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libecdsa-83480df40be69291.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/librfc6979-fae22233353d569d.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libsignature-2767ee0e150ba21c.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libelliptic_curve-82183223f196e8bf.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libsec1-0ddd593266f18fbb.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libpkcs8-1b692c412fa3ede8.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libspki-9fe5635ab5e0291b.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libder-19631b5bae8ff186.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libbase16ct-45afe28af36516d3.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libgroup-4b637aed44be1a61.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libff-092feacb084533b4.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libcrypto_bigint-4dceeffb77fde972.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libzeroize-6d1a20a9695545ca.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libsyn-a0b333f36cf6933a.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libquote-564fbbf32ce874a1.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libproc_macro2-a12129456c79b3ae.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libunicode_ident-2df767b08b5dee4e.rlib" "/Users/vikulikov/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libproc_macro-00b05ec0a97de84e.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libconvert_case-7ad0534d8c5fd8c3.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libfastrlp-256bc78a1ef74915.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libethabi-d8f8b392b37cd582.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libethereum_types-0eb195605b40513c.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libethbloom-1e54de4eae147b61.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libtiny_keccak-0cb69878e52df2f3.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libprimitive_types-4f54843cfb523fba.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libimpl_codec-8e47d3c4d0d7172d.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libparity_scale_codec-0d2e9771e57e0938.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libbyte_slice_cast-7479fed5ff548fa4.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libimpl_serde-6a5277220fa398c6.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libimpl_rlp-da0374252df098bf.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/librlp-240681309e2ba0a2.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libfixed_hash-964906ceb0260a33.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/librustc_hex-22afa64d3d0ca991.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libsha3-874e48672e2f596d.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libkeccak-ad55d88ffa7ab68c.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libuint-3a101f0d60a79d53.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libcrunchy-aa9525a478410cd6.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libstatic_assertions-0ff83d9301a80122.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/liberased_serde-c1e6cb738a619760.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libbinance_{project_dir}-861a3e967128a5d3.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libhmac_sha256-06695515fb30ad01.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libtokio_native_tls-4c9f6996cf1ea42b.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libtokio-86cdf7ae56108f25.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libsignal_hook_registry-1e2cd83343c3c9db.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libnum_cpus-c7ce2c947fb8cdf4.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libsocket2-4352fe09b768a757.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libmio-290b15fdaef97a66.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libparking_lot-34cf09bf4119fbd2.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libparking_lot_core-d1fa6b2701b27516.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libsmallvec-25a503f6c5b2115b.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/liblock_api-007f4f757f665560.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libscopeguard-e5de70d0869a1c62.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libfutures_util-b48bc9683ec1862f.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libmemchr-6c9fbfeda127ffa9.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libfutures_io-31c6c3fdbfd7acd1.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libslab-875bd9101045b6dd.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libfutures_channel-20a3c3a00df83455.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libpin_project_lite-ebcedf82ec43c8a1.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libfutures_sink-03bac378879c749a.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libfutures_task-ee914422cb186d20.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libpin_utils-fe0d75987f40efa5.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libfutures_core-cf6b91f091126cd4.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libtungstenite-ca8867ea48f31ee9.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libbase64-63d35bb8646f0242.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/librand-90b2f68f9b08d326.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/librand_chacha-b44402712ed3dace.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libppv_lite86-697eeaf5f72102e4.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/librand_core-de8033ba78482ef2.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libgetrandom-b3a5e67bd72e9479.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libnative_tls-f4934c5623c8a8a9.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libtempfile-367f4cfc6447abfe.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libfastrand-59e99e6b8d72a8ac.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libremove_dir_all-a13bce8a768cc08e.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libsecurity_framework-538b9df5ab088483.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libbitflags-6db4b7a1a2354e6b.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libsecurity_framework_sys-eb98a88952287665.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libcore_foundation-ec930b180bb57bc2.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/liblazy_static-0773c577324b701d.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libutf8-0c5e5daffc553b62.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libbyteorder-faf1acd975834e27.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libsha1-9f15f43c46c73cd0.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libdigest-5d770a9e9e6ea149.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libsubtle-2e8596ffab1ab75f.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libconst_oid-834c0e0b1604df37.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libblock_buffer-4f4761ca28d48ae4.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libcrypto_common-584dd06845a293e9.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libgeneric_array-dc3be67fb5b90830.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libtypenum-2b09589daa71d801.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libhttparse-9d194949d06437af.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libthiserror-7ecb4a699b8920d3.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/liburl-936a0b47da399149.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libidna-b5faa9c2ece42de8.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libunicode_normalization-1c164c59614d379d.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libtinyvec-5417aa7aadc151a2.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libtinyvec_macros-7959d4d6443a0458.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libunicode_bidi-106b62c41d379400.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libform_urlencoded-49bcd040a7c16576.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libpercent_encoding-477b6fb21f40da87.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/liblog-6ddcd53f5312ef38.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libcfg_if-f043d77383bd547c.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libhttp-cf4bb2360a1f828f.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libbytes-73183855b42e1e92.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libfnv-a96d0f7e079db9b2.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libchrono-08619b9cfb303392.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libiana_time_zone-8212bb41be21572b.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libcore_foundation_sys-9b0150f66877fcf2.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libnum_integer-bafe1031ea8e0662.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libtime-08e3f249427e3b17.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/liblibc-fc26f4dd5713c66f.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libcapnp-51990ee9b5227c5a.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libtoml-fe00432fe23ba335.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libserde_json-16a6e5424b301f9e.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libryu-5b49562fe5a7a929.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libitoa-1a7b4806aa6816d6.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/librust_decimal-81a1e6b928a08798.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libserde-b10975cd22772c38.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libarrayvec-f160a33dcc17dc71.rlib" "/Users/vikulikov/projects/{project_path}/target/debug/deps/libnum_traits-f8699bb15f4e50a3.rlib" "/Users/vikulikov/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libstd-8b48f6cefff7b1fb.rlib" "/Users/vikulikov/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libpanic_unwind-77aeaad8f850e496.rlib" "/Users/vikulikov/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libobject-4374cc9e76b48de5.rlib" "/Users/vikulikov/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libmemchr-71ce82846aaede9b.rlib" "/Users/vikulikov/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libaddr2line-88478a43231eec41.rlib" "/Users/vikulikov/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libgimli-219a0c42f67a2534.rlib" "/Users/vikulikov/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/librustc_demangle-967edde4cff44b15.rlib" "/Users/vikulikov/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libstd_detect-5e9bad2c7ec1f53a.rlib" "/Users/vikulikov/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcfg_if-f2d3de7828f2e1f2.rlib" "/Users/vikulikov/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libhashbrown-39feb0179b2f197f.rlib" "/Users/vikulikov/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libminiz_oxide-fe7523d51d4e2154.rlib" "/Users/vikulikov/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libadler-1fb439e2b08a54ae.rlib" "/Users/vikulikov/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/librustc_std_workspace_alloc-0ece1873dc3050cd.rlib" "/Users/vikulikov/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libunwind-1094a874bdfc7dbb.rlib" "/Users/vikulikov/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcfg_if-8cd76113b92d6775.rlib" "/Users/vikulikov/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/liblibc-3a7cb21921429c0e.rlib" "/Users/vikulikov/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/liballoc-5b42fb3902d391c7.rlib" "/Users/vikulikov/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/librustc_std_workspace_core-b495777441600026.rlib" "/Users/vikulikov/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcore-cba95c4386a21469.rlib" "/Users/vikulikov/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib/libcompiler_builtins-b8f163a13cf94b5d.rlib" "-lc++" "-lomp" "-framework" "CoreFoundation" "-framework" "SystemConfiguration" "-lc++" "-framework" "Security" "-framework" "Security" "-framework" "CoreFoundation" "-liconv" "-lSystem" "-lc" "-lm" "-L" "/Users/vikulikov/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/lib" "-o" "/Users/vikulikov/projects/{project_path}/target/debug/deps/{project}-ec57ac4e6d4eed12" "-Wl,-dead_strip" "-nodefaultlibs"
= note: ld: library not found for -lomp
clang: error: linker command failed with exit code 1 (use -v to see invocation)
warning: `{project}` (bin "{project}") generated 63 warnings
error: could not compile `{project}` due to previous error; 63 warnings emitted
Caused by:
process didn't exit successfully: `CARGO=/Users/vikulikov/.rustup/toolchains/stable-aarch64-apple-darwin/bin/cargo CARGO_BIN_NAME={project} CARGO_CRATE_NAME={project} CARGO_MANIFEST_DIR=/Users/vikulikov/projects/{project_path} CARGO_PKG_AUTHORS='' CARGO_PKG_DESCRIPTION='' CARGO_PKG_HOMEPAGE='' CARGO_PKG_LICENSE='' CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME={project} CARGO_PKG_REPOSITORY='' CARGO_PKG_RUST_VERSION='' CARGO_PKG_VERSION=0.10.7 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=10 CARGO_PKG_VERSION_PATCH=7 CARGO_PKG_VERSION_PRE='' CARGO_PRIMARY_PACKAGE=1 DYLD_FALLBACK_LIBRARY_PATH='/Users/vikulikov/projects/{project_path}/target/debug/deps:/Users/vikulikov/.rustup/toolchains/stable-aarch64-apple-darwin/lib:/Users/vikulikov/.rustup/toolchains/stable-aarch64-apple-darwin/lib:/Users/vikulikov/lib:/usr/local/lib:/usr/lib' rustc --crate-name {project} --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=ec57ac4e6d4eed12 -C extra-filename=-ec57ac4e6d4eed12 --out-dir /Users/vikulikov/projects/{project_path}/target/debug/deps -C incremental=/Users/vikulikov/projects/{project_path}/target/debug/incremental -L dependency=/Users/vikulikov/projects/{project_path}/target/debug/deps --extern anyhow=/Users/vikulikov/projects/{project_path}/target/debug/deps/libanyhow-3c4562411ebdf4c7.rlib --extern chrono=/Users/vikulikov/projects/{project_path}/target/debug/deps/libchrono-08619b9cfb303392.rlib --extern crossbeam=/Users/vikulikov/projects/{project_path}/target/debug/deps/libcrossbeam-fd8c6961f76e5aac.rlib --extern csv=/Users/vikulikov/projects/{project_path}/target/debug/deps/libcsv-1e27cf452055291a.rlib --extern itertools=/Users/vikulikov/projects/{project_path}/target/debug/deps/libitertools-b33196f4ae79cd67.rlib --extern {project_dir}=/Users/vikulikov/projects/{project_path}/target/debug/deps/lib{project_dir}-c76f044f35528d72.rlib --extern {project_dir}_core=/Users/vikulikov/projects/{project_path}/target/debug/deps/lib{project_dir}_core-ff32a9a09b2fee14.rlib --extern order_stat=/Users/vikulikov/projects/{project_path}/target/debug/deps/liborder_stat-25a20551870d634c.rlib --extern parking_lot=/Users/vikulikov/projects/{project_path}/target/debug/deps/libparking_lot-34cf09bf4119fbd2.rlib --extern rayon=/Users/vikulikov/projects/{project_path}/target/debug/deps/librayon-a368ce40113bc0f7.rlib --extern rust_decimal=/Users/vikulikov/projects/{project_path}/target/debug/deps/librust_decimal-81a1e6b928a08798.rlib --extern rust_decimal_macros=/Users/vikulikov/projects/{project_path}/target/debug/deps/librust_decimal_macros-67e08731edac8129.dylib --extern serde=/Users/vikulikov/projects/{project_path}/target/debug/deps/libserde-b10975cd22772c38.rlib --extern serde_derive=/Users/vikulikov/projects/{project_path}/target/debug/deps/libserde_derive-60aad29f37dfad23.dylib --extern serde_json=/Users/vikulikov/projects/{project_path}/target/debug/deps/libserde_json-16a6e5424b301f9e.rlib --extern tokio=/Users/vikulikov/projects/{project_path}/target/debug/deps/libtokio-86cdf7ae56108f25.rlib --extern toml=/Users/vikulikov/projects/{project_path}/target/debug/deps/libtoml-fe00432fe23ba335.rlib -L native=/Users/vikulikov/projects/{project_path}/target/debug/build/ring-66285374768a0289/out -L native=/Users/vikulikov/projects/{project_path}/target/debug/build/clickhouse-rs-cityhash-sys-56b125abd43a1bed/out -L native=/Users/vikulikov/projects/{project_path}/target/debug/build/lz4-sys-b41f36414fcf3d57/out -L /Users/vikulikov/projects/{project_path}/target/debug/build/lightgbm-sys-34cf0c5853566b8c/out/lib -L native=/Users/vikulikov/projects/{project_path}/target/debug/build/lightgbm-sys-34cf0c5853566b8c/out -L native=/Users/vikulikov/projects/{project_path}/target/debug/build/bzip2-sys-55a2969129b4a854/out/lib` (exit status: 1)
It needs the lib due to lightgbm-rs lib used in the project. I believe I've already tried all the technics needed for lightgbm to compile from the internet, even reset the OS. Installed the llvm and gcc seperately, etc.
Actions after reset:
# rust installing
brew install cmake libomp lightgbm
brew link --force libomp
cargo build
Maybe it is good to mention that lightgbm and lightgbm-sys libs are successfuly built. And crash is happenning in the very end of the build.
Actually problem occured because homebrew made libomp keg-only.
They suggest to add couple of env variables for compilers to find the lib:
For compilers to find libomp you may need to set:
export LDFLAGS="-L/opt/homebrew/opt/libomp/lib"
export CPPFLAGS="-I/opt/homebrew/opt/libomp/include"
But cargo does not respect LDFLAGS variable. So I've tried to add a RUSTFLAGS variable as:
export RUSTFLAGS=-L/opt/homebrew/opt/libomp/lib
and it worked.
While running cargo build, I'm getting the following error:
error: linking with `cc` failed: exit code: 1
|
= note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-Wl,--eh-frame-hdr" "-L" "/home/jarvis/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/home/jarvis/SRC/grid/target/debug/deps/migrations_macros-24cc179ad0cdafd6.migrations_macros.2g6ue3dg-cgu.0.rcgu.o" "/home/jarvis/SRC/grid/target/debug/deps/migrations_macros-24cc179ad0cdafd6.migrations_macros.2g6ue3dg-cgu.1.rcgu.o" "/home/jarvis/SRC/grid/target/debug/deps/migrations_macros-24cc179ad0cdafd6.migrations_macros.2g6ue3dg-cgu.10.rcgu.o" "/home/jarvis/SRC/grid/target/debug/deps/migrations_macros-24cc179ad0cdafd6.migrations_macros.2g6ue3dg-cgu.11.rcgu.o" "/home/jarvis/SRC/grid/target/debug/deps/migrations_macros-24cc179ad0cdafd6.migrations_macros.2g6ue3dg-cgu.12.rcgu.o" "/home/jarvis/SRC/grid/target/debug/deps/migrations_macros-24cc179ad0cdafd6.migrations_macros.2g6ue3dg-cgu.13.rcgu.o" "/home/jarvis/SRC/grid/target/debug/deps/migrations_macros-24cc179ad0cdafd6.migrations_macros.2g6ue3dg-cgu.14.rcgu.o" "/home/jarvis/SRC/grid/target/debug/deps/migrations_macros-24cc179ad0cdafd6.migrations_macros.2g6ue3dg-cgu.15.rcgu.o" "/home/jarvis/SRC/grid/target/debug/deps/migrations_macros-24cc179ad0cdafd6.migrations_macros.2g6ue3dg-cgu.2.rcgu.o" "/home/jarvis/SRC/grid/target/debug/deps/migrations_macros-24cc179ad0cdafd6.migrations_macros.2g6ue3dg-cgu.3.rcgu.o" "/home/jarvis/SRC/grid/target/debug/deps/migrations_macros-24cc179ad0cdafd6.migrations_macros.2g6ue3dg-cgu.4.rcgu.o" "/home/jarvis/SRC/grid/target/debug/deps/migrations_macros-24cc179ad0cdafd6.migrations_macros.2g6ue3dg-cgu.5.rcgu.o" "/home/jarvis/SRC/grid/target/debug/deps/migrations_macros-24cc179ad0cdafd6.migrations_macros.2g6ue3dg-cgu.6.rcgu.o" "/home/jarvis/SRC/grid/target/debug/deps/migrations_macros-24cc179ad0cdafd6.migrations_macros.2g6ue3dg-cgu.7.rcgu.o" "/home/jarvis/SRC/grid/target/debug/deps/migrations_macros-24cc179ad0cdafd6.migrations_macros.2g6ue3dg-cgu.8.rcgu.o" "/home/jarvis/SRC/grid/target/debug/deps/migrations_macros-24cc179ad0cdafd6.migrations_macros.2g6ue3dg-cgu.9.rcgu.o" "-o" "/home/jarvis/SRC/grid/target/debug/deps/libmigrations_macros-24cc179ad0cdafd6.so" "/home/jarvis/SRC/grid/target/debug/deps/migrations_macros-24cc179ad0cdafd6.3xjhulvvd33umm2i.rcgu.o" "/home/jarvis/SRC/grid/target/debug/deps/migrations_macros-24cc179ad0cdafd6.479uqkygm96t55vg.rcgu.o" "-Wl,--gc-sections" "-shared" "-Wl,-zrelro" "-Wl,-znow" "-nodefaultlibs" "-L" "/home/jarvis/SRC/grid/target/debug/deps" "-L" "/home/jarvis/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/home/jarvis/SRC/grid/target/debug/deps/libsyn-3ee1b9a4d6995c1a.rlib" "/home/jarvis/SRC/grid/target/debug/deps/libquote-849401de171008b7.rlib" "/home/jarvis/SRC/grid/target/debug/deps/libproc_macro2-4431be3eb037870a.rlib" "/home/jarvis/SRC/grid/target/debug/deps/libunicode_xid-373664510327a5cc.rlib" "/home/jarvis/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libproc_macro-bba0624c33176ddd.rlib" "/home/jarvis/SRC/grid/target/debug/deps/libmigrations_internals-7f9f79f1a7c23e47.rlib" "/home/jarvis/SRC/grid/target/debug/deps/libdiesel-260ed13c59074541.rlib" "/home/jarvis/SRC/grid/target/debug/deps/liblibsqlite3_sys-de81366d49fa3d10.rlib" "/home/jarvis/SRC/grid/target/debug/deps/libpq_sys-906759194dd6661c.rlib" "/home/jarvis/SRC/grid/target/debug/deps/libserde_json-22c2837401b823a3.rlib" "/home/jarvis/SRC/grid/target/debug/deps/libryu-c299d28f346c44ca.rlib" "/home/jarvis/SRC/grid/target/debug/deps/libitoa-03464e37801631ae.rlib" "/home/jarvis/SRC/grid/target/debug/deps/libserde-2784118073042576.rlib" "/home/jarvis/SRC/grid/target/debug/deps/libr2d2-cf95ef9b2bd10f2c.rlib" "/home/jarvis/SRC/grid/target/debug/deps/libscheduled_thread_pool-ad478afbdee29c90.rlib" "/home/jarvis/SRC/grid/target/debug/deps/libparking_lot-873742aff8280e98.rlib" "/home/jarvis/SRC/grid/target/debug/deps/libparking_lot_core-4da5ea6806b95c53.rlib" "/home/jarvis/SRC/grid/target/debug/deps/liblibc-1083c34519682e1b.rlib" "/home/jarvis/SRC/grid/target/debug/deps/libsmallvec-e310e2c157142037.rlib" "/home/jarvis/SRC/grid/target/debug/deps/liblock_api-c5b0a39665108282.rlib" "/home/jarvis/SRC/grid/target/debug/deps/libscopeguard-4eb98674ce111148.rlib" "/home/jarvis/SRC/grid/target/debug/deps/libinstant-a66b52fcbf3b13e3.rlib" "/home/jarvis/SRC/grid/target/debug/deps/liblog-c34c04d5bf05faba.rlib" "/home/jarvis/SRC/grid/target/debug/deps/libcfg_if-5027c5fda945db67.rlib" "/home/jarvis/SRC/grid/target/debug/deps/libbyteorder-a6db7e07f13316c2.rlib" "/home/jarvis/SRC/grid/target/debug/deps/libbitflags-f14a0d5eed0a3c48.rlib" "-Wl,--start-group" "/home/jarvis/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-6f77337c1826707d.rlib" "/home/jarvis/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-e238540f8faf9927.rlib" "/home/jarvis/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-78f8506dd5004913.rlib" "/home/jarvis/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-c0e64497deb085aa.rlib" "/home/jarvis/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-217a514dc8d845c6.rlib" "/home/jarvis/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-65e4f8df4b8bbd73.rlib" "/home/jarvis/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-fec1b74170245419.rlib" "/home/jarvis/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-e74f867eb2f15322.rlib" "/home/jarvis/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-72a374d36f3d0a31.rlib" "/home/jarvis/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-cb9206ed96de54c3.rlib" "/home/jarvis/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-33ee81149d314805.rlib" "/home/jarvis/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-2e8740599b11634b.rlib" "/home/jarvis/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-241cf59851357bea.rlib" "/home/jarvis/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-edc29aa8c04b480f.rlib" "/home/jarvis/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-6a141406945fda5a.rlib" "/home/jarvis/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-2408224b4af46d83.rlib" "-Wl,--end-group" "/home/jarvis/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-d36087076e1dd756.rlib" "-Wl,-Bdynamic" "-lsqlite3" "-lpq" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc"
= note: /usr/bin/ld: cannot find -lsqlite3
collect2: error: ld returned 1 exit status
error: aborting due to previous error
error: could not compile `migrations_macros`
Caused by:
process didn't exit successfully: `rustc --crate-name migrations_macros /home/jarvis/.cargo/registry/src/github.com-1ecc6299db9ec823/migrations_macros-1.4.2/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type proc-macro --emit=dep-info,link -C prefer-dynamic -C embed-bitcode=no -C debuginfo=2 --cfg 'feature="default"' -C metadata=24cc179ad0cdafd6 -C extra-filename=-24cc179ad0cdafd6 --out-dir /home/jarvis/SRC/grid/target/debug/deps -L dependency=/home/jarvis/SRC/grid/target/debug/deps --extern migrations_internals=/home/jarvis/SRC/grid/target/debug/deps/libmigrations_internals-7f9f79f1a7c23e47.rlib --extern proc_macro2=/home/jarvis/SRC/grid/target/debug/deps/libproc_macro2-4431be3eb037870a.rlib --extern quote=/home/jarvis/SRC/grid/target/debug/deps/libquote-849401de171008b7.rlib --extern syn=/home/jarvis/SRC/grid/target/debug/deps/libsyn-3ee1b9a4d6995c1a.rlib --extern proc_macro --cap-lints allow` (exit code: 1)
Does anyone know a fix to this?
I have tried all similar things by Googling them, none worked out.
Thanks.
I think your error originates from the fact that:
ld does not know about where your project libs are located. You have to place it into ld's known directories or specify the full path of your library by -L parameter to the linker.
Check this answer:
cpp: usr/bin/ld: cannot find -l<nameOfTheLibrary>
I'm trying to get Rust debugging to work with the JetBrains debugger.
Similar to this question, I noticed the MSVC toolchain isn't supported. I follow the instructions available there and in the JetBrains blog, and get a hello world program to debug, using a Cygwin toolchain for running and debugging.
However, whenever I use a crate that has, as I believe, bindings to native C/C++, the linker fails. This output is the output received when trying to use the ssh2 crate and running the command D:/Programs/Rust/Cargo/bin/cargo.exe run --color=always --package rust_manual --bin rust_manual --verbose (without the 80 preceding warnings):
error: linking with `x86_64-w64-mingw32-gcc` failed: exit code: 1
|
= note: "x86_64-w64-mingw32-gcc" "-fno-use-linker-plugin" "-Wl,--nxcompat" "-nostdlib" "-m64" "D:\\Programs\\Rust\\Rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\crt2.o" "D:\\Programs\\
Rust\\Rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\rsbegin.o" "-L" "D:\\Programs\\Rust\\Rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib" "D:\\
Documents\\rust_manual\\target\\debug\\deps\\rust_manual-e02c4017dbb04ce1.2il83ncbprx9skxc.rcgu.o" "D:\\Documents\\rust_manual\\target\\debug\\deps\\rust_manual-e02c4017dbb04ce1.2tkb1dtkdvpzvru8.rcgu.o" "D:\\Documents\\rust_manual\\
target\\debug\\deps\\rust_manual-e02c4017dbb04ce1.38mlr7whhiedxpa9.rcgu.o" "D:\\Documents\\rust_manual\\target\\debug\\deps\\rust_manual-e02c4017dbb04ce1.3mv2p2964hms7hcw.rcgu.o" "D:\\Documents\\rust_manual\\target\\debug\\deps\\rus
t_manual-e02c4017dbb04ce1.oyp82k1tv9dpo03.rcgu.o" "-o" "D:\\Documents\\rust_manual\\target\\debug\\deps\\rust_manual-e02c4017dbb04ce1.exe" "D:\\Documents\\rust_manual\\target\\debug\\deps\\rust_manual-e02c4017dbb04ce1.1n9qmwpghqvw10
ei.rcgu.o" "-Wl,--gc-sections" "-nodefaultlibs" "-L" "D:\\Documents\\rust_manual\\target\\debug\\deps" "-L" "D:\\Programs\\Rust\\Cargo\\registry\\src\\github.com-1ecc6299db9ec823\\winapi-x86_64-pc-windows-gnu-0.4.0\\lib" "-L" "D:\\D
ocuments\\rust_manual\\target\\debug\\build\\libssh2-sys-611fa0ef83ad9897\\out\\build" "-L" "D:\\Documents\\rust_manual\\target\\debug\\build\\libz-sys-0bd5febd50380866\\out\\build" "-L" "D:\\Programs\\Rust\\Rustup\\toolchains\\stab
le-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib" "-Wl,-Bstatic" "D:\\Documents\\rust_manual\\target\\debug\\deps\\liblinked_hash_map-8ccaf07e1678ba81.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\libfs2-
7cdf4dce3545590b.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\libaes_gcm_siv-7f08f4ec229f0194.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\libaes-9e69959843670351.rlib" "D:\\Documents\\rust_manual\\target\\debu
g\\deps\\libaes_soft-85e91b74f1d42369.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\libbyteorder-59f20df4b329d08b.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\libopaque_debug-77ca4cb51d8100fa.rlib" "D:\\Document
s\\rust_manual\\target\\debug\\deps\\libzeroize-bab8662dce816576.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\libpolyval-0f2876d6fb299760.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\libuniversal_hash-295cab4c7
b6658eb.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\libsubtle-19f12b0836f68a71.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\libaead-ef3c7269241d4b63.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\libb
lock_cipher-662444e0b79f5644.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\libgeneric_array-8edaebd677632f76.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\libtypenum-1251f48f890b7d62.rlib" "D:\\Documents\\rust_ma
nual\\target\\debug\\deps\\libserde_json-53f81e6916eb8e26.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\libryu-c8e41e31d4a509cb.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\libitoa-903fb6c5622b5617.rlib" "D:\\Do
cuments\\rust_manual\\target\\debug\\deps\\libserde-4d09c2dcdbb1d8b3.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\libssh2-7df6425f87af870e.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\libparking_lot-07aaede0978
bcf2e.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\libparking_lot_core-476c2f592babd25d.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\libsmallvec-5b2a8d31eb1a4c6d.rlib" "D:\\Documents\\rust_manual\\target\\debug
\\deps\\liblock_api-7a323e635f8733ad.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\libscopeguard-6c6d401b1f6f82b5.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\liblibssh2_sys-b34136eee9b6d61b.rlib" "D:\\Documents
\\rust_manual\\target\\debug\\deps\\liblibz_sys-5c6fdfaf87470695.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\librand-952ff6682f89685d.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\librand_chacha-0619462aab8ab8c
f.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\libppv_lite86-dc7a8f001990536b.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\librand_core-29c3a2129db92df7.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\l
ibgetrandom-60ce90fab31a9998.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\libnotify-a3f8496c1768c614.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\libwalkdir-01728b165c663904.rlib" "D:\\Documents\\rust_manual\\t
arget\\debug\\deps\\libsame_file-bade0aa981bdf286.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\libwinapi_util-aa42252baaa29f06.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\liblibc-408386b57fa89aa8.rlib" "D:\\Do
cuments\\rust_manual\\target\\debug\\deps\\libfiletime-85a1a02ff2eb4f83.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\libwinapi-fc941a2b370d489b.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\libcfg_if-cf58d0d3cd0
e6fed.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\libbitflags-288950b807dfd7f7.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\libbase64-e64b24a18f7239bc.rlib" "-Wl,--start-group" "D:\\Programs\\Rust\\Rustup\\too
lchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libstd-447f0e6919e87703.rlib" "D:\\Programs\\Rust\\Rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libpanic
_unwind-6691a7d28fd5ead6.rlib" "D:\\Programs\\Rust\\Rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libhashbrown-ee4714732ebaf9a3.rlib" "D:\\Programs\\Rust\\Rustup\\toolchains\\stable-x86_
64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\librustc_std_workspace_alloc-e062de0dbb254b6a.rlib" "D:\\Programs\\Rust\\Rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libbac
ktrace-2bc81dc380687e4b.rlib" "D:\\Programs\\Rust\\Rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libbacktrace_sys-53b5dac028b62d7c.rlib" "D:\\Programs\\Rust\\Rustup\\toolchains\\stable-x
86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\librustc_demangle-cb491f3ffc25ac52.rlib" "D:\\Programs\\Rust\\Rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libunwind-9499
c77410f0cb84.rlib" "D:\\Programs\\Rust\\Rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcfg_if-cb2a1962c04b6646.rlib" "D:\\Programs\\Rust\\Rustup\\toolchains\\stable-x86_64-pc-windows-g
nu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\liblibc-c582a1654a681be9.rlib" "D:\\Programs\\Rust\\Rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\liballoc-2285fe2f7f9a72ec.rlib" "D:\\Progr
ams\\Rust\\Rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\librustc_std_workspace_core-1a51942af531248c.rlib" "D:\\Programs\\Rust\\Rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\ru
stlib\\x86_64-pc-windows-gnu\\lib\\libcore-d7ecf429ccc8dc70.rlib" "-Wl,--end-group" "D:\\Programs\\Rust\\Rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcompiler_builtins-4fc9e886634ace
c6.rlib" "-Wl,-Bdynamic" "-lbcrypt" "-lcrypt32" "-luser32" "-lntdll" "-ladvapi32" "-lwinapi_advapi32" "-lwinapi_cfgmgr32" "-lwinapi_fwpuclnt" "-lwinapi_gdi32" "-lwinapi_kernel32" "-lwinapi_msimg32" "-lwinapi_ntdll" "-lwinapi_opengl3
2" "-lwinapi_synchronization" "-lwinapi_user32" "-lwinapi_winspool" "-lwinapi_ws2_32" "-ladvapi32" "-lws2_32" "-luserenv" "-lmingwex" "-lmingw32" "-lmsvcrt" "-lmsvcrt" "-luser32" "-lkernel32" "-lgcc_eh" "-l:libpthread.a" "-lgcc" "-l
msvcrt" "-lkernel32" "D:\\Programs\\Rust\\Rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\rsend.o"
= note: ld: cannot find -lntdll
error: aborting due to previous error; 80 warnings emitted
error: could not compile `rust_manual`.
Caused by:
process didn't exit successfully: `rustc --crate-name rust_manual --edition=2018 src\main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=e02c4017dbb04ce1 -C
extra-filename=-e02c4017dbb04ce1 --out-dir D:\Documents\rust_manual\target\debug\deps -C incremental=D:\Documents\rust_manual\target\debug\incremental -L dependency=D:\Documents\rust_manual\target\debug\deps --extern aes_gcm=D:\Docu
ments\rust_manual\target\debug\deps\libaes_gcm-46686bd39b60c02f.rlib --extern aes_gcm_siv=D:\Documents\rust_manual\target\debug\deps\libaes_gcm_siv-7f08f4ec229f0194.rlib --extern base64=D:\Documents\rust_manual\target\debug\deps\lib
base64-e64b24a18f7239bc.rlib --extern fs2=D:\Documents\rust_manual\target\debug\deps\libfs2-7cdf4dce3545590b.rlib --extern linked_hash_map=D:\Documents\rust_manual\target\debug\deps\liblinked_hash_map-8ccaf07e1678ba81.rlib --extern
notify=D:\Documents\rust_manual\target\debug\deps\libnotify-a3f8496c1768c614.rlib --extern rand=D:\Documents\rust_manual\target\debug\deps\librand-952ff6682f89685d.rlib --extern rand_core=D:\Documents\rust_manual\target\debug\deps\l
ibrand_core-29c3a2129db92df7.rlib --extern serde=D:\Documents\rust_manual\target\debug\deps\libserde-4d09c2dcdbb1d8b3.rlib --extern serde_json=D:\Documents\rust_manual\target\debug\deps\libserde_json-53f81e6916eb8e26.rlib --extern s
sh2=D:\Documents\rust_manual\target\debug\deps\libssh2-7df6425f87af870e.rlib -L native=D:\Programs\Rust\Cargo\registry\src\github.com-1ecc6299db9ec823\winapi-x86_64-pc-windows-gnu-0.4.0\lib -L native=D:\Documents\rust_manual\target\
debug\build\libssh2-sys-611fa0ef83ad9897\out\build -L native=D:\Documents\rust_manual\target\debug\build\libz-sys-0bd5febd50380866\out\build` (exit code: 1)
The reason for this error, I believe, is summarized in the GCC-WARNING.txt file:
gcc.exe contained in this folder cannot be used for compiling C files - it is only used as a linker. In order to be able to compile projects containing C code use the GCC provided by MinGW or Cygwin.
I tried setting the toolchain to use the correct linker. The cargo documentation says that the config file allows me to do this with the following lines:
[target.x86_64-pc-windows-gnu]
linker = "D:\\Programs\\Cygwin\\bin\\gcc.exe"
Again, this works fine without the ssh2 crate, but fails with the following output when the crate is enabled;
error: linking with `D:\Programs\Cygwin\bin\gcc.exe` failed: exit code: 1
|
= note: "D:\\Programs\\Cygwin\\bin\\gcc.exe" "-fno-use-linker-plugin" "-Wl,--nxcompat" "-nostdlib" "-m64" "D:\\Programs\\Rust\\Rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\crt2.o" "D:
\\Programs\\Rust\\Rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\rsbegin.o" "-L" "D:\\Programs\\Rust\\Rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu
\\lib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\rust_manual-e02c4017dbb04ce1.2il83ncbprx9skxc.rcgu.o" "D:\\Documents\\rust_manual\\target\\debug\\deps\\rust_manual-e02c4017dbb04ce1.2tkb1dtkdvpzvru8.rcgu.o" "D:\\Documents\\r
ust_manual\\target\\debug\\deps\\rust_manual-e02c4017dbb04ce1.38mlr7whhiedxpa9.rcgu.o" "D:\\Documents\\rust_manual\\target\\debug\\deps\\rust_manual-e02c4017dbb04ce1.3mv2p2964hms7hcw.rcgu.o" "D:\\Documents\\rust_manual\\target\\debu
g\\deps\\rust_manual-e02c4017dbb04ce1.oyp82k1tv9dpo03.rcgu.o" "-o" "D:\\Documents\\rust_manual\\target\\debug\\deps\\rust_manual-e02c4017dbb04ce1.exe" "D:\\Documents\\rust_manual\\target\\debug\\deps\\rust_manual-e02c4017dbb04ce1.1n
9qmwpghqvw10ei.rcgu.o" "-Wl,--gc-sections" "-nodefaultlibs" "-L" "D:\\Documents\\rust_manual\\target\\debug\\deps" "-L" "D:\\Programs\\Rust\\Cargo\\registry\\src\\github.com-1ecc6299db9ec823\\winapi-x86_64-pc-windows-gnu-0.4.0\\lib"
"-L" "D:\\Documents\\rust_manual\\target\\debug\\build\\libssh2-sys-611fa0ef83ad9897\\out\\build" "-L" "D:\\Documents\\rust_manual\\target\\debug\\build\\libz-sys-0bd5febd50380866\\out\\build" "-L" "D:\\Programs\\Rust\\Rustup\\tool
chains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib" "-Wl,-Bstatic" "D:\\Documents\\rust_manual\\target\\debug\\deps\\liblinked_hash_map-8ccaf07e1678ba81.rlib" "D:\\Documents\\rust_manual\\target\\debug\\d
eps\\libfs2-7cdf4dce3545590b.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\libaes_gcm_siv-7f08f4ec229f0194.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\libaes-9e69959843670351.rlib" "D:\\Documents\\rust_manual\\
target\\debug\\deps\\libaes_soft-85e91b74f1d42369.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\libbyteorder-59f20df4b329d08b.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\libopaque_debug-77ca4cb51d8100fa.rlib" "
D:\\Documents\\rust_manual\\target\\debug\\deps\\libzeroize-bab8662dce816576.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\libpolyval-0f2876d6fb299760.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\libuniversal_ha
sh-295cab4c7b6658eb.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\libsubtle-19f12b0836f68a71.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\libaead-ef3c7269241d4b63.rlib" "D:\\Documents\\rust_manual\\target\\debug
\\deps\\libblock_cipher-662444e0b79f5644.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\libgeneric_array-8edaebd677632f76.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\libtypenum-1251f48f890b7d62.rlib" "D:\\Docume
nts\\rust_manual\\target\\debug\\deps\\libserde_json-53f81e6916eb8e26.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\libryu-c8e41e31d4a509cb.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\libitoa-903fb6c5622b5617.r
lib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\libserde-4d09c2dcdbb1d8b3.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\libssh2-7df6425f87af870e.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\libparking_lot
-07aaede0978bcf2e.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\libparking_lot_core-476c2f592babd25d.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\libsmallvec-5b2a8d31eb1a4c6d.rlib" "D:\\Documents\\rust_manual\\t
arget\\debug\\deps\\liblock_api-7a323e635f8733ad.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\libscopeguard-6c6d401b1f6f82b5.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\liblibssh2_sys-b34136eee9b6d61b.rlib" "D
:\\Documents\\rust_manual\\target\\debug\\deps\\liblibz_sys-5c6fdfaf87470695.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\librand-952ff6682f89685d.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\librand_chacha-061
9462aab8ab8cf.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\libppv_lite86-dc7a8f001990536b.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\librand_core-29c3a2129db92df7.rlib" "D:\\Documents\\rust_manual\\target\\de
bug\\deps\\libgetrandom-60ce90fab31a9998.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\libnotify-a3f8496c1768c614.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\libwalkdir-01728b165c663904.rlib" "D:\\Documents\\ru
st_manual\\target\\debug\\deps\\libsame_file-bade0aa981bdf286.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\libwinapi_util-aa42252baaa29f06.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\liblibc-408386b57fa89aa8.r
lib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\libfiletime-85a1a02ff2eb4f83.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\libwinapi-fc941a2b370d489b.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\libcfg_if
-cf58d0d3cd0e6fed.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\libbitflags-288950b807dfd7f7.rlib" "D:\\Documents\\rust_manual\\target\\debug\\deps\\libbase64-e64b24a18f7239bc.rlib" "-Wl,--start-group" "D:\\Programs\\Rust\
\Rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libstd-447f0e6919e87703.rlib" "D:\\Programs\\Rust\\Rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\l
ib\\libpanic_unwind-6691a7d28fd5ead6.rlib" "D:\\Programs\\Rust\\Rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libhashbrown-ee4714732ebaf9a3.rlib" "D:\\Programs\\Rust\\Rustup\\toolchains\
\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\librustc_std_workspace_alloc-e062de0dbb254b6a.rlib" "D:\\Programs\\Rust\\Rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\
\lib\\libbacktrace-2bc81dc380687e4b.rlib" "D:\\Programs\\Rust\\Rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libbacktrace_sys-53b5dac028b62d7c.rlib" "D:\\Programs\\Rust\\Rustup\\toolchai
ns\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\librustc_demangle-cb491f3ffc25ac52.rlib" "D:\\Programs\\Rust\\Rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\li
bunwind-9499c77410f0cb84.rlib" "D:\\Programs\\Rust\\Rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcfg_if-cb2a1962c04b6646.rlib" "D:\\Programs\\Rust\\Rustup\\toolchains\\stable-x86_64-
pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\liblibc-c582a1654a681be9.rlib" "D:\\Programs\\Rust\\Rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\liballoc-2285fe2f7f9a72ec.rlib
" "D:\\Programs\\Rust\\Rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\librustc_std_workspace_core-1a51942af531248c.rlib" "D:\\Programs\\Rust\\Rustup\\toolchains\\stable-x86_64-pc-windows-
gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcore-d7ecf429ccc8dc70.rlib" "-Wl,--end-group" "D:\\Programs\\Rust\\Rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcompiler_builtins-4f
c9e886634acec6.rlib" "-Wl,-Bdynamic" "-lbcrypt" "-lcrypt32" "-luser32" "-lntdll" "-ladvapi32" "-lwinapi_advapi32" "-lwinapi_cfgmgr32" "-lwinapi_fwpuclnt" "-lwinapi_gdi32" "-lwinapi_kernel32" "-lwinapi_msimg32" "-lwinapi_ntdll" "-lwi
napi_opengl32" "-lwinapi_synchronization" "-lwinapi_user32" "-lwinapi_winspool" "-lwinapi_ws2_32" "-ladvapi32" "-lws2_32" "-luserenv" "-lmingwex" "-lmingw32" "-lmsvcrt" "-lmsvcrt" "-luser32" "-lkernel32" "-lgcc_eh" "-l:libpthread.a"
"-lgcc" "-lmsvcrt" "-lkernel32" "D:\\Programs\\Rust\\Rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\rsend.o"
= note: /usr/lib/gcc/x86_64-pc-cygwin/9.3.0/../../../../x86_64-pc-cygwin/bin/ld: D:\\Documents\\rust_manual\\target\\debug\\deps\\liblibssh2_sys-b34136eee9b6d61b.rlib(channel.o): in function `_libssh2_channel_free':
/cygdrive/d/Programs/Rust/Cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.2.18/libssh2/src/channel.c:2723: undefined reference to `__assert_func'
/cygdrive/d/Programs/Rust/Cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.2.18/libssh2/src/channel.c:2723:(.text$_libssh2_channel_free+0x3a): relocation truncated to fit: R_X86_64_PC32 against undefined symbol
`__assert_func'
/usr/lib/gcc/x86_64-pc-cygwin/9.3.0/../../../../x86_64-pc-cygwin/bin/ld: D:\\Documents\\rust_manual\\target\\debug\\deps\\liblibssh2_sys-b34136eee9b6d61b.rlib(sftp.o): in function `sftp_init':
/cygdrive/d/Programs/Rust/Cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.2.18/libssh2/src/sftp.c:790: undefined reference to `__assert_func'
/cygdrive/d/Programs/Rust/Cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.2.18/libssh2/src/sftp.c:790:(.text$sftp_init+0x48): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `__assert_func'
/usr/lib/gcc/x86_64-pc-cygwin/9.3.0/../../../../x86_64-pc-cygwin/bin/ld: D:\\Documents\\rust_manual\\target\\debug\\deps\\liblibssh2_sys-b34136eee9b6d61b.rlib(sftp.o): in function `sftp_read':
/cygdrive/d/Programs/Rust/Cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.2.18/libssh2/src/sftp.c:1459: undefined reference to `__assert_func'
/cygdrive/d/Programs/Rust/Cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.2.18/libssh2/src/sftp.c:1459:(.text$sftp_read+0x23a): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `__assert_fun
c'
/usr/lib/gcc/x86_64-pc-cygwin/9.3.0/../../../../x86_64-pc-cygwin/bin/ld: /cygdrive/d/Programs/Rust/Cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.2.18/libssh2/src/sftp.c:1460: undefined reference to `__assert
_func'
/cygdrive/d/Programs/Rust/Cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.2.18/libssh2/src/sftp.c:1460:(.text$sftp_read+0x26c): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `__assert_fun
c'
/usr/lib/gcc/x86_64-pc-cygwin/9.3.0/../../../../x86_64-pc-cygwin/bin/ld: /cygdrive/d/Programs/Rust/Cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.2.18/libssh2/src/sftp.c:1720: undefined reference to `__assert
_func'
/cygdrive/d/Programs/Rust/Cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.2.18/libssh2/src/sftp.c:1720:(.text$sftp_read+0x968): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `__assert_fun
c'
/usr/lib/gcc/x86_64-pc-cygwin/9.3.0/../../../../x86_64-pc-cygwin/bin/ld: D:\\Documents\\rust_manual\\target\\debug\\deps\\liblibssh2_sys-b34136eee9b6d61b.rlib(sftp.o):/cygdrive/d/Programs/Rust/Cargo/registry/src/github.com
-1ecc6299db9ec823/libssh2-sys-0.2.18/libssh2/src/sftp.c:2648: more undefined references to `__assert_func' follow
D:\\Documents\\rust_manual\\target\\debug\\deps\\liblibssh2_sys-b34136eee9b6d61b.rlib(sftp.o): in function `sftp_close_handle':
/cygdrive/d/Programs/Rust/Cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.2.18/libssh2/src/sftp.c:2648:(.text$sftp_close_handle+0x305): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `__as
sert_func'
D:\\Documents\\rust_manual\\target\\debug\\deps\\liblibssh2_sys-b34136eee9b6d61b.rlib(transport.o): in function `decrypt':
/cygdrive/d/Programs/Rust/Cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.2.18/libssh2/src/transport.c:139:(.text$decrypt+0x63): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `__assert_fu
nc'
D:\\Documents\\rust_manual\\target\\debug\\deps\\liblibssh2_sys-b34136eee9b6d61b.rlib(transport.o): in function `_libssh2_transport_read':
/cygdrive/d/Programs/Rust/Cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.2.18/libssh2/src/transport.c:349:(.text$_libssh2_transport_read+0x13c): relocation truncated to fit: R_X86_64_PC32 against undefined sy
mbol `__assert_func'
/usr/lib/gcc/x86_64-pc-cygwin/9.3.0/../../../../x86_64-pc-cygwin/bin/ld: D:\\Documents\\rust_manual\\target\\debug\\deps\\liblibssh2_sys-b34136eee9b6d61b.rlib(userauth.o): in function `memory_read_publickey':
/cygdrive/d/Programs/Rust/Cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.2.18/libssh2/src/userauth.c:511: undefined reference to `__locale_ctype_ptr'
/cygdrive/d/Programs/Rust/Cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.2.18/libssh2/src/userauth.c:511:(.text$memory_read_publickey+0xaa): relocation truncated to fit: R_X86_64_PC32 against undefined symbol
`__locale_ctype_ptr'
/usr/lib/gcc/x86_64-pc-cygwin/9.3.0/../../../../x86_64-pc-cygwin/bin/ld: D:\\Documents\\rust_manual\\target\\debug\\deps\\liblibssh2_sys-b34136eee9b6d61b.rlib(userauth.o): in function `file_read_publickey':
/cygdrive/d/Programs/Rust/Cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.2.18/libssh2/src/userauth.c:613: undefined reference to `__locale_ctype_ptr'
/cygdrive/d/Programs/Rust/Cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.2.18/libssh2/src/userauth.c:613:(.text$file_read_publickey+0x1a5): relocation truncated to fit: R_X86_64_PC32 against undefined symbol
`__locale_ctype_ptr'
collect2: error: ld returned 1 exit status
error: aborting due to previous error; 80 warnings emitted
error: could not compile `rust_manual`.
Caused by:
process didn't exit successfully: `rustc --crate-name rust_manual --edition=2018 src\main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=e02c4017dbb04ce1 -C
extra-filename=-e02c4017dbb04ce1 --out-dir D:\Documents\rust_manual\target\debug\deps -C linker=D:\Programs\Cygwin\bin\gcc.exe -C incremental=D:\Documents\rust_manual\target\debug\incremental -L dependency=D:\Documents\rust_manual\t
arget\debug\deps --extern aes_gcm=D:\Documents\rust_manual\target\debug\deps\libaes_gcm-46686bd39b60c02f.rlib --extern aes_gcm_siv=D:\Documents\rust_manual\target\debug\deps\libaes_gcm_siv-7f08f4ec229f0194.rlib --extern base64=D:\Do
cuments\rust_manual\target\debug\deps\libbase64-e64b24a18f7239bc.rlib --extern fs2=D:\Documents\rust_manual\target\debug\deps\libfs2-7cdf4dce3545590b.rlib --extern linked_hash_map=D:\Documents\rust_manual\target\debug\deps\liblinked
_hash_map-8ccaf07e1678ba81.rlib --extern notify=D:\Documents\rust_manual\target\debug\deps\libnotify-a3f8496c1768c614.rlib --extern rand=D:\Documents\rust_manual\target\debug\deps\librand-952ff6682f89685d.rlib --extern rand_core=D:\
Documents\rust_manual\target\debug\deps\librand_core-29c3a2129db92df7.rlib --extern serde=D:\Documents\rust_manual\target\debug\deps\libserde-4d09c2dcdbb1d8b3.rlib --extern serde_json=D:\Documents\rust_manual\target\debug\deps\libse
rde_json-53f81e6916eb8e26.rlib --extern ssh2=D:\Documents\rust_manual\target\debug\deps\libssh2-7df6425f87af870e.rlib -L native=D:\Programs\Rust\Cargo\registry\src\github.com-1ecc6299db9ec823\winapi-x86_64-pc-windows-gnu-0.4.0\lib -
L native=D:\Documents\rust_manual\target\debug\build\libssh2-sys-611fa0ef83ad9897\out\build -L native=D:\Documents\rust_manual\target\debug\build\libz-sys-0bd5febd50380866\out\build` (exit code: 1)
The output indicates to me that Rust is not linking the correct files. However, I have no idea how to solve this. I tried searching the web for similar problems, but couldn't find any that matched mine. If I missed something though, feel free to point me in the right direction.
Disclaimers:
The main goal of this question is to get debugging with JetBrains CLion working. Thus, alternative ways for achieving this outside my current attempts are also welcome.
I am new to Rust, and have limited knowledge of C/C++ compilers and linkers.
I'm trying to make a Rust program that statically links against libusb, using the MSVC toolchain, but it blows up at run-time from a missing DLL:
error: process didn't exit successfully: `target\debug\test_libusb.exe` (exit code: 0xc0000135, STATUS_DLL_NOT_FOUND)
I used Dependency Walker to find that the missing DLL is LIBUSB-1.0.DLL. Adding it to the project solves the problem and so does dynamically linking everything, but I would like to avoid this solution.
My starting point was this libusb-sys crate, but since it didn't work I made a simpler similar crate. I got libusb from vcpkg.
libusb-sys/src/lib.rs
extern crate libc;
use libc::c_char;
#[repr(C)]
pub struct libusb_version {
pub major: u16,
pub minor: u16,
pub micro: u16,
pub nano: u16,
pub rc: *const c_char,
pub describe: *const c_char,
}
#[link(name = "libusb-1.0", kind = "static")]
extern "C" {
pub fn libusb_get_version() -> *const libusb_version;
}
libusb-sys/Cargo.toml
[package]
name = "libusb-sys"
version = "0.1.0"
build = "build.rs"
link = "libusb-1.0"
[dependencies]
libc = "0.2"
libusb-sys/build.rs
fn main() {
println!("
cargo:rustc-link-lib=static=libusb-1.0
cargo:rustc-link-search=native=C:/vcpkg/packages/libusb_x64-windows/lib")
}
Then I used this on my program's crate:
test_libusb/src/main.rs
extern crate libusb_sys as ffi;
fn main() {
unsafe {
let version = ffi::libusb_get_version();
println!(
"libusb v{}.{}.{}.{}",
(*version).major,
(*version).minor,
(*version).micro,
(*version).nano
);
}
}
test_libusb/Cargo.toml
[package]
name = "test_libusb"
version = "0.1.0"
[dependencies]
"libusb-sys" = { path = "../libusb-sys" }
Here's the entire compiler output, in case it's helpful:
G:\programming\rust\test_libusb> cargo run --verbose
Compiling libc v0.2.58
Compiling libusb-sys v0.1.0 (G:\programming\rust\libusb-sys)
Running `rustc --crate-name build_script_build C:\Users\slysherz\.cargo\registry\src\github.com-1ecc6299db9ec823\libc-0.2.58\build.rs --color always --crate-type bin --emit=dep-info,link -C debuginfo=2 --cfg "feature=\"default\"" --cfg "feature=\"std\"" -C metadata=f83941a94611be11 -C extra-filename=-f83941a94611be11 --out-dir G:\programming\rust\test_libusb\target\debug\build\libc-f83941a94611be11 -L dependency=G:\programming\rust\test_libusb\target\debug\deps --cap-lints allow`
Running `rustc --crate-name build_script_build G:\programming\rust\libusb-sys\build.rs --color always --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=71e53c2aee584c72 -C extra-filename=-71e53c2aee584c72 --out-dir G:\programming\rust\test_libusb\target\debug\build\libusb-sys-71e53c2aee584c72 -C incremental=G:\programming\rust\test_libusb\target\debug\incremental -L dependency=G:\programming\rust\test_libusb\target\debug\deps`
Running `G:\programming\rust\test_libusb\target\debug\build\libusb-sys-71e53c2aee584c72\build-script-build`
Running `G:\programming\rust\test_libusb\target\debug\build\libc-f83941a94611be11\build-script-build`
Running `rustc --crate-name libc C:\Users\slysherz\.cargo\registry\src\github.com-1ecc6299db9ec823\libc-0.2.58\src\lib.rs --color always --crate-type lib --emit=dep-info,link -C debuginfo=2 --cfg "feature=\"default\"" --cfg "feature=\"std\"" -C metadata=b67580e06366e753 -C extra-filename=-b67580e06366e753 --out-dir G:\programming\rust\test_libusb\target\debug\deps -L dependency=G:\programming\rust\test_libusb\target\debug\deps --cap-lints allow --cfg libc_priv_mod_use --cfg libc_union --cfg libc_const_size_of --cfg libc_align --cfg libc_core_cvoid --cfg libc_packedN`
Running `rustc --crate-name libusb_sys G:\programming\rust\libusb-sys\src\lib.rs --color always --crate-type lib --emit=dep-info,link -C debuginfo=2 -C metadata=94e8ef72b03c18f5 -C extra-filename=-94e8ef72b03c18f5 --out-dir G:\programming\rust\test_libusb\target\debug\deps -C incremental=G:\programming\rust\test_libusb\target\debug\incremental -L dependency=G:\programming\rust\test_libusb\target\debug\deps --extern libc=G:\programming\rust\test_libusb\target\debug\deps\liblibc-b67580e06366e753.rlib -L native=C:/vcpkg/packages/libusb_x64-windows/lib -l static=libusb-1.0`
Compiling test_libusb v0.1.0 (G:\programming\rust\test_libusb)
Running `rustc --crate-name test_libusb src\main.rs --color always --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=8f2bb1a8f56e2223 -C extra-filename=-8f2bb1a8f56e2223 --out-dir G:\programming\rust\test_libusb\target\debug\deps -C incremental=G:\programming\rust\test_libusb\target\debug\incremental -L dependency=G:\programming\rust\test_libusb\target\debug\deps --extern libusb_sys=G:\programming\rust\test_libusb\target\debug\deps\liblibusb_sys-94e8ef72b03c18f5.rlib -L native=C:/vcpkg/packages/libusb_x64-windows/lib`
Finished dev [unoptimized + debuginfo] target(s) in 1.20s
Running `target\debug\test_libusb.exe`
error: process didn't exit successfully: `target\debug\test_libusb.exe` (exit code: 0xc0000135, STATUS_DLL_NOT_FOUND)
Even after compiling libusb from scratch with VS 2017 I still get a link error:
= note: test_libusb-528eb6acc7e5c681.3w5rrhap2r2yw5if.rcgu.o : error LNK2019: unresolved external symbol libusb_get_version referenced in function _ZN11test_libusb4main17hcb0c36db62706c3bE
G:\programming\rust\test_libusb\target\debug\deps\test_libusb-528eb6acc7e5c681.exe : fatal error LNK1120: 1 unresolved externals
When I call this function directly from the first crate it works though.
I've started to learn Rust recently, so I'm not sure about how any of this works. Why does Rust try to load a DLL in this situation?
#Shepmaster was right, the libusb:x64-windows triplet for vcpkg only contains definitions that try to call the real functions from the DLL.
I tried to load this library from a simple C program and I got the exact same error:
test.c
#include "C:\vcpkg\installed\x64-windows\include\libusb-1.0\libusb.h"
int main()
{
const struct libusb_version *version = libusb_get_version();
printf("Version %d.%d.%d", version->major, version->minor, version->micro);
}
compiled with:
cl test.c /link C:\vcpkg\installed\x64-windows\lib\libusb-1.0.lib
results in the same missing DLL error. But if I do with with the different libusb:x64-windows-static triplet:
test.c
#pragma comment(lib, "Advapi32.lib")
#include "C:\vcpkg\installed\x64-windows-static\include\libusb-1.0\libusb.h"
int main()
{
const struct libusb_version *version = libusb_get_version();
printf("Version %d.%d.%d", version->major, version->minor, version->micro);
}
compiled with:
cl test.c /link C:\vcpkg\installed\x64-windows-static\lib\libusb-1.0.lib
works just fine:
>test.exe
Version 1.0.22
To sum it up, if you want to statically link a Rust program against libusb, download vspkg and install
vcpkg.exe install libusb:x64-windows-static.
Set an environment variable LIBUSB_DIR that points to C:\vcpkg\installed\x64-windows-static and use the patched version of libusb-sys by putting this in your
Cargo.toml:
[dependencies]
libusb = "0.3"
libusb-sys = "0.2.3"
[patch.crates-io]
"libusb-sys" = { git = "https://github.com/cmsd2/libusb-sys" }
The system has been useing Macports. I configured the system exactly as per the line by line instructions of these guidelines. In the process I got the error below. The only change I have from it is that instead of using easy_install I did easy_install-2.6. I feel it is a CXX error something which is kind of above my knowledge. Can some one help me in setting up my Mac correctly? I am a heavy user of Xcode (iPhone development) and a Roboticist and need a compiler for executing C files. I would also be willing on working with Python for this and future setups (wsgi applications). I have a 64-bit OSX Lion running currently.
{-------------------------------------------------------------------------------
-- The CXX compiler identification is GNU
-- Checking whether C compiler has -isysroot
-- Checking whether C compiler has -isysroot - yes
-- Checking whether C compiler supports OSX deployment target flag
-- Checking whether C compiler supports OSX deployment target flag - yes
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Checking whether CXX compiler has -isysroot
-- Checking whether CXX compiler has -isysroot - yes
-- Checking whether CXX compiler supports OSX deployment target flag
-- Checking whether CXX compiler supports OSX deployment target flag - yes
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
[rosbuild] Building package rosconsole
[rosbuild] Cached build flags older than manifests; calling rospack to get flags
[rosbuild] Including /Users/rajeshmedampudi/ros/ros_comm/clients/roslisp/cmake/roslisp.cmake
[rosbuild] Including /Users/rajeshmedampudi/ros/ros_comm/clients/rospy/cmake/rospy.cmake
[rosbuild] Including /Users/rajeshmedampudi/ros/ros_comm/clients/cpp/roscpp/cmake/roscpp.cmake
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/rajeshmedampudi/ros/ros_comm/tools/rosconsole/build
cd build && make -l8
Scanning dependencies of target rospack_genmsg_libexe
[ 0%] Built target rospack_genmsg_libexe
Scanning dependencies of target rosbuild_precompile
[ 0%] Built target rosbuild_precompile
Scanning dependencies of target rosconsole
[ 50%] Building CXX object CMakeFiles/rosconsole.dir/src/rosconsole/rosconsole.o
/Users/rajeshmedampudi/ros/ros_comm/tools/rosconsole/src/rosconsole/rosconsole.cpp:684: internal compiler error: Segmentation fault: 11
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://developer.apple.com/bugreporter> for instructions.
make[3]: *** [CMakeFiles/rosconsole.dir/src/rosconsole/rosconsole.o] Error 1
make[2]: *** [CMakeFiles/rosconsole.dir/all] Error 2
make[1]: *** [all] Error 2
-------------------------------------------------------------------------------}
[ rosmake ] Output from build of package rosconsole written to:
[ rosmake ] /Users/rajeshmedampudi/.ros/rosmake/rosmake_output-20111107-233014/rosconsole/build_output.log
[rosmake-4] Finished <<< rosconsole [FAIL] [ 7.71 seconds ]
[ rosmake ] Halting due to failure in package rosconsole.
[ rosmake ] Waiting for other threads to complete.
[rosmake-0] Finished <<< rosunit [PASS] [ 24.44 seconds ]
[rosmake-5] Finished <<< rosgraph [PASS] [ 24.44 seconds ]
[rosmake-6] Finished <<< std_msgs [PASS] [ 24.44 seconds ]
[ rosmake ] Results:
[ rosmake ] Built 28 packages with 1 failures.
[ rosmake ] Summary output to directory
[ rosmake ] /Users/rajeshmedampudi/.ros/rosmake/rosmake_output-20111107-233014
Traceback (most recent call last):
File "/usr/local/bin/rosinstall", line 5, in <module>
pkg_resources.run_script('rosinstall==0.5.22', 'rosinstall')
File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/pkg_resources.py", line 489, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/pkg_resources.py", line 1214, in run_script
exec script_code in namespace, namespace
File "/Library/Python/2.6/site-packages/rosinstall-0.5.22-py2.6.egg/EGG-INFO/scripts/rosinstall", line 679, in <module>
File "/Library/Python/2.6/site-packages/rosinstall-0.5.22-py2.6.egg/EGG-INFO/scripts/rosinstall", line 670, in rosinstall_main
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 488, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'source /Users/rajeshmedampudi/ros/setup.sh && rosmake ros ros_comm --rosdep-install' returned non-zero exit status 1
This is the Config problem i am having while i am trying to compile with my current llvm-gcc
This is the config.log(in full) as you already must be knowing i am a little inexperienced with the compiler changes and all...
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by llvm configure 3.1svn, which was
generated by GNU Autoconf 2.60. Invocation command line was
$ ./configure --prefix=/opt --enable-optimized
## --------- ##
## Platform. ##
## --------- ##
hostname = Rajeshs-Mac-Pro.local
uname -m = x86_64
uname -r = 11.2.0
uname -s = Darwin
uname -v = Darwin Kernel Version 11.2.0: Tue Aug 9 20:54:00 PDT 2011; root:xnu-1699.24.8~1/RELEASE_X86_64
/usr/bin/uname -p = i386
/bin/uname -X = unknown
/bin/arch = unknown
/usr/bin/arch -k = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo = Mach kernel version:
Darwin Kernel Version 11.2.0: Tue Aug 9 20:54:00 PDT 2011; root:xnu-1699.24.8~1/RELEASE_X86_64
Kernel configured for up to 8 processors.
4 processors are physically available.
8 processors are logically available.
Processor type: i486 (Intel 80486)
Processors active: 0 1 2 3 4 5 6 7
Primary memory available: 8.00 gigabytes
Default processor set: 141 tasks, 759 threads, 8 processors
Load average: 0.99, Mach factor: 7.00
/bin/machine = unknown
/usr/bin/oslevel = unknown
/bin/universe = unknown
PATH: /Library/Frameworks/Python.framework/Versions/2.7/bin
PATH: /opt/local/bin
PATH: /opt/local/sbin
PATH: /opt/local/bin
PATH: /opt/local/sbin
PATH: /Library/Frameworks/Python.framework/Versions/2.6/bin
PATH: /opt/local/bin
PATH: /opt/local/sbin
PATH: /opt/local/bin
PATH: /opt/local/sbin
PATH: /usr/local/mysql/bin
PATH: /usr/bin
PATH: /bin
PATH: /usr/sbin
PATH: /sbin
PATH: /usr/local/bin
PATH: /usr/X11/bin
## ----------- ##
## Core tests. ##
## ----------- ##
configure:2067: checking for C compiler version
configure:2074: clang --version >&5
Apple clang version 3.0 (tags/Apple/clang-211.10.1) (based on LLVM 3.0svn)
Target: x86_64-apple-darwin11.2.0
Thread model: posix
configure:2077: $? = 0
configure:2084: clang -v >&5
Apple clang version 3.0 (tags/Apple/clang-211.10.1) (based on LLVM 3.0svn)
Target: x86_64-apple-darwin11.2.0
Thread model: posix
configure:2087: $? = 0
configure:2094: clang -V >&5
clang: error: argument to '-V' is missing (expected 1 value)
clang: error: no input files
configure:2097: $? = 1
configure:2120: checking for C compiler default output file name
configure:2147: clang -Qunused-arguments -Qunused-arguments conftest.c >&5
configure:2150: $? = 0
configure:2196: result: a.out
configure:2201: checking whether the C compiler works
configure:2211: ./a.out
configure:2214: $? = 0
configure:2231: result: yes
configure:2238: checking whether we are cross compiling
configure:2240: result: no
configure:2243: checking for suffix of executables
configure:2250: clang -o conftest -Qunused-arguments -Qunused-arguments conftest.c >&5
configure:2253: $? = 0
configure:2277: result:
configure:2283: checking for suffix of object files
configure:2309: clang -c -Qunused-arguments -Qunused-arguments conftest.c >&5
configure:2312: $? = 0
configure:2335: result: o
configure:2339: checking whether we are using the GNU C compiler
configure:2368: clang -c -Qunused-arguments -Qunused-arguments conftest.c >&5
configure:2374: $? = 0
configure:2381: test -z "$ac_c_werror_flag" || test ! -s conftest.err
configure:2384: $? = 0
configure:2391: test -s conftest.o
configure:2394: $? = 0
configure:2408: result: yes
configure:2413: checking whether clang accepts -g
configure:2443: clang -c -g -Qunused-arguments conftest.c >&5
configure:2449: $? = 0
configure:2456: test -z "$ac_c_werror_flag" || test ! -s conftest.err
configure:2459: $? = 0
configure:2466: test -s conftest.o
configure:2469: $? = 0
configure:2599: result: yes
configure:2616: checking for clang option to accept ISO C89
configure:2690: clang -c -Qunused-arguments -Qunused-arguments conftest.c >&5
configure:2696: $? = 0
configure:2703: test -z "$ac_c_werror_flag" || test ! -s conftest.err
configure:2706: $? = 0
configure:2713: test -s conftest.o
configure:2716: $? = 0
configure:2736: result: none needed
configure:2870: checking for C++ compiler version
configure:2877: llvm-g++ --version >&5
i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)
Copyright (C) 2007 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.
configure:2880: $? = 0
configure:2887: llvm-g++ -v >&5
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.1~1/src/configure --disable-checking --enable-werror --prefix=/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.1~1/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)
configure:2890: $? = 0
configure:2897: llvm-g++ -V >&5
llvm-g++-4.2: argument to `-V' is missing
configure:2900: $? = 1
configure:2903: checking whether we are using the GNU C++ compiler
configure:2932: llvm-g++ -c -Qunused-arguments conftest.cpp >&5
configure:2938: $? = 0
configure:2945: test -z "$ac_cxx_werror_flag" || test ! -s conftest.err
configure:2948: $? = 0
configure:2955: test -s conftest.o
configure:2958: $? = 0
configure:2972: result: yes
configure:2977: checking whether llvm-g++ accepts -g
configure:3007: llvm-g++ -c -g -Qunused-arguments conftest.cpp >&5
configure:3013: $? = 0
configure:3020: test -z "$ac_cxx_werror_flag" || test ! -s conftest.err
configure:3023: $? = 0
configure:3030: test -s conftest.o
configure:3033: $? = 0
configure:3163: result: yes
configure:3191: checking how to run the C preprocessor
configure:3321: result: llvm-gcc-4.2
configure:3350: llvm-gcc-4.2 -Qunused-arguments conftest.c
conftest.c:13: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'error'
configure:3356: $? = 1
configure: failed program was:
| /* confdefs.h. */
| #define PACKAGE_NAME "llvm"
| #define PACKAGE_TARNAME "-llvm-"
| #define PACKAGE_VERSION "3.1svn"
| #define PACKAGE_STRING "llvm 3.1svn"
| #define PACKAGE_BUGREPORT "llvmbugs#cs.uiuc.edu"
| /* end confdefs.h. */
| #ifdef __STDC__
| # include <limits.h>
| #else
| # include <assert.h>
| #endif
| Syntax error
configure:3350: llvm-gcc-4.2 -Qunused-arguments conftest.c
conftest.c:13: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'error'
configure:3356: $? = 1
configure: failed program was:
| /* confdefs.h. */
| #define PACKAGE_NAME "llvm"
| #define PACKAGE_TARNAME "-llvm-"
| #define PACKAGE_VERSION "3.1svn"
| #define PACKAGE_STRING "llvm 3.1svn"
| #define PACKAGE_BUGREPORT "llvmbugs#cs.uiuc.edu"
| /* end confdefs.h. */
| #ifdef __STDC__
| # include <limits.h>
| #else
| # include <assert.h>
| #endif
| Syntax error
configure:3432: error: C preprocessor "llvm-gcc-4.2" fails sanity check
See `config.log' for more details.
## ---------------- ##
## Cache variables. ##
## ---------------- ##
ac_cv_c_compiler_gnu=yes
ac_cv_cxx_compiler_gnu=yes
ac_cv_env_CCC_set=
ac_cv_env_CCC_value=
ac_cv_env_CC_set=set
ac_cv_env_CC_value=clang
ac_cv_env_CFLAGS_set=set
ac_cv_env_CFLAGS_value=-Qunused-arguments
ac_cv_env_CPPFLAGS_set=set
ac_cv_env_CPPFLAGS_value=-Qunused-arguments
ac_cv_env_CPP_set=set
ac_cv_env_CPP_value=llvm-gcc-4.2
ac_cv_env_CXXFLAGS_set=
ac_cv_env_CXXFLAGS_value=
ac_cv_env_CXX_set=set
ac_cv_env_CXX_value=llvm-g++
ac_cv_env_LDFLAGS_set=
ac_cv_env_LDFLAGS_value=
ac_cv_env_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_host_alias_set=
ac_cv_env_host_alias_value=
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_objext=o
ac_cv_prog_CPP=llvm-gcc-4.2
ac_cv_prog_cc_c89=
ac_cv_prog_cc_g=yes
ac_cv_prog_cxx_g=yes
## ----------------- ##
## Output variables. ##
## ----------------- ##
ALL_BINDINGS=''
AR=''
ARCH=''
BINDINGS_TO_BUILD=''
BINPWD=''
BINUTILS_INCDIR=''
BUILD_CC=''
BUILD_CXX=''
BUILD_EXEEXT=''
BZIP2=''
CAT=''
CC='clang'
CFLAGS='-Qunused-arguments'
CIRCO=''
CLANG_SRC_ROOT=''
CMP=''
CONVENIENCE_LTDL_FALSE=''
CONVENIENCE_LTDL_TRUE=''
CP=''
CPP='llvm-gcc-4.2'
CPPFLAGS='-Qunused-arguments'
CVSBUILD=''
CXX='llvm-g++'
CXXFLAGS='-g -O2'
DATE=''
DEBUG_RUNTIME=''
DEBUG_SYMBOLS=''
DEFS=''
DISABLE_ASSERTIONS=''
DOT=''
DOTTY=''
DOXYGEN=''
ECHO_C='ECHO_N=''
ECHO_T=''
EGREP=''
ENABLE_CBE_PRINTF_A=''
ENABLE_DOCS=''
ENABLE_DOXYGEN=''
ENABLE_EMBED_STDCXX=''
ENABLE_EXPENSIVE_CHECKS=''
ENABLE_OPTIMIZED=''
ENABLE_PIC=''
ENABLE_POLLY=''
ENABLE_PROFILING=''
ENABLE_PTHREADS=''
ENABLE_SHARED=''
ENABLE_THREADS=''
ENABLE_TIMESTAMPS=''
ENABLE_VISIBILITY_INLINES_HIDDEN=''
ENDIAN=''
EXEEXT=''
EXPENSIVE_CHECKS=''
EXTRA_LD_OPTIONS=''
EXTRA_OPTIONS=''
FDP=''
FIND=''
GAS=''
GRAPHVIZ=''
GREP=''
GROFF=''
GV=''
GZIPBIN=''
HAVE_LINK_VERSION_SCRIPT=''
HAVE_PERL=''
HAVE_PTHREAD=''
HOST_OS=''
HUGE_VAL_SANITY=''
INSTALL_DATA=''
INSTALL_LTDL_FALSE=''
INSTALL_LTDL_TRUE=''
INSTALL_PROGRAM=''
INSTALL_SCRIPT=''
JIT=''
LDFLAGS=''
LIBADD_DL=''
LIBOBJS=''
LIBS=''
LINKALL=''
LLVM_BINDIR=''
LLVM_CONFIGTIME=''
LLVM_COPYRIGHT='Copyright (c) 2003-2011 University of Illinois at Urbana-Champaign.'
LLVM_CROSS_COMPILING=''
LLVM_DATADIR=''
LLVM_DOCSDIR=''
LLVM_ENUM_ASM_PARSERS=''
LLVM_ENUM_ASM_PRINTERS=''
LLVM_ENUM_DISASSEMBLERS=''
LLVM_ENUM_TARGETS=''
LLVM_ETCDIR=''
LLVM_HAS_POLLY=''
LLVM_INCLUDEDIR=''
LLVM_INFODIR=''
LLVM_LIBDIR=''
LLVM_MANDIR=''
LLVM_ON_UNIX=''
LLVM_ON_WIN32=''
LLVM_PREFIX=''
LN_S=''
LTLIBOBJS=''
MKDIR=''
MMAP_FILE=''
MV=''
NEATO=''
NM=''
NOLINKALL=''
NO_MISSING_FIELD_INITIALIZERS=''
NO_VARIADIC_MACROS=''
OBJEXT='o'
OCAMLC=''
OCAMLDEP=''
OCAMLDOC=''
OCAMLOPT=''
OCAML_LIBDIR=''
OPTIMIZE_OPTION=''
OS=''
PACKAGE_BUGREPORT='llvmbugs#cs.uiuc.edu'
PACKAGE_NAME='llvm'
PACKAGE_STRING='llvm 3.1svn'
PACKAGE_TARNAME='-llvm-'
PACKAGE_VERSION='3.1svn'
PATH_SEPARATOR=':'
PDFROFF=''
PERL=''
POD2HTML=''
POD2MAN=''
RANLIB=''
RDYNAMIC=''
RM=''
RPATH=''
RUNTEST=''
SED=''
SHELL='/bin/sh'
SHLIBEXT=''
SHLIBPATH_VAR=''
TAR=''
TARGETS_TO_BUILD=''
TARGET_HAS_JIT=''
TARGET_OS=''
TCLSH=''
TWOPI=''
USE_OPROFILE=''
USE_UDIS86=''
XDOT_PY=''
ZIP=''
ac_ct_CC=''
ac_ct_CXX=''
bindir='${exec_prefix}/bin'
build=''
build_alias=''
build_cpu=''
build_os=''
build_vendor=''
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
dvidir='${docdir}'
exec_prefix='NONE'
host=''
host_alias=''
host_cpu=''
host_os=''
host_vendor=''
htmldir='${docdir}'
ifGNUmake=''
includedir='${prefix}/include'
infodir='${datarootdir}/info'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mandir='${datarootdir}/man'
oldincludedir='/usr/include'
pdfdir='${docdir}'
prefix='/opt'
program_transform_name='s,x,x,'
psdir='${docdir}'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
subdirs=''
sysconfdir='${prefix}/etc'
target=''
target_alias=''
target_cpu=''
target_os=''
target_vendor=''
## ----------- ##
## confdefs.h. ##
## ----------- ##
#define PACKAGE_NAME "llvm"
#define PACKAGE_TARNAME "-llvm-"
#define PACKAGE_VERSION "3.1svn"
#define PACKAGE_STRING "llvm 3.1svn"
#define PACKAGE_BUGREPORT "llvmbugs#cs.uiuc.edu"
configure: exit 1
Now i did not find any material of how to go about in installing llvm-chang in my system where do you need to install it and how to go about it. do you know of any such... It would be a great help in clearing this out... thanks.
PS: this is the guide i am using. i tried making downloading the files to /usr/llvm and they did download but got stuck at the .configure part.... do you want me to specify any other form of messages that need to be done in setting up the mac compiler correctly.
The guidelines you are referring to are outdated, please check the users guide on their website
Have you tried to install the package apple-gcc42 and force the compiler to GCC instead of LLVM? Xcode 4.2 uses LLVM by default and it does not come with GCC anymore.
Well, I just ran into the same problem on Mac OS X Lion (10.7).
So far, this workaround worked for me:
change to the directory ..../ros/ros_comm/tools/rosconsole/build
and call 'make'. This should produce the same error again.
Now call 'make -n' which prints out the commands which are really called by make.
Pick the (long) line where it compiles (c++) rosconsole.cpp from them, change the optimization option from -O2 to -O0 (thats MINUS OHH ZERO) and execute that command.
Then call make again to let it finish its work.
The problem seems that the Python that comes installed with the Lion software seems to have been messe with. What i Basically did was to create a new login and then carry on the installation process with easy-install2.6 . rather than use easy install easy_install