boringsslを利用したcのコードをrustでコンパイルした際のエラー
boringsslのコードを利用したCのコードをrustから利用するコードを書いてみました。
しかしrust-cmake-boringsslをビルドすると下記の様なビルドエラーが発生します。
ビルドはdockerを利用しましたが利用しなくても同じエラーが発生します。
このコードをCの部分のみcmakeでコンパイルを行うと問題なくビルドできるので、
rustからcmakeした場合のエラーだと考えていますがどの様に対処すれば良いですか?
docker build -t rust-cmake-boringssl .
{{ 省略 }}
error: linking with `cc` failed: exit code: 1
|
= note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" "/usr/local/rustup/toolchains/1.33.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/code/target/debug/deps/rust_cmake_boringssl-fb053db5baf0cc90.1z90sxbskcq91ebx.rcgu.o" "/code/target/debug/deps/rust_cmake_boringssl-fb053db5baf0cc90.32b6g9lzimjgj8n5.rcgu.o" "/code/target/debug/deps/rust_cmake_boringssl-fb053db5baf0cc90.3aaj4mjxb5lkmrkm.rcgu.o" "/code/target/debug/deps/rust_cmake_boringssl-fb053db5baf0cc90.3w55c3jafb2ycbej.rcgu.o" "/code/target/debug/deps/rust_cmake_boringssl-fb053db5baf0cc90.4qt5y1bkawfo9iio.rcgu.o" "/code/target/debug/deps/rust_cmake_boringssl-fb053db5baf0cc90.50pl6qnwdthi9gy2.rcgu.o" "/code/target/debug/deps/rust_cmake_boringssl-fb053db5baf0cc90.56k8nal2xxr6ch6x.rcgu.o" "/code/target/debug/deps/rust_cmake_boringssl-fb053db5baf0cc90.rm8ok0x2wiym41u.rcgu.o" "-o" "/code/target/debug/deps/rust_cmake_boringssl-fb053db5baf0cc90" "/code/target/debug/deps/rust_cmake_boringssl-fb053db5baf0cc90.2omngnxgh3s0uvu7.rcgu.o" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-nodefaultlibs" "-L" "/code/target/debug/deps" "-L" "/code/target/debug/build/rust-cmake-boringssl-982a83fbad3f69a0/out" "-L" "/usr/local/rustup/toolchains/1.33.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "-Wl,--whole-archive" "-lfoo" "-Wl,--no-whole-archive" "-Wl,--start-group" "/usr/local/rustup/toolchains/1.33.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-e39317eb74365d3c.rlib" "/usr/local/rustup/toolchains/1.33.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-4d55a38564aae54a.rlib" "/usr/local/rustup/toolchains/1.33.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libbacktrace_sys-f8521075e248b627.rlib" "/usr/local/rustup/toolchains/1.33.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-7c91ffdc8da860d3.rlib" "/usr/local/rustup/toolchains/1.33.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-0ad27b9879d551d3.rlib" "/usr/local/rustup/toolchains/1.33.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-588f18eae3ea58be.rlib" "/usr/local/rustup/toolchains/1.33.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-4ebf5caee903d98f.rlib" "/usr/local/rustup/toolchains/1.33.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-8895b32baedb08c6.rlib" "/usr/local/rustup/toolchains/1.33.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-6a9d233d01acc350.rlib" "-Wl,--end-group" "/usr/local/rustup/toolchains/1.33.0-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-851bb3b5f6c4db49.rlib" "-Wl,-Bdynamic" "-ldl" "-lrt" "-lpthread" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpthread" "-lutil" "-lutil"
= note: /code/target/debug/build/rust-cmake-boringssl-982a83fbad3f69a0/out/libfoo.a(main.c.o): In function `aes_128_cbc_key_length':
/code/foo/src/main.c:11: undefined reference to `EVP_aes_128_cbc'
/code/foo/src/main.c:11: undefined reference to `EVP_CIPHER_key_length'
collect2: error: ld returned 1 exit status
error: aborting due to previous error
error: Could not compile `rust-cmake-boringssl`.
To learn more, run the command again with --verbose.