When I build a project with dependencies, the build script fails with permission denied. This dosent happen with every crate. Here is the output from when trying to build a WGPU project.
error: failed to run custom build command for `objc_exception v0.1.2`
Caused by:
process didn't exit successfully: `/Users/64001830/wgpu-test/target/debug/build/objc_exception-f7c40ee498546635/build-script-build` (exit status: 1)
--- stdout
TARGET = Some("x86_64-apple-darwin")
OPT_LEVEL = Some("0")
HOST = Some("x86_64-apple-darwin")
cargo:rerun-if-env-changed=CC_x86_64-apple-darwin
CC_x86_64-apple-darwin = None
cargo:rerun-if-env-changed=CC_x86_64_apple_darwin
CC_x86_64_apple_darwin = None
cargo:rerun-if-env-changed=HOST_CC
HOST_CC = None
cargo:rerun-if-env-changed=CC
CC = Some("/usr/bin/")
cargo:rerun-if-env-changed=CFLAGS_x86_64-apple-darwin
CFLAGS_x86_64-apple-darwin = None
cargo:rerun-if-env-changed=CFLAGS_x86_64_apple_darwin
CFLAGS_x86_64_apple_darwin = None
cargo:rerun-if-env-changed=HOST_CFLAGS
HOST_CFLAGS = None
cargo:rerun-if-env-changed=CFLAGS
CFLAGS = None
cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("true")
CARGO_CFG_TARGET_FEATURE = Some("cmpxchg16b,fxsr,llvm14-builtins-abi,sse,sse2,sse3,ssse3")
running: "/usr/bin/" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-2" "-fno-omit-frame-pointer" "-m64" "-arch" "x86_64" "-Wall" "-Wextra" "-o" "/Users/64001830/wgpu-test/target/debug/build/objc_exception-59a44c9c89f7e2b5/out/extern/exception.o" "-c" "extern/exception.m"
--- stderr
error occurred: Command "/usr/bin/" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-2" "-fno-omit-frame-pointer" "-m64" "-arch" "x86_64" "-Wall" "-Wextra" "-o" "/Users/64001830/wgpu-test/target/debug/build/objc_exception-59a44c9c89f7e2b5/out/extern/exception.o" "-c" "extern/exception.m" with args "bin" failed to start: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }
Ive tried restarting, new projects, uninstalling and reinstalling rust.
From the error (specifically this line: CC = Some("/usr/bin/")) you can see that the C compiler environment variable (CC) is set to /usr/bin/ which is not a valid C compiler.
You can either clear the environment variable or set it to something useful like /usr/bin/cc, /usr/bin/gcc or the path to your C compiler of choice.
Related
I am following along with this tutorial and when I get to attempt running it I have trouble w/ 'torch-sys'. When I use cargo run or cargo run --target x86_64-apple-darwin I get the following error message.
Compiling torch-sys v0.8.0
The following warnings were emitted during compilation:
warning: clang: warning: -Wl,-rpath=/Users/macabe/semantic-search/target/debug/build/torch-sys-3f4db2fcb77e7c54/out/libtorch/libtorch/lib: 'linker' input unused [-Wunused-command-line-argument]cargo:warning=clang: warning: -Wl,-rpath=/Users/macabe/semantic-search/target/debug/build/torch-sys-3f4db2fcb77e7c54/out/libtorch/libtorch/lib: 'linker' input unused [-Wunused-command-line-argument]
warning: libtch/torch_api.cpp:1:9: fatal error: 'torch/csrc/autograd/engine.h' file not found
warning: #include<torch/csrc/autograd/engine.h>
warning: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
warning: 1 error generated.
error: failed to run custom build command for `torch-sys v0.8.0`
Caused by:
process didn't exit successfully: `/Users/macabe/semantic-search/target/debug/build/torch-sys-e88d97111c03df15/build-script-build` (exit status: 1)
--- stdout
cargo:rerun-if-env-changed=TORCH_CUDA_VERSION
cargo:rerun-if-env-changed=LIBTORCH
cargo:rustc-link-search=native=/Users/macabe/semantic-search/target/debug/build/torch-sys-3f4db2fcb77e7c54/out/libtorch/libtorch/lib
cargo:rerun-if-changed=libtch/torch_api.cpp
cargo:rerun-if-changed=libtch/torch_api.h
cargo:rerun-if-changed=libtch/torch_api_generated.cpp.h
cargo:rerun-if-changed=libtch/torch_api_generated.h
cargo:rerun-if-changed=libtch/stb_image_write.h
cargo:rerun-if-changed=libtch/stb_image_resize.h
cargo:rerun-if-changed=libtch/stb_image.h
cargo:rerun-if-env-changed=LIBTORCH_CXX11_ABI
TARGET = Some("aarch64-apple-darwin")
OPT_LEVEL = Some("0")
HOST = Some("aarch64-apple-darwin")
cargo:rerun-if-env-changed=CXX_aarch64-apple-darwin
CXX_aarch64-apple-darwin = None
cargo:rerun-if-env-changed=CXX_aarch64_apple_darwin
CXX_aarch64_apple_darwin = None
cargo:rerun-if-env-changed=HOST_CXX
HOST_CXX = None
cargo:rerun-if-env-changed=CXX
CXX = None
cargo:rerun-if-env-changed=CXXFLAGS_aarch64-apple-darwin
CXXFLAGS_aarch64-apple-darwin = None
cargo:rerun-if-env-changed=CXXFLAGS_aarch64_apple_darwin
CXXFLAGS_aarch64_apple_darwin = None
cargo:rerun-if-env-changed=HOST_CXXFLAGS
HOST_CXXFLAGS = None
cargo:rerun-if-env-changed=CXXFLAGS
CXXFLAGS = None
cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("true")
CARGO_CFG_TARGET_FEATURE = Some("aes,crc,dit,dotprod,dpb,dpb2,fcma,fhm,flagm,fp16,frintts,jsconv,lor,lse,neon,paca,pacg,pan,pmuv3,ras,rcpc,rcpc2,rdm,sb,sha2,sha3,ssbs,vh")
running: "c++" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-arch" "arm64" "-I" "/Users/macabe/semantic-search/target/debug/build/torch-sys-3f4db2fcb77e7c54/out/libtorch/libtorch/include" "-I" "/Users/macabe/semantic-search/target/debug/build/torch-sys-3f4db2fcb77e7c54/out/libtorch/libtorch/include/torch/csrc/api/include" "-Wl,-rpath=/Users/macabe/semantic-search/target/debug/build/torch-sys-3f4db2fcb77e7c54/out/libtorch/libtorch/lib" "-std=c++14" "-D_GLIBCXX_USE_CXX11_ABI=1" "-o" "/Users/macabe/semantic-search/target/debug/build/torch-sys-3f4db2fcb77e7c54/out/libtch/torch_api.o" "-c" "libtch/torch_api.cpp"
running: "c++" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-arch" "arm64" "-I" "/Users/macabe/semantic-search/target/debug/build/torch-sys-3f4db2fcb77e7c54/out/libtorch/libtorch/include" "-I" "/Users/macabe/semantic-search/target/debug/build/torch-sys-3f4db2fcb77e7c54/out/libtorch/libtorch/include/torch/csrc/api/include" "-Wl,-rpath=/Users/macabe/semantic-search/target/debug/build/torch-sys-3f4db2fcb77e7c54/out/libtorch/libtorch/lib" "-std=c++14" "-D_GLIBCXX_USE_CXX11_ABI=1" "-o" "/Users/macabe/semantic-search/target/debug/build/torch-sys-3f4db2fcb77e7c54/out/libtch/fake_cuda_dependency.o" "-c" "libtch/fake_cuda_dependency.cpp"
cargo:warning=clang: warning: -Wl,-rpath=/Users/macabe/semantic-search/target/debug/build/torch-sys-3f4db2fcb77e7c54/out/libtorch/libtorch/lib: 'linker' input unused [-Wunused-command-line-argument]cargo:warning=clang: warning: -Wl,-rpath=/Users/macabe/semantic-search/target/debug/build/torch-sys-3f4db2fcb77e7c54/out/libtorch/libtorch/lib: 'linker' input unused [-Wunused-command-line-argument]
cargo:warning=libtch/torch_api.cpp:1:9: fatal error: 'torch/csrc/autograd/engine.h' file not found
cargo:warning=#include<torch/csrc/autograd/engine.h>
cargo:warning= ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
exit status: 0
cargo:warning=1 error generated.
exit status: 1
--- stderr
error occurred: Command "c++" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-arch" "arm64" "-I" "/Users/macabe/semantic-search/target/debug/build/torch-sys-3f4db2fcb77e7c54/out/libtorch/libtorch/include" "-I" "/Users/macabe/semantic-search/target/debug/build/torch-sys-3f4db2fcb77e7c54/out/libtorch/libtorch/include/torch/csrc/api/include" "-Wl,-rpath=/Users/macabe/semantic-search/target/debug/build/torch-sys-3f4db2fcb77e7c54/out/libtorch/libtorch/lib" "-std=c++14" "-D_GLIBCXX_USE_CXX11_ABI=1" "-o" "/Users/macabe/semantic-search/target/debug/build/torch-sys-3f4db2fcb77e7c54/out/libtch/torch_api.o" "-c" "libtch/torch_api.cpp" with args "c++" did not execute successfully (status code exit status: 1).
I have uninstalled/reinstalled pytorch and upadted conda. Any ideas on what to do for this?
I have some problems probably due to incorrect cargo or rust settings.
I using MinGW on windows and probably must set a CC or something like that or modify env variables.
I thought that maybe an error will be solved when I change the framework, but it did not help.
Here is the output of the console with an error:
C:\Users\user0\Desktop\app>cargo run
Compiling minimp3-sys v0.3.2
Compiling bzip2-sys v0.1.11+1.0.8
Compiling miniz_oxide v0.4.4
Compiling quote v1.0.19
The following warnings were emitted during compilation:
warning: cc1.exe: sorry, unimplemented: 64-bit mode not compiled in
error: failed to run custom build command for `minimp3-sys v0.3.2`
Caused by:
process didn't exit successfully: `C:\Users\user0\Desktop\app\target\debug\build\minimp3-sys-6587a736db4ed872\build-script-build` (exit code: 1)
--- stdout
TARGET = Some("x86_64-pc-windows-gnu")
OPT_LEVEL = Some("0")
HOST = Some("x86_64-pc-windows-gnu")
CC_x86_64-pc-windows-gnu = None
CC_x86_64_pc_windows_gnu = None
HOST_CC = None
CC = None
CFLAGS_x86_64-pc-windows-gnu = None
CFLAGS_x86_64_pc_windows_gnu = None
HOST_CFLAGS = None
CFLAGS = None
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("true")
CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
running: "gcc.exe" "-O0" "-ffunction-sections" "-fdata-sections" "-g" "-fno-omit-frame-pointer" "-m64" "-I" "minimp3/" "-Wall" "-Wextra" "-DMINIMP3_IMPLEMENTATION" "-o" "C:\\Users\\user0\\Desktop\\app\\target\\debug\\build\\minimp3-sys-2cb72c58d710f12a\\out\\minimp3.o" "-c" "minimp3.c"
cargo:warning=cc1.exe: sorry, unimplemented: 64-bit mode not compiled in
exit code: 1
--- stderr
error occurred: Command "gcc.exe" "-O0" "-ffunction-sections" "-fdata-sections" "-g" "-fno-omit-frame-pointer" "-m64" "-I" "minimp3/" "-Wall" "-Wextra" "-DMINIMP3_IMPLEMENTATION" "-o" "C:\\Users\\user0\\Desktop\\app\\target\\debug\\build\\minimp3-sys-2cb72c58d710f12a\\out\\minimp3.o" "-c" "minimp3.c" with args "gcc.exe" did not execute successfully (status code exit code: 1).
warning: build failed, waiting for other jobs to finish...
The following warnings were emitted during compilation:
warning: cc1.exe: sorry, unimplemented: 64-bit mode not compiled in
error: failed to run custom build command for `bzip2-sys v0.1.11+1.0.8`
Caused by:
process didn't exit successfully: `C:\Users\user0\Desktop\app\target\debug\build\bzip2-sys-faace576cdcf109f\build-script-build` (exit code: 1)
--- stdout
TARGET = Some("x86_64-pc-windows-gnu")
OPT_LEVEL = Some("0")
HOST = Some("x86_64-pc-windows-gnu")
CC_x86_64-pc-windows-gnu = None
CC_x86_64_pc_windows_gnu = None
HOST_CC = None
CC = None
CFLAGS_x86_64-pc-windows-gnu = None
CFLAGS_x86_64_pc_windows_gnu = None
HOST_CFLAGS = None
CFLAGS = None
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("true")
CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
running: "gcc.exe" "-O0" "-ffunction-sections" "-fdata-sections" "-g" "-fno-omit-frame-pointer" "-m64" "-I" "bzip2-1.0.8" "-D_WIN32" "-DBZ_EXPORT" "-D_FILE_OFFSET_BITS=64" "-DBZ_NO_STDIO" "-o" "C:\\Users\\user0\\Desktop\\app\\target\\debug\\build\\bzip2-sys-f1b348dca76e3f18\\out\\lib\\bzip2-1.0.8/blocksort.o" "-c"
"bzip2-1.0.8/blocksort.c"
cargo:warning=cc1.exe: sorry, unimplemented: 64-bit mode not compiled in
exit code: 1
--- stderr
error occurred: Command "gcc.exe" "-O0" "-ffunction-sections" "-fdata-sections" "-g" "-fno-omit-frame-pointer" "-m64" "-I" "bzip2-1.0.8" "-D_WIN32" "-DBZ_EXPORT" "-D_FILE_OFFSET_BITS=64" "-DBZ_NO_STDIO" "-o" "C:\\Users\\user0\\Desktop\\app\\target\\debug\\build\\bzip2-sys-f1b348dca76e3f18\\out\\lib\\bzip2-1.0.8/blocksort.o" "-c" "bzip2-1.0.8/blocksort.c" with args "gcc.exe" did not execute successfully (status code exit code: 1).
My Cargo.toml file:
[package]
name = "app"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
ggez = "*"
environment variables
MinGW options
MinGW folder
In Windows-Gnu there are actually two different targets:
x86_64-pc-windows-gnu to build 64-bit executables and
i686-pc-windows-gnu to build 32-bit ones.
When you use cargo you tell it what target to use with --target, but the default will be the one you are using, that usually will be the 64-bit one.
When invoking gcc the bitness of the target will result in the parameter -m32 or -m64. Usually GCC will accept both options, but sometimes, if you have a 32-bit only version of the compiler, if you (or cargo) use the -m64 option the compiler will complain with that:
sorry, unimplemented: 64-bit mode not compiled in
The right solution is to install a 64-bit MinGW version, that should be the default nowadays. I mean, the usual fork is now called MinGW-w64.
In Apple M1, when I compile my Rust code for Linux X86_64, I get an error ld: unknown option: --as-needed:
~/WORKDIR/rust/helloworld ⌚ 20:24:21
$ cargo build --target x86_64-unknown-linux-gnu
Compiling helloworld v0.1.0 (/Users/fudenglong/WORKDIR/rust/helloworld)
error: linking with `cc` failed: exit status: 1
|
= note: "cc" "-m64" "/Users/fudenglong/WORKDIR/rust/helloworld/target/x86_64-unknown-linux-gnu/debug/deps/helloworld-42c0bc1b0d56de10.19lk9s4zgix5szcj.rcgu.o" "/Users/fudenglong/WORKDIR/rust/helloworld/target/x86_64-unknown-linux-gnu/debug/deps/helloworld-42c0bc1b0d56de10.1m3icqtseu62rr0o.rcgu.o" "/Users/fudenglong/WORKDIR/rust/helloworld/target/x86_64-unknown-linux-gnu/debug/deps/helloworld-42c0bc1b0d56de10.2fy0lykh93934k3s.rcgu.o" "/Users/fudenglong/WORKDIR/rust/helloworld/target/x86_64-unknown-linux-gnu/debug/deps/helloworld-42c0bc1b0d56de10.31qjfvz3m1ka31b5.rcgu.o" "/Users/fudenglong/WORKDIR/rust/helloworld/target/x86_64-unknown-linux-gnu/debug/deps/helloworld-42c0bc1b0d56de10.3vrcx702oe0jhs7q.rcgu.o" "/Users/fudenglong/WORKDIR/rust/helloworld/target/x86_64-unknown-linux-gnu/debug/deps/helloworld-42c0bc1b0d56de10.53gv3v3m2hy2kzin.rcgu.o" "/Users/fudenglong/WORKDIR/rust/helloworld/target/x86_64-unknown-linux-gnu/debug/deps/helloworld-42c0bc1b0d56de10.cc5ryu0ilsy4zts.rcgu.o" "/Users/fudenglong/WORKDIR/rust/helloworld/target/x86_64-unknown-linux-gnu/debug/deps/helloworld-42c0bc1b0d56de10.zedrxxva8ppoktz.rcgu.o" "/Users/fudenglong/WORKDIR/rust/helloworld/target/x86_64-unknown-linux-gnu/debug/deps/helloworld-42c0bc1b0d56de10.2l2aexzp1dl763ew.rcgu.o" "-Wl,--as-needed" "-L" "/Users/fudenglong/WORKDIR/rust/helloworld/target/x86_64-unknown-linux-gnu/debug/deps" "-L" "/Users/fudenglong/WORKDIR/rust/helloworld/target/debug/deps" "-L" "/Users/fudenglong/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,--start-group" "-Wl,-Bstatic" "/Users/fudenglong/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-1b64d5fe7a3c3d7f.rlib" "/Users/fudenglong/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-e7f86684b9679284.rlib" "/Users/fudenglong/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-10a87791239bd676.rlib" "/Users/fudenglong/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr-0e6cad6dd623d38e.rlib" "/Users/fudenglong/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-9d05dd05a4d51b33.rlib" "/Users/fudenglong/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-a60ff138fe1adfad.rlib" "/Users/fudenglong/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-0e9344458c09713e.rlib" "/Users/fudenglong/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-ef3b808d96f639bf.rlib" "/Users/fudenglong/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-e3ce420901586b53.rlib" "/Users/fudenglong/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-546bece8dd1bea42.rlib" "/Users/fudenglong/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-9b358af16d7d7aa1.rlib" "/Users/fudenglong/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-554cd499fe1a3b52.rlib" "/Users/fudenglong/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-d105877dbe329cd1.rlib" "/Users/fudenglong/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-8fec8a74c706e4b4.rlib" "/Users/fudenglong/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-e869a247063ed69a.rlib" "/Users/fudenglong/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-4896c4057dc9553a.rlib" "/Users/fudenglong/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-2a6a2797f7a73818.rlib" "/Users/fudenglong/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-0e3656b1fda5fd7b.rlib" "-Wl,--end-group" "/Users/fudenglong/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-1f103368fa522bc0.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-L" "/Users/fudenglong/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/Users/fudenglong/WORKDIR/rust/helloworld/target/x86_64-unknown-linux-gnu/debug/deps/helloworld-42c0bc1b0d56de10" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro,-znow" "-nodefaultlibs"
= note: clang: warning: argument unused during compilation: '-pie' [-Wunused-command-line-argument]
ld: unknown option: --as-needed
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: could not compile `helloworld` due to previous error
I had already installed the x86_64-unknown-linux-gnu toolchain.
$ brew tap SergioBenitez/osxct
$ brew install x86_64-unknown-linux-gnu
# .cargo/config.toml
[build]
target = "x86_64-unknown-linux-gnu"
[target.x86_64-unknown-linux-gnu]
linker = "/usr/local/bin/x86_64-unknown-linux-gnu-gcc"
You may be missing a proper linker.
Install GNU compiler collection:
brew install gcc
And add it to .cargo/config
[target.x86_64-unknown-linux-gnu]
linker = "/usr/local/bin/gcc-<version>"
I'm trying to add lmdb to my yocto build. This is my recipe:
LIC_FILES_CHKSUM = "file://LICENSE;md5=153d07ef052c4a37a8fac23bc6031972"
SRC_URI = " \
https://github.com/LMDB/lmdb/archive/LMDB_${PV}.tar.gz \
"
SRC_URI[md5sum] = "0de89730b8f3f5711c2b3a4ba517b648"
SRC_URI[sha256sum] = "49d7b40949f2ced9bc8b23ea6a89e75471a1c9126537a8b268c318a00b84322b"
BBFILE_PRIORITY = "8"
inherit autotools-brokensep
S = "${WORKDIR}/lmdb-LMDB_${PV}/libraries/liblmdb"
do_install() {
install -d ${D}${bindir}
install -d ${D}${libdir}
install -d ${D}${includedir}
install -d ${D}${mandir}
sed -i 's:\$(prefix)/man:${mandir}:' Makefile
oe_runmake DESTDIR=${D} prefix=${prefix} manprefix=${mandir} install
}
It compiles fine but I get an error during do_package task:
ERROR: objcopy failed with exit code 256 (cmd was 'aarch64-poky-linux-objcopy' --only-keep-debug '/media/build/tmp/work/aarch64-poky-linux/lmdb/0.9.16-r0/package/usr/bin/mdb_copy' '/media/build/tmp/work/aarch64-poky-linux/lmdb/0.9.16-r0/package/usr/bin/.debug/mdb_copy'): aarch64-poky-linux-objcopy: Unable to recognise the format of the input file `/media/build/tmp/work/aarch64-poky-linux/lmdb/0.9.16-r0/package/usr/bin/mdb_copy'
I tried including INHIBIT_PACKAGE_STRIP = "1" in my bb file. But it throws other errors:
ERROR: runstrip: ''aarch64-poky-linux-strip' --remove-section=.comment --remove-section=.note --strip-unneeded '/media/build/tmp/work/aarch64-poky-linux/lmdb/0.9.16-r0/sysroot-destdir/usr/lib/liblmdb.so'' strip command failed with 1 (aarch64-poky-linux-strip: Unable to recognise the format of the input file `/media/build/tmp/work/aarch64-poky-linux/lmdb/0.9.16-r0/sysroot-destdir/usr/lib/liblmdb.so'
)
ERROR: QA Issue: Architecture did not match (183 to 62) on work/aarch64-poky-linux/lmdb/0.9.16-r0/packages-split/lmdb-dev/usr/lib/liblmdb.so [arch]
WARNING: QA Issue: /usr/lib/liblmdb.so_lmdb-dev contained in package lmdb-dev requires libpthread.so.0(GLIBC_2.3.2)(64bit), but no providers found in its RDEPENDS [file-rdeps]
ERROR: QA Issue: Architecture did not match (183 to 62) on work/aarch64-poky-linux/lmdb/0.9.16-r0/packages-split/lmdb/usr/bin/mdb_dump [arch]
I'm on poky 2.0.2.
The github link doesnt exist.
However you can skip qa packaging with
do_package_qa[noexec] = "1"
I've been trying to install some binaries in my EC2 instances using Elastic Beanstalk container_commands and a custom shell script. When the container command fires, I basically wget a library, uncompress it, configure it and make && make install it like so:
wget LIBRARY_URL
mkdir -p libfolder
tar xf LIBRARY.tar.gz -C libfolder --strip-components 1
cd libfolder
./configure
make clean
make install
On the ./configure step I get the following:
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... no
So I get from here that the C compiler doesn't work yet gcc is already installed. The whole container_command fails to do what the shell script says.
Nevertheless, when is SSH into the EC2 instance, if I manually execute the shell script then everything goes smoothly and the "C compiler works..." check returns "yes".
Here is the according .ebextensions config YAML file that I use:
packages:
yum:
gcc: []
make: []
openssl-devel: []
libxml2: []
libxml2-devel: []
container_commands:
01setupaudio:
command: "sh audio.sh"
I am wondering why this is and if the reason this happens is because container_commands run first and then packages get installed, because the fact that SSHing into the instance and running the shell script manually confirms that there is no problem with it.
Any help would be much appreciated. Here is the config.log:
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by lame configure 3.99.5, which was
generated by GNU Autoconf 2.68. Invocation command line was
$ ./configure CC=/usr/bin/gcc
## --------- ##
## Platform. ##
## --------- ##
hostname = ip-10-0-1-182
uname -m = x86_64
uname -r = 3.10.35-43.137.amzn1.x86_64
uname -s = Linux
uname -v = #1 SMP Wed Apr 2 09:36:59 UTC 2014
/usr/bin/uname -p = unknown
/bin/uname -X = unknown
/bin/arch = x86_64
/usr/bin/arch -k = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo = unknown
/bin/machine = unknown
/usr/bin/oslevel = unknown
/bin/universe = unknown
PATH: /usr/local/bin
PATH: /bin
PATH: /usr/bin
## ----------- ##
## Core tests. ##
## ----------- ##
configure:2555: checking build system type
configure:2569: result: x86_64-unknown-linux-gnu
configure:2589: checking host system type
configure:2602: result: x86_64-unknown-linux-gnu
configure:2639: checking for a BSD-compatible install
configure:2707: result: /usr/bin/install -c
configure:2718: checking whether build environment is sane
configure:2768: result: yes
configure:2909: checking for a thread-safe mkdir -p
configure:2948: result: /bin/mkdir -p
configure:2961: checking for gawk
configure:2977: found /bin/gawk
configure:2988: result: gawk
configure:2999: checking whether make sets $(MAKE)
configure:3021: result: yes
configure:3104: checking whether to enable maintainer-specific portions of Makefiles
configure:3113: result: no
configure:3133: checking for style of include used by make
configure:3161: result: GNU
configure:3237: checking for gcc
configure:3264: result: /usr/bin/gcc
configure:3493: checking for C compiler version
configure:3502: /usr/bin/gcc --version >&5
gcc (GCC) 4.8.2 20131212 (Red Hat 4.8.2-7)
Copyright (C) 2013 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:3513: $? = 0
configure:3502: /usr/bin/gcc -v >&5
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-amazon-linux/4.8.2/lto-wrapper
Target: x86_64-amazon-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,fortran,ada,lto --enable-plugin --enable-initfini-array --disable-libgcj --without-isl --without-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-amazon-linux
Thread model: posix
gcc version 4.8.2 20131212 (Red Hat 4.8.2-7) (GCC)
configure:3513: $? = 0
configure:3502: /usr/bin/gcc -V >&5
gcc: error: unrecognized command line option '-V'
gcc: fatal error: no input files
compilation terminated.
configure:3513: $? = 4
configure:3502: /usr/bin/gcc -qversion >&5
gcc: error: unrecognized command line option '-qversion'
gcc: fatal error: no input files
compilation terminated.
configure:3513: $? = 4
configure:3533: checking whether the C compiler works
configure:3555: /usr/bin/gcc conftest.c >&5
collect2: fatal error: cannot find 'ld'
compilation terminated.
configure:3559: $? = 1
configure:3597: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "lame"
| #define PACKAGE_TARNAME "lame"
| #define PACKAGE_VERSION "3.99.5"
| #define PACKAGE_STRING "lame 3.99.5"
| #define PACKAGE_BUGREPORT "lame-dev#lists.sf.net"
| #define PACKAGE_URL ""
| #define PACKAGE "lame"
| #define VERSION "3.99.5"
| /* end confdefs.h. */
|
| int
| main ()
| {
|
| ;
| return 0;
| }
configure:3602: error: in `/tmp/deployment/application/soundpuzzle_installation/lame-folder/lame-tar':
configure:3604: error: C compiler cannot create executables
See `config.log' for more details
## ---------------- ##
## Cache variables. ##
## ---------------- ##
ac_cv_build=x86_64-unknown-linux-gnu
ac_cv_env_CC_set=set
ac_cv_env_CC_value=/usr/bin/gcc
ac_cv_env_CFLAGS_set=
ac_cv_env_CFLAGS_value=
ac_cv_env_CPPFLAGS_set=
ac_cv_env_CPPFLAGS_value=
ac_cv_env_CPP_set=
ac_cv_env_CPP_value=
ac_cv_env_LDFLAGS_set=
ac_cv_env_LDFLAGS_value=
ac_cv_env_LIBS_set=
ac_cv_env_LIBS_value=
ac_cv_env_PKG_CONFIG_LIBDIR_set=
ac_cv_env_PKG_CONFIG_LIBDIR_value=
ac_cv_env_PKG_CONFIG_PATH_set=
ac_cv_env_PKG_CONFIG_PATH_value=
ac_cv_env_PKG_CONFIG_set=
ac_cv_env_PKG_CONFIG_value=
ac_cv_env_SNDFILE_CFLAGS_set=
ac_cv_env_SNDFILE_CFLAGS_value=
ac_cv_env_SNDFILE_LIBS_set=
ac_cv_env_SNDFILE_LIBS_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_host=x86_64-unknown-linux-gnu
ac_cv_path_install='/usr/bin/install -c'
ac_cv_path_mkdir=/bin/mkdir
ac_cv_prog_AWK=gawk
ac_cv_prog_ac_ct_CC=/usr/bin/gcc
ac_cv_prog_make_make_set=yes
## ----------------- ##
## Output variables. ##
## ----------------- ##
ACLOCAL='${SHELL} /tmp/deployment/application/soundpuzzle_installation/lame-folder/lame-tar/missing --run aclocal-1.11'
ALLOCA=''
AMDEPBACKSLASH='\'
AMDEP_FALSE='#'
AMDEP_TRUE=''
AMTAR='${SHELL} /tmp/deployment/application/soundpuzzle_installation/lame-folder/lame-tar/missing --run tar'
ANSI2KNR=''
AR=''
AUTOCONF='${SHELL} /tmp/deployment/application/soundpuzzle_installation/lame-folder/lame-tar/missing --run autoconf'
AUTOHEADER='${SHELL} /tmp/deployment/application/soundpuzzle_installation/lame-folder/lame-tar/missing --run autoheader'
AUTOMAKE='${SHELL} /tmp/deployment/application/soundpuzzle_installation/lame-folder/lame-tar/missing --run automake-1.11'
AWK='gawk'
CC='/usr/bin/gcc'
CCDEPMODE=''
CFLAGS=''
CONFIG_DEFS=''
CONFIG_MATH_LIB=''
CPP=''
CPPFLAGS=''
CPUCCODE=''
CPUTYPE=''
CYGPATH_W='echo'
DEFS=''
DEPDIR='.deps'
DSYMUTIL=''
DUMPBIN=''
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
EGREP=''
EXEEXT=''
FGREP=''
FRONTEND_CFLAGS=''
FRONTEND_LDADD=''
FRONTEND_LDFLAGS=''
GREP=''
GTK_CFLAGS=''
GTK_CONFIG=''
GTK_LIBS=''
HAVE_NASM_FALSE=''
HAVE_NASM_TRUE=''
INCLUDES=''
INSTALL_DATA='${INSTALL} -m 644'
INSTALL_PROGRAM='${INSTALL}'
INSTALL_SCRIPT='${INSTALL}'
INSTALL_STRIP_PROGRAM='$(install_sh) -c -s'
LD=''
LDADD=''
LDFLAGS=''
LIBICONV=''
LIBOBJS=''
LIBS=''
LIBTOOL=''
LIBTOOL_DEPS=''
LIB_MAJOR_VERSION=''
LIB_MINOR_VERSION=''
LIB_WITH_DECODER_FALSE=''
LIB_WITH_DECODER_TRUE=''
LIPO=''
LN_S=''
LTLIBICONV=''
LTLIBOBJS=''
MAINT='#'
MAINTAINER_MODE_FALSE=''
MAINTAINER_MODE_TRUE='#'
MAKEDEP=''
MAKEINFO='${SHELL} /tmp/deployment/application/soundpuzzle_installation/lame-folder/lame-tar/missing --run makeinfo'
MKDIR_P='/bin/mkdir -p'
NASM=''
NASM_FORMAT=''
NM=''
NMEDIT=''
OBJDUMP=''
OBJEXT=''
OTOOL64=''
OTOOL=''
PACKAGE='lame'
PACKAGE_BUGREPORT='lame-dev#lists.sf.net'
PACKAGE_NAME='lame'
PACKAGE_STRING='lame 3.99.5'
PACKAGE_TARNAME='lame'
PACKAGE_URL=''
PACKAGE_VERSION='3.99.5'
PATH_SEPARATOR=':'
PKG_CONFIG=''
PKG_CONFIG_LIBDIR=''
PKG_CONFIG_PATH=''
RANLIB=''
RM_F=''
SED=''
SET_MAKE=''
SHELL='/bin/sh'
SNDFILE_CFLAGS=''
SNDFILE_LIBS=''
STRIP=''
U=''
VERSION='3.99.5'
WITH_FRONTEND=''
WITH_MP3RTP=''
WITH_MP3X=''
WITH_VECTOR_FALSE=''
WITH_VECTOR_TRUE=''
WITH_XMM_FALSE=''
WITH_XMM_TRUE=''
ac_ct_CC='/usr/bin/gcc'
ac_ct_DUMPBIN=''
am__EXEEXT_FALSE=''
am__EXEEXT_TRUE=''
am__fastdepCC_FALSE=''
am__fastdepCC_TRUE=''
am__include='include'
am__isrc=''
am__leading_dot='.'
am__quote=''
am__tar='${AMTAR} chof - "$$tardir"'
am__untar='${AMTAR} xf -'
bindir='${exec_prefix}/bin'
build='x86_64-unknown-linux-gnu'
build_alias=''
build_cpu='x86_64'
build_os='linux-gnu'
build_vendor='unknown'
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
dvidir='${docdir}'
exec_prefix='NONE'
host='x86_64-unknown-linux-gnu'
host_alias=''
host_cpu='x86_64'
host_os='linux-gnu'
host_vendor='unknown'
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
install_sh='${SHELL} /tmp/deployment/application/soundpuzzle_installation/lame-folder/lame-tar/install-sh'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mandir='${datarootdir}/man'
mkdir_p='/bin/mkdir -p'
oldincludedir='/usr/include'
pdfdir='${docdir}'
prefix='NONE'
program_transform_name='s,x,x,'
psdir='${docdir}'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
sysconfdir='${prefix}/etc'
target_alias=''
## ----------- ##
## confdefs.h. ##
## ----------- ##
/* confdefs.h */
#define PACKAGE_NAME "lame"
#define PACKAGE_TARNAME "lame"
#define PACKAGE_VERSION "3.99.5"
#define PACKAGE_STRING "lame 3.99.5"
#define PACKAGE_BUGREPORT "lame-dev#lists.sf.net"
#define PACKAGE_URL ""
#define PACKAGE "lame"
#define VERSION "3.99.5"
configure: exit 77
I was able to fix the issue by calling the shell script via commands: instead of container_commands:
Looks like Elastic Beanstalk container_commands executed without PATH and SHELL environment variables. This is what I got in /var/log/cfn-init-cmd.log
[INFO] Command env
[INFO] -----------------------Command Output-----------------------
[INFO] RDS_HOSTNAME=******
[INFO] RDS_DB_NAME=*****
[INFO] PHP_ALLOW_URL_FOPEN=On
[INFO] PHP_DOCUMENT_ROOT=
[INFO] RDS_PASSWORD=*****
[INFO] RDS_USERNAME=root
[INFO] PHP_MEMORY_LIMIT=256M
[INFO] PWD=/var/app/ondeck
[INFO] PHP_MAX_EXECUTION_TIME=60
[INFO] PHP_DISPLAY_ERRORS=Off
[INFO] SHLVL=1
[INFO] EB_IS_COMMAND_LEADER=true
[INFO] PHP_COMPOSER_OPTIONS=
[INFO] PHP_DATE_TIMEZONE=UTC
[INFO] PHP_ZLIB_OUTPUT_COMPRESSION=Off
[INFO] RDS_PORT=5432
[INFO] _=/bin/env
Easy solution is to use shell wrapper that will reset needed variables to their default values.
scripts/env_exec
#!/bin/bash
export SHELL="${SHELL:-default}"
export PATH="${PATH:-default}"
exec $#
And launch needed scripts through it:
container_commands:
env:
command: "env"
env_exec:
command: "scripts/env_exec env"
compile_stuff:
command: "scripts/env_exec scripts/compile_stuff.sh"
Result:
[INFO] Command env_exec
[INFO] -----------------------Command Output-----------------------
[INFO] RDS_HOSTNAME=******
[INFO] RDS_DB_NAME=*****
[INFO] SHELL=/bin/bash
[INFO] PHP_ALLOW_URL_FOPEN=On
[INFO] RDS_PASSWORD=*****
[INFO] PHP_DOCUMENT_ROOT=
[INFO] RDS_USERNAME=root
[INFO] PHP_MEMORY_LIMIT=256M
[INFO] PATH=/usr/local/bin:/bin:/usr/bin
[INFO] PWD=/var/app/ondeck
[INFO] PHP_MAX_EXECUTION_TIME=60
[INFO] PHP_DISPLAY_ERRORS=Off
[INFO] SHLVL=1
[INFO] PHP_COMPOSER_OPTIONS=
[INFO] EB_IS_COMMAND_LEADER=true
[INFO] PHP_DATE_TIMEZONE=UTC
[INFO] PHP_ZLIB_OUTPUT_COMPRESSION=Off
[INFO] RDS_PORT=5432