Can`t compile project - rust

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.

Related

Rust multiple crates fail to compile due to permission denied

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.

failed to run custom build command for `torch-sys v0.8.0`

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?

Cross compile error `ld: unknown option: --as-needed`

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>"

Issue installing any Python version 3.8+ since macOS Monterey update

Prior to the Monterey update, I had a fairly stable method of running x86 versions of Python (3.8, and 3.10) on my M1 Mac by adapting these instructions (basically, arch -x86_64 brew to install x86 versions of Python dependencies and using arch -x86_64 pyenv to install Python).
Since Monterey, whenever I try to install a different version of Python 3.8+ (e.g. 3.9.11), I get this error:
BUILD FAILED (OS X 12.3 using python-build 20180424)
Inspect or clean up the working tree at /var/folders/q6/w2pgnv455zx_swdp919_zsww0000gn/T/python-build.20220324065050.66757
Results logged to /var/folders/q6/w2pgnv455zx_swdp919_zsww0000gn/T/python-build.20220324065050.66757.log
Last 10 log lines:
"_libintl_textdomain", referenced from:
_PyIntl_textdomain in libpython3.9.a(_localemodule.o)
_PyIntl_textdomain in libpython3.9.a(_localemodule.o)
ld: symbol(s) not found for architecture x86_64
ld: symbol(s) not found for architecture x86_64
clang: clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Programs/_testembed] Error 1
make: *** Waiting for unfinished jobs....
make: *** [python.exe] Error 1
I am struggling to find anything significant in the corresponding config.log (top lines included):
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by python configure 3.9, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ ./configure --prefix=/Users/joshualee/.pyenv/versions/3.9.11_x86 --libdir=/Users/joshualee/.pyenv/versions/3.9.11_x86/lib --with-openssl=/opt/homebrew/opt/openssl#1.1
## --------- ##
## Platform. ##
## --------- ##
hostname = Macbook-Pro-2.local
uname -m = x86_64
uname -r = 21.4.0
uname -s = Darwin
uname -v = Darwin Kernel Version 21.4.0: Mon Feb 21 20:35:58 PST 2022; root:xnu-8020.101.4~2/RELEASE_ARM64_T6000
/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 21.4.0: Mon Feb 21 20:35:58 PST 2022; root:xnu-8020.101.4~2/RELEASE_ARM64_T6000
Kernel configured for up to 10 processors.
10 processors are physically available.
10 processors are logically available.
Processor type: i486 (Intel 80486)
Processors active: 0 1 2 3 4 5 6 7 8 9
Primary memory available: 16.00 gigabytes
Default processor set: 515 tasks, 2684 threads, 10 processors
Load average: 2.49, Mach factor: 7.50
/bin/machine = unknown
/usr/bin/oslevel = unknown
/bin/universe = unknown
PATH: /opt/homebrew/Cellar/pyenv/2.2.5/libexec
PATH: /opt/homebrew/Cellar/pyenv/2.2.5/plugins/python-build/bin
PATH: /Users/joshualee/.pyenv/shims
PATH: /opt/homebrew/bin
PATH: /opt/homebrew/sbin
PATH: /usr/local/bin
PATH: /usr/bin
PATH: /bin
PATH: /usr/sbin
PATH: /sbin
PATH: /Users/joshualee/.local/bin
## ----------- ##
## Core tests. ##
## ----------- ##
configure:2860: checking build system type
configure:2874: result: x86_64-apple-darwin21.4.0
configure:2894: checking host system type
configure:2907: result: x86_64-apple-darwin21.4.0
configure:2937: checking for python3.9
configure:2967: result: no
configure:2937: checking for python3
configure:2953: found /Users/joshualee/.pyenv/shims/python3
configure:2964: result: python3
configure:3058: checking for --enable-universalsdk
configure:3105: result: no
configure:3129: checking for --with-universal-archs
configure:3144: result: no
configure:3300: checking MACHDEP
configure:3351: result: "darwin"
configure:3645: checking for gcc
configure:3672: result: clang
configure:3901: checking for C compiler version
configure:3910: clang --version >&5
Apple clang version 13.1.6 (clang-1316.0.21.2)
Target: x86_64-apple-darwin21.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
configure:3921: $? = 0
configure:3910: clang -v >&5
Apple clang version 13.1.6 (clang-1316.0.21.2)
Target: x86_64-apple-darwin21.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
configure:3921: $? = 0
configure:3910: clang -V >&5
clang: error: argument to '-V' is missing (expected 1 value)
clang: error: no input files
configure:3921: $? = 1
configure:3910: clang -qversion >&5
clang: error: unknown argument '-qversion'; did you mean '--version'?
clang: error: no input files
configure:3921: $? = 1
configure:3941: checking whether the C compiler works
configure:3963: clang -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/usr/local/opt/openssl#3/include -I/usr/local/opt/xz/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/readline/include -I/Users/joshualee/.pyenv/versions/3.9.11_x86/include -I/opt/homebrew/include -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/readline/lib -L/Users/joshualee/.pyenv/versions/3.9.11_x86/lib -L/usr/local/opt/openssl#3/lib -L/usr/local/opt/xz/lib -L/opt/homebrew/lib -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib conftest.c >&5
ld: warning: directory not found for option '-L/Users/joshualee/.pyenv/versions/3.9.11_x86/lib'
configure:3967: $? = 0
configure:4015: result: yes
configure:4018: checking for C compiler default output file name
configure:4020: result: a.out
configure:4026: checking for suffix of executables
configure:4033: clang -o conftest -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/usr/local/opt/openssl#3/include -I/usr/local/opt/xz/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/readline/include -I/Users/joshualee/.pyenv/versions/3.9.11_x86/include -I/opt/homebrew/include -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/readline/lib -L/Users/joshualee/.pyenv/versions/3.9.11_x86/lib -L/usr/local/opt/openssl#3/lib -L/usr/local/opt/xz/lib -L/opt/homebrew/lib -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib conftest.c >&5
ld: warning: directory not found for option '-L/Users/joshualee/.pyenv/versions/3.9.11_x86/lib'
configure:4037: $? = 0
configure:4059: result:
configure:4081: checking whether we are cross compiling
configure:4089: clang -o conftest -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/usr/local/opt/openssl#3/include -I/usr/local/opt/xz/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/readline/include -I/Users/joshualee/.pyenv/versions/3.9.11_x86/include -I/opt/homebrew/include -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/readline/lib -L/Users/joshualee/.pyenv/versions/3.9.11_x86/lib -L/usr/local/opt/openssl#3/lib -L/usr/local/opt/xz/lib -L/opt/homebrew/lib -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib conftest.c >&5
ld: warning: directory not found for option '-L/Users/joshualee/.pyenv/versions/3.9.11_x86/lib'
configure:4093: $? = 0
configure:4100: ./conftest
configure:4104: $? = 0
configure:4119: result: no
configure:4124: checking for suffix of object files
configure:4146: clang -c -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/usr/local/opt/openssl#3/include -I/usr/local/opt/xz/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/readline/include -I/Users/joshualee/.pyenv/versions/3.9.11_x86/include -I/opt/homebrew/include conftest.c >&5
configure:4150: $? = 0
configure:4171: result: o
configure:4175: checking whether we are using the GNU C compiler
configure:4194: clang -c -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/usr/local/opt/openssl#3/include -I/usr/local/opt/xz/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/readline/include -I/Users/joshualee/.pyenv/versions/3.9.11_x86/include -I/opt/homebrew/include conftest.c >&5
configure:4194: $? = 0
configure:4203: result: yes
configure:4212: checking whether clang accepts -g
configure:4232: clang -c -g -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/readline/include -I/Users/joshualee/.pyenv/versions/3.9.11_x86/include -I/opt/homebrew/include conftest.c >&5
configure:4232: $? = 0
configure:4273: result: yes
configure:4290: checking for clang option to accept ISO C89
configure:4353: clang -c -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/usr/local/opt/openssl#3/include -I/usr/local/opt/xz/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/readline/include -I/Users/joshualee/.pyenv/versions/3.9.11_x86/include -I/opt/homebrew/include conftest.c >&5
configure:4353: $? = 0
configure:4366: result: none needed
configure:4391: checking how to run the C preprocessor
configure:4422: clang -E -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/readline/include -I/Users/joshualee/.pyenv/versions/3.9.11_x86/include -I/opt/homebrew/include conftest.c
configure:4422: $? = 0
configure:4436: clang -E -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/readline/include -I/Users/joshualee/.pyenv/versions/3.9.11_x86/include -I/opt/homebrew/include conftest.c
conftest.c:8:10: fatal error: 'ac_nonexistent.h' file not found
#include <ac_nonexistent.h>
^~~~~~~~~~~~~~~~~~
1 error generated.
configure:4436: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define _GNU_SOURCE 1
| #define _NETBSD_SOURCE 1
| #define __BSD_VISIBLE 1
| #define _DARWIN_C_SOURCE 1
| #define _PYTHONFRAMEWORK ""
| /* end confdefs.h. */
| #include <ac_nonexistent.h>
configure:4461: result: clang -E
configure:4481: clang -E -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/readline/include -I/Users/joshualee/.pyenv/versions/3.9.11_x86/include -I/opt/homebrew/include conftest.c
configure:4481: $? = 0
configure:4495: clang -E -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/readline/include -I/Users/joshualee/.pyenv/versions/3.9.11_x86/include -I/opt/homebrew/include conftest.c
conftest.c:8:10: fatal error: 'ac_nonexistent.h' file not found
#include <ac_nonexistent.h>
^~~~~~~~~~~~~~~~~~
1 error generated.
configure:4495: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define _GNU_SOURCE 1
| #define _NETBSD_SOURCE 1
| #define __BSD_VISIBLE 1
| #define _DARWIN_C_SOURCE 1
| #define _PYTHONFRAMEWORK ""
| /* end confdefs.h. */
| #include <ac_nonexistent.h>
configure:4523: checking for grep that handles long lines and -e
configure:4581: result: /usr/bin/grep
configure:4586: checking for a sed that does not truncate output
configure:4650: result: /usr/bin/sed
configure:4658: checking for --with-cxx-main=<compiler>
configure:4684: result: no
configure:4933: checking for clang++
configure:4966: result: no
configure:5202:
By default, distutils will build C++ extension modules with "clang++".
If this is not intended, then set CXX on the configure command line.
configure:5211: checking for the platform triplet based on compiler characteristics
configure:5361: result: darwin
configure:5369: checking for multiarch
configure:5381: result:
configure:5398: checking for -Wl,--no-as-needed
configure:5414: clang -o conftest -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/usr/local/opt/openssl#3/include -I/usr/local/opt/xz/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/readline/include -I/Users/joshualee/.pyenv/versions/3.9.11_x86/include -I/opt/homebrew/include -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/readline/lib -L/Users/joshualee/.pyenv/versions/3.9.11_x86/lib -L/usr/local/opt/openssl#3/lib -L/usr/local/opt/xz/lib -L/opt/homebrew/lib -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib -Wl,--no-as-needed conftest.c >&5
ld: warning: directory not found for option '-L/Users/joshualee/.pyenv/versions/3.9.11_x86/lib'
ld: unknown option: --no-as-needed
clang: error: linker command failed with exit code 1 (use -v to see invocation)
configure:5414: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define _GNU_SOURCE 1
| #define _NETBSD_SOURCE 1
| #define __BSD_VISIBLE 1
| #define _DARWIN_C_SOURCE 1
| #define _PYTHONFRAMEWORK ""
| /* end confdefs.h. */
Things I have tried:
re-installing xcode command line tools
re-installing with brew (and arch brew -x86_64) pyenv pre-requisites: openssl, readling, sqlite3 etc.
different CFLAGS and LDFLAGS (I can't remember which but largely, pointing to x86 folders for openssl, zlib, readline, etc.)
I am still fairly new to using M1 Macs so any guidance would be much appreciated.
The solution was to
install gettext library with arch -x86_64 /usr/local/bin/brew install gettext
add path to gettext to pyenv CFLAGS and LDFLAGS in your .zshrc file. (Usually it's at ~/.zshrc)
export LDFLAGS="-L/usr/local/opt/gettext/lib"
export CPPFLAGS="-I/usr/local/opt/gettext/include"
restart terminal

AWS: C compiler on EC2 not working when using Elastic Beanstalk container_commands

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

Resources