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

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

Related

How to fix linker error "cannot find -lGL, -lX11, -lXi" with cargo on Ubuntu?

When compiling Rust code on a fresh install of Ubuntu 22.04 LTS I get a linker error:
error: linking with `cc` failed: exit status: 1
|
= note: "cc" "-m64" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/unnamed_mmo-c2ee1e54555140b9.unnamed_mmo.f5321ab2-cgu.0.rcgu.o" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/unnamed_mmo-c2ee1e54555140b9.unnamed_mmo.f5321ab2-cgu.1.rcgu.o" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/unnamed_mmo-c2ee1e54555140b9.unnamed_mmo.f5321ab2-cgu.10.rcgu.o" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/unnamed_mmo-c2ee1e54555140b9.unnamed_mmo.f5321ab2-cgu.11.rcgu.o" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/unnamed_mmo-c2ee1e54555140b9.unnamed_mmo.f5321ab2-cgu.12.rcgu.o" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/unnamed_mmo-c2ee1e54555140b9.unnamed_mmo.f5321ab2-cgu.13.rcgu.o" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/unnamed_mmo-c2ee1e54555140b9.unnamed_mmo.f5321ab2-cgu.14.rcgu.o" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/unnamed_mmo-c2ee1e54555140b9.unnamed_mmo.f5321ab2-cgu.15.rcgu.o" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/unnamed_mmo-c2ee1e54555140b9.unnamed_mmo.f5321ab2-cgu.2.rcgu.o" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/unnamed_mmo-c2ee1e54555140b9.unnamed_mmo.f5321ab2-cgu.3.rcgu.o" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/unnamed_mmo-c2ee1e54555140b9.unnamed_mmo.f5321ab2-cgu.4.rcgu.o" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/unnamed_mmo-c2ee1e54555140b9.unnamed_mmo.f5321ab2-cgu.5.rcgu.o" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/unnamed_mmo-c2ee1e54555140b9.unnamed_mmo.f5321ab2-cgu.6.rcgu.o" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/unnamed_mmo-c2ee1e54555140b9.unnamed_mmo.f5321ab2-cgu.7.rcgu.o" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/unnamed_mmo-c2ee1e54555140b9.unnamed_mmo.f5321ab2-cgu.8.rcgu.o" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/unnamed_mmo-c2ee1e54555140b9.unnamed_mmo.f5321ab2-cgu.9.rcgu.o" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/unnamed_mmo-c2ee1e54555140b9.cn983jvsi7mcs9h.rcgu.o" "-Wl,--as-needed" "-L" "/media/mreggo/Development/unnamed-mmo/target/debug/deps" "-L" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libunnamed_mmo-2c746eee4874a18d.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libegui_macroquad-a8cc6dc94b07d25e.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libmacroquad-ac264e227317db34.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libbumpalo-7d9155bf1a1665c3.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libfontdue-33a63242772c0327.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libttf_parser-b3c8b8d720c6b5c7.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libhashbrown-9e2decfb672733a0.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libahash-c5793c70560e7663.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libimage-1c895249afdb303d.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libcolor_quant-714c7bd4ee3b992f.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libnum_iter-95204558e59f30d3.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libpng-2cbdbec1823fbc5f.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libminiz_oxide-8db99177623dc4aa.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libcrc32fast-6a860851d096dc79.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libdeflate-c8c1809616477c8f.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libbyteorder-7b9cf4829e681df6.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libadler32-74ce685e2e920957.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libbitflags-8780a692ba87d6ba.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libnum_rational-12de4139181448df.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libnum_integer-8cab700b16a4e037.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libnum_traits-26d4c34b964a9552.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libquad_rand-99bba40bc69d3f4c.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libglam-370e9f6f5d986fca.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libegui_miniquad-2c0aac1d91c9642f.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libquad_url-9e43f30574a6006a.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libwebbrowser-43f0af5d13c99f5b.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libegui-4e41391646208c48.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libepaint-77b2a6267e67391b.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libnohash_hasher-9b983351300bd960.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libab_glyph-6925c34a95138a11.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libowned_ttf_parser-033f2e7aaabf7169.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libttf_parser-062a0ad8dfb5981c.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libab_glyph_rasterizer-c02d35faa1a9dd51.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libahash-0cdb04cf6022941f.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libgetrandom-5f90ecbc2af37a3e.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libcfg_if-98b415fcc3fed93d.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libonce_cell-d6d4d0dc0f424a80.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libatomic_refcell-c2ffa9b2b327b49d.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libemath-29d160f1dc82ca95.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libbytemuck-7d72d8521917be17.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libminiquad-10b6f8f5710eb382.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/libsapp_linux-1f0a95a8b78fa130.rlib" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/liblibc-6764eec4e7ae87b9.rlib" "-Wl,--start-group" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-a0276d45c4e70d36.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-e72e4bc570b29ac1.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-ef705efd7af4ac2a.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-85860d11f97207b6.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-dcaf592febce562e.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr-7eebb71bfaa13f92.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-1bad01341e0f12ee.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-a19d31fe44863ac3.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-a0aa8c376bb6fe43.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-4163b7759a8467eb.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-037a678c8b3ea5d2.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-a1a7907c635fb0ff.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-54dd34e8808f1bfe.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-7f95849889eaf9ae.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-b38f3f2103ea975c.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-36492562254cd4fb.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-6648866114f93094.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-8180acc287427382.rlib" "-Wl,--end-group" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-e1b6a3281fcc9d3d.rlib" "-Wl,-Bdynamic" "-lGL" "-lX11" "-lXi" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-L" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/media/mreggo/Development/unnamed-mmo/target/debug/deps/unnamed_mmo-c2ee1e54555140b9" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro,-znow" "-nodefaultlibs"
= note: /usr/bin/ld: cannot find -lGL: No such file or directory
/usr/bin/ld: cannot find -lX11: No such file or directory
/usr/bin/ld: cannot find -lXi: No such file or directory
collect2: error: ld returned 1 exit status
Here are my system details:
> uname -a
Linux AAAHHH 5.15.0-43-generic #46-Ubuntu SMP Tue Jul 12 10:30:17 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
>
> cargo -V
cargo 1.63.0 (fd9c4297c 2022-07-01)
Looks like you're missing a few libraries your project is trying to link with. Try this:
$ sudo apt install libgl-dev libx11-dev libxi-dev

Can`t compile project

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.

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

glibc Cross Compile Configure Error

I would like to cross compile glibc. But, I 'm getting an error.
glibc version is 2.24.
I tried compiling host and target i686-elf.
My $MACHTYPE environment label is x86_64-pc-linux-gnu.
Target directory includes binutils-2.27 and gcc-6.2.0.
My PATH environment is:
/home/ercan/cross/tools/tools_binaries/i686/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
Console output have been listing to below:
ercan#SAMSUNG ~/cross/tools/tools_sources/build-glibc $ ../glibc-2.24/configure --prefix="/home/ercan/cross/tools/tools_binaries/i686/i686-elf" --build=$MACHTYPE --host=i686-elf --target=i686-elf --with-headers="/home/ercan/cross/tools/tools_binaries/i686/i686-elf/include" libc_cv_forced_unwind=yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... i686-pc-elf
checking for i686-elf-gcc... i686-elf-gcc
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether i686-elf-gcc accepts -g... yes
checking for gcc... gcc
checking for i686-elf-readelf... i686-elf-readelf
checking for i686-elf-g++... i686-elf-g++
checking whether we are using the GNU C++ compiler... yes
checking whether i686-elf-g++ accepts -g... yes
checking whether i686-elf-g++ can link programs... no
checking for sysdeps preconfigure fragments... aarch64 alpha arm hppa i386 m68k microblaze mips nacl nios2 powerpc s390 sh sparc tile x86_64
configure: running configure fragment for add-on libidn
configure: error:
*** The GNU C library is currently unavailable for this platform.
*** If you are interested in seeing glibc on this platform visit
*** the "How to submit a new port" in the wiki:
*** https://sourceware.org/glibc/wiki/#Development
*** and join the community!
It is not configured and config.log that is in build-glibc which content has been listing below:
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by GNU C Library configure (see version.h), which was
generated by GNU Autoconf 2.69. Invocation command line was
$ ../glibc-2.24/configure --prefix=/home/ercan/cross/tools/tools_binaries/i686/i686-elf --build=x86_64-pc-linux-gnu --host=i686-elf --target=i686-elf --with-headers=/home/ercan/cross/tools/tools_binaries/i686/i686-elf/include libc_cv_forced_unwind=yes
## --------- ##
## Platform. ##
## --------- ##
hostname = SAMSUNG
uname -m = x86_64
uname -r = 4.4.0-21-generic
uname -s = Linux
uname -v = #37-Ubuntu SMP Mon Apr 18 18:33:37 UTC 2016
/usr/bin/uname -p = unknown
/bin/uname -X = unknown
/bin/arch = unknown
/usr/bin/arch -k = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo = unknown
/bin/machine = unknown
/usr/bin/oslevel = unknown
/bin/universe = unknown
PATH: /home/ercan/cross/tools/tools_binaries/i686/bin
PATH: /usr/local/sbin
PATH: /usr/local/bin
PATH: /usr/sbin
PATH: /usr/bin
PATH: /sbin
PATH: /bin
PATH: /usr/games
PATH: /usr/local/games
## ----------- ##
## Core tests. ##
## ----------- ##
configure:2189: checking build system type
configure:2203: result: x86_64-pc-linux-gnu
configure:2223: checking host system type
configure:2236: result: i686-pc-elf
configure:2265: checking for i686-elf-gcc
configure:2281: found /home/ercan/cross/tools/tools_binaries/i686/bin/i686-elf-gcc
configure:2292: result: i686-elf-gcc
configure:2561: checking for C compiler version
configure:2570: i686-elf-gcc --version >&5
i686-elf-gcc (GCC) 6.2.0
Copyright (C) 2016 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:2581: $? = 0
configure:2570: i686-elf-gcc -v >&5
Using built-in specs.
COLLECT_GCC=i686-elf-gcc
COLLECT_LTO_WRAPPER=/home/ercan/cross/tools/tools_binaries/i686/libexec/gcc/i686-elf/6.2.0/lto-wrapper
Target: i686-elf
Configured with: ../gcc-6.2.0/configure --target=i686-elf --prefix=/home/ercan/cross/tools/tools_binaries/i686 --enable-languages=c,c++ --without-headers
Thread model: single
gcc version 6.2.0 (GCC)
configure:2581: $? = 0
configure:2570: i686-elf-gcc -V >&5
i686-elf-gcc: error: unrecognized command line option '-V'
i686-elf-gcc: fatal error: no input files
compilation terminated.
configure:2581: $? = 1
configure:2570: i686-elf-gcc -qversion >&5
i686-elf-gcc: error: unrecognized command line option '-qversion'; did you mean '--version'?
i686-elf-gcc: fatal error: no input files
compilation terminated.
configure:2581: $? = 1
configure:2586: checking for suffix of object files
configure:2608: i686-elf-gcc -c conftest.c >&5
configure:2612: $? = 0
configure:2633: result: o
configure:2637: checking whether we are using the GNU C compiler
configure:2656: i686-elf-gcc -c conftest.c >&5
configure:2656: $? = 0
configure:2665: result: yes
configure:2674: checking whether i686-elf-gcc accepts -g
configure:2694: i686-elf-gcc -c -g conftest.c >&5
configure:2694: $? = 0
configure:2735: result: yes
configure:2764: checking for gcc
configure:2780: found /usr/bin/gcc
configure:2791: result: gcc
configure:2815: checking for i686-elf-readelf
configure:2831: found /home/ercan/cross/tools/tools_binaries/i686/bin/i686-elf-readelf
configure:2842: result: i686-elf-readelf
configure:2920: checking for i686-elf-g++
configure:2936: found /home/ercan/cross/tools/tools_binaries/i686/bin/i686-elf-g++
configure:2947: result: i686-elf-g++
configure:3018: checking for C++ compiler version
configure:3027: i686-elf-g++ --version >&5
i686-elf-g++ (GCC) 6.2.0
Copyright (C) 2016 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:3038: $? = 0
configure:3027: i686-elf-g++ -v >&5
Using built-in specs.
COLLECT_GCC=i686-elf-g++
COLLECT_LTO_WRAPPER=/home/ercan/cross/tools/tools_binaries/i686/libexec/gcc/i686-elf/6.2.0/lto-wrapper
Target: i686-elf
Configured with: ../gcc-6.2.0/configure --target=i686-elf --prefix=/home/ercan/cross/tools/tools_binaries/i686 --enable-languages=c,c++ --without-headers
Thread model: single
gcc version 6.2.0 (GCC)
configure:3038: $? = 0
configure:3027: i686-elf-g++ -V >&5
i686-elf-g++: error: unrecognized command line option '-V'
i686-elf-g++: fatal error: no input files
compilation terminated.
configure:3038: $? = 1
configure:3027: i686-elf-g++ -qversion >&5
i686-elf-g++: error: unrecognized command line option '-qversion'; did you mean '--version'?
i686-elf-g++: fatal error: no input files
compilation terminated.
configure:3038: $? = 1
configure:3042: checking whether we are using the GNU C++ compiler
configure:3061: i686-elf-g++ -c conftest.cpp >&5
configure:3061: $? = 0
configure:3070: result: yes
configure:3079: checking whether i686-elf-g++ accepts -g
configure:3099: i686-elf-g++ -c -g conftest.cpp >&5
configure:3099: $? = 0
configure:3140: result: yes
configure:3165: checking whether i686-elf-g++ can link programs
configure:3188: i686-elf-g++ -o conftest -g -O2 conftest.cpp >&5
/home/ercan/cross/tools/tools_binaries/i686/lib/gcc/i686-elf/6.2.0/../../../../i686-elf/bin/ld: cannot find crt0.o: No such file or directory
/home/ercan/cross/tools/tools_binaries/i686/lib/gcc/i686-elf/6.2.0/../../../../i686-elf/bin/ld: cannot find crtbegin.o: No such file or directory
/home/ercan/cross/tools/tools_binaries/i686/lib/gcc/i686-elf/6.2.0/../../../../i686-elf/bin/ld: cannot find -lstdc++
/home/ercan/cross/tools/tools_binaries/i686/lib/gcc/i686-elf/6.2.0/../../../../i686-elf/bin/ld: cannot find -lm
/home/ercan/cross/tools/tools_binaries/i686/lib/gcc/i686-elf/6.2.0/../../../../i686-elf/bin/ld: cannot find -lgcc
/home/ercan/cross/tools/tools_binaries/i686/lib/gcc/i686-elf/6.2.0/../../../../i686-elf/bin/ld: cannot find -lg
/home/ercan/cross/tools/tools_binaries/i686/lib/gcc/i686-elf/6.2.0/../../../../i686-elf/bin/ld: cannot find -lc
/home/ercan/cross/tools/tools_binaries/i686/lib/gcc/i686-elf/6.2.0/../../../../i686-elf/bin/ld: cannot find -lgcc
/home/ercan/cross/tools/tools_binaries/i686/lib/gcc/i686-elf/6.2.0/../../../../i686-elf/bin/ld: cannot find crtend.o: No such file or directory
collect2: error: ld returned 1 exit status
configure:3188: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "GNU C Library"
| #define PACKAGE_TARNAME "glibc"
| #define PACKAGE_VERSION "(see version.h)"
| #define PACKAGE_STRING "GNU C Library (see version.h)"
| #define PACKAGE_BUGREPORT "http://sourceware.org/bugzilla/"
| #define PACKAGE_URL "http://www.gnu.org/software/glibc/"
| #define PKGVERSION "(GNU libc) "
| #define REPORT_BUGS_TO "<http://www.gnu.org/software/libc/bugs.html>"
| /* end confdefs.h. */
|
| int
| main ()
| {
|
| ;
| return 0;
| }
configure:3211: i686-elf-g++ -o conftest -g -O2 -static conftest.cpp >&5
conftest.cpp:12:20: fatal error: iostream: No such file or directory
#include <iostream>
^
compilation terminated.
configure:3211: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "GNU C Library"
| #define PACKAGE_TARNAME "glibc"
| #define PACKAGE_VERSION "(see version.h)"
| #define PACKAGE_STRING "GNU C Library (see version.h)"
| #define PACKAGE_BUGREPORT "http://sourceware.org/bugzilla/"
| #define PACKAGE_URL "http://www.gnu.org/software/glibc/"
| #define PKGVERSION "(GNU libc) "
| #define REPORT_BUGS_TO "<http://www.gnu.org/software/libc/bugs.html>"
| /* end confdefs.h. */
|
| #include <iostream>
|
| int
| main()
| {
| std::cout << "Hello, world!";
| return 0;
| }
|
configure:3226: result: no
configure:3709: checking for sysdeps preconfigure fragments
configure:3716: result:
configure:3787: running configure fragment for add-on libidn
configure:3868: error:
*** The GNU C library is currently unavailable for this platform.
*** If you are interested in seeing glibc on this platform visit
*** the "How to submit a new port" in the wiki:
*** https://sourceware.org/glibc/wiki/#Development
*** and join the community!
## ---------------- ##
## Cache variables. ##
## ---------------- ##
ac_cv_build=x86_64-pc-linux-gnu
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=
ac_cv_env_CC_value=
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_CXXFLAGS_set=
ac_cv_env_CXXFLAGS_value=
ac_cv_env_CXX_set=
ac_cv_env_CXX_value=
ac_cv_env_LDFLAGS_set=
ac_cv_env_LDFLAGS_value=
ac_cv_env_LIBS_set=
ac_cv_env_LIBS_value=
ac_cv_env_build_alias_set=set
ac_cv_env_build_alias_value=x86_64-pc-linux-gnu
ac_cv_env_host_alias_set=set
ac_cv_env_host_alias_value=i686-elf
ac_cv_env_target_alias_set=set
ac_cv_env_target_alias_value=i686-elf
ac_cv_host=i686-pc-elf
ac_cv_objext=o
ac_cv_prog_BUILD_CC=gcc
ac_cv_prog_CC=i686-elf-gcc
ac_cv_prog_CXX=i686-elf-g++
ac_cv_prog_READELF=i686-elf-readelf
ac_cv_prog_cc_g=yes
ac_cv_prog_cxx_g=yes
libc_cv_cxx_link_ok=no
libc_cv_forced_unwind=yes
libc_cv_nss_crypt=no
## ----------------- ##
## Output variables. ##
## ----------------- ##
AR=''
AS=''
ASFLAGS_config=''
AUTOCONF=''
AWK=''
BASH_SHELL=''
BISON=''
BUILD_CC='gcc'
CC='i686-elf-gcc'
CFLAGS='-g -O2'
CPP='i686-elf-gcc -E'
CPPFLAGS=''
CPPUNDEFS=''
CXX=''
CXXFLAGS='-g -O2'
CXX_SYSINCLUDES=''
DEFINES=''
DEFS=''
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
INSTALL_DATA=''
INSTALL_INFO=''
INSTALL_PROGRAM=''
INSTALL_SCRIPT=''
LD=''
LDFLAGS=''
LIBGD=''
LIBOBJS=''
LIBS=''
LN_S=''
LTLIBOBJS=''
MAKE=''
MAKEINFO=''
MSGFMT=''
NM=''
OBJCOPY=''
OBJDUMP=''
OBJEXT='o'
PACKAGE_BUGREPORT='http://sourceware.org/bugzilla/'
PACKAGE_NAME='GNU C Library'
PACKAGE_STRING='GNU C Library (see version.h)'
PACKAGE_TARNAME='glibc'
PACKAGE_URL='http://www.gnu.org/software/glibc/'
PACKAGE_VERSION='(see version.h)'
PATH_SEPARATOR=':'
PERL=''
PKGVERSION='(GNU libc) '
PKGVERSION_TEXI='(GNU libc) '
READELF='i686-elf-readelf'
RELEASE=''
REPORT_BUGS_TEXI='#uref{http://www.gnu.org/software/libc/bugs.html}'
REPORT_BUGS_TO='<http://www.gnu.org/software/libc/bugs.html>'
SED=''
SHELL='/bin/bash'
SYSINCLUDES=''
VERSION=''
ac_ct_CC=''
ac_ct_CXX=''
add_on_subdirs=' libidn'
add_ons='libidn'
all_warnings=''
base_machine='i386'
bindir='${exec_prefix}/bin'
bindnow='no'
build='x86_64-pc-linux-gnu'
build_alias='x86_64-pc-linux-gnu'
build_cpu='x86_64'
build_nscd='default'
build_os='linux-gnu'
build_pt_chown='no'
build_vendor='pc'
cross_compiling='yes'
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
dvidir='${docdir}'
enable_lock_elision='no'
enable_timezone_tools='yes'
enable_werror='yes'
exec_prefix='NONE'
fno_unit_at_a_time=''
force_install='yes'
hardcoded_path_in_tests='no'
have_libaudit=''
have_libcap=''
have_selinux=''
host='i686-pc-elf'
host_alias='i686-elf'
host_cpu='i686'
host_os='elf'
host_vendor='pc'
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
ldd_rewrite_script=''
libc_cv_cc_loop_to_function=''
libc_cv_cc_nofma=''
libc_cv_cc_submachine=''
libc_cv_cc_with_libunwind=''
libc_cv_complocaledir=''
libc_cv_cxx_thread_local=''
libc_cv_fpie=''
libc_cv_gcc_unwind_find_fde=''
libc_cv_has_glob_dat=''
libc_cv_hashstyle=''
libc_cv_localstatedir=''
libc_cv_mtls_dialect_gnu2=''
libc_cv_nss_crypt='no'
libc_cv_output_format=''
libc_cv_pic_default=''
libc_cv_pie_default=''
libc_cv_protected_data=''
libc_cv_rootsbindir=''
libc_cv_rtlddir=''
libc_cv_slibdir=''
libc_cv_sysconfdir=''
libc_cv_z_combreloc=''
libc_cv_z_execstack=''
libc_extra_cflags=''
libc_extra_cppflags=''
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
link_obsolete_rpc='no'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mach_interface_list=''
mandir='${datarootdir}/man'
multi_arch='default'
oldincludedir='/usr/include'
pdfdir='${docdir}'
prefix='/home/ercan/cross/tools/tools_binaries/i686/i686-elf'
profile='no'
program_transform_name='s,x,x,'
psdir='${docdir}'
sbindir='${exec_prefix}/sbin'
shared='yes'
sharedstatedir='${prefix}/com'
stack_protector=''
static=''
static_nss='no'
subdirs=' '
submachine=''
sysconfdir='${prefix}/etc'
sysdeps_add_ons=''
sysheaders='/home/ercan/cross/tools/tools_binaries/i686/i686-elf/include'
sysnames=''
target_alias='i686-elf'
use_default_link='default'
use_ldconfig=''
use_nscd='yes'
with_fp='yes'
## ----------- ##
## confdefs.h. ##
## ----------- ##
/* confdefs.h */
#define PACKAGE_NAME "GNU C Library"
#define PACKAGE_TARNAME "glibc"
#define PACKAGE_VERSION "(see version.h)"
#define PACKAGE_STRING "GNU C Library (see version.h)"
#define PACKAGE_BUGREPORT "http://sourceware.org/bugzilla/"
#define PACKAGE_URL "http://www.gnu.org/software/glibc/"
#define PKGVERSION "(GNU libc) "
#define REPORT_BUGS_TO "<http://www.gnu.org/software/libc/bugs.html>"
#define HAVE_LIBIDN 1
configure: exit 1
How I cross compile glibc for i686-elf? Thanks for replies.
You are trying to build glibc for a bare metal target. This won't work as far as I know.
Use newlib if the target is in fact bare metal.
For linux targets, use --host=i686-pc-linux-gnu instead, and pass CC=i686-elf-gcc to configure if necessary.

Compiling wmii on Fedora 15 x86_64

I'm having trouble compiling wmii v3.9.2 on Fedora 15; Here's the interesting part (things break down at the linking stage):
% bmake -de
MAKE all libbio/
MAKE all libfmt/
MAKE all libregexp/
MAKE all libutf/
MAKE all libixp/
MAKE all doc/
MAKE all man/
MAKE all cmd/
MAKE all cmd/wmii/
MAKE all cmd/menu/
LD cmd/wmii9menu.out
/usr/bin/ld: wmii/xext.o: undefined reference to symbol 'XRenderFindVisualFormat'
/usr/bin/ld: note: 'XRenderFindVisualFormat' is defined in DSO /usr/lib64/libXrender.so.1 so try adding it to the linker command line
/usr/lib64/libXrender.so.1: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
*** Failed target: wmii9menu.out
*** Failed command: ../util/link "cc" "$(pkg-config --libs 2>/dev/null) -g -L../lib -L/usr/lib64 ../lib/libregexp9.a ../lib/libbio.a ../lib/libfmt.a ../lib/libutf.a -L../lib -L/usr/lib64 ../lib/libregexp9.a ../lib/libbio.a ../lib/libfmt.a ../lib/libutf.a" wmii9menu.out wmii9menu.o clientutil.o wmii/x11.o wmii/xext.o wmii/geom.o wmii/map.o util.o ../lib/libixp.a $(pkg-config --libs xft xrandr xinerama) -lXext
*** Error code 1
Stop.
bmake: stopped in /srv/redhat/BUILD/wmii+ixp-3.9.2/cmd
*** Failed target: dall
*** Failed command: dirs="libbio libfmt libregexp libutf libixp doc man cmd libwmii_hack rc alternative_wmiircs"; set -e; targ=dall; targ=${targ#d}; for i in $dirs; do export WMII_HGVERSION=""; export BASE=$i/; if [ ! -d $i ]; then echo Skipping nonexistent directory: $i 1>&2; else echo MAKE $targ $BASE; (cd $i && bmake $targ) || exit ; fi; done
*** Error code 1
Stop.
bmake: stopped in /srv/redhat/BUILD/wmii+ixp-3.9.2
Finally, in config.mk, I have the following settings:
...
INCLUDES = -I. -I$(ROOT)/include -I$(INCLUDE) -I/usr/include
LIBS = -L$(ROOT)/lib -L/usr/lib64
...
LDFLAGS += -g $(LIBS)
SOLDFLAGS += $(LDFLAGS)
SHARED = -shared -Wl,-soname=$(SONAME)
STATIC = -static
...
With a little more manual resolution, the statement generating the error is essentially as follows:
gcc \
-o wmii9menu.out\
-L../lib -L/usr/lib $(pkg-config --libs xft xrandr xinerama xext)\
../lib/libregexp9.a ../lib/libbio.a ../lib/libfmt.a\
../lib/libutf.a ../lib/libixp.a\
wmii9menu.o clientutil.o util.o\
wmii/x11.o wmii/xext.o wmii/geom.o wmii/map.o
Here, the pkg-config resolves to the following, which by itself is perfectly correct:
-lXft -lXrandr -lXinerama -lXext
And the solution is as follows:
--- wmii+ixp-3.9.2/config.mk 2011-06-03 14:03:22.950163074 +1000
+++ wmii+ixp-3.9.2/config.mk 2011-06-03 14:03:16.086129011 +1000
## -32 +32 ##
-X11PACKAGES = xft
+X11PACKAGES = xft xext xrandr xrender xinerama

Resources