devos50 / qemu-ios

A QEMU emulator for legacy Apple devices
Other
981 stars 65 forks source link

Compile error on MacOS 14.1 [M1] #113

Open MaximilianCarver opened 10 months ago

MaximilianCarver commented 10 months ago

Hello! I'm trying to compile this on my MacBook Air M1, and I'm getting this error. I've reinstalled Xcode tools several times and manually installed gcc with HomeBrew. Any solutions? My terminal looks like this:

------------------ build % ../configure --enable-sdl --disable-cocoa --target-list=arm-softmmu --disable-capstone --disable-pie --disable-slirp --extra-cflags=-I/usr/local/opt/openssl@3/include --extra-ldflags='-L/usr/local/opt/openssl@3/lib -lcrypto'

ERROR: "cc" cannot build an executable (is your linker broken?)

------------------------ build % cc --version
gcc-13 (Homebrew GCC 13.2.0) 13.2.0
Copyright (C) 2023 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.

Thank you very much

devos50 commented 10 months ago

@MaximilianCarver I just had a look at this, are you sure you have the Xcode command line tools installed? You can do so by running xcode-select --install (or opening Xcode I think).

MaximilianCarver commented 10 months ago

Hello, @devos50 . Yes, I have the Xcode Command Line Tools installed (in fact, I've reinstalled them several times): xcode-select: note: Command line tools are already installed. Use "Software Update" in System Settings or the softwareupdate command line interface to install updates I don't know what else it could be. As a side note, my Xcode version is a beta, but I don't see how that could influence the command line tools. Additionally, in my zshrc, I have set an alias: alias cc='/opt/homebrew/Cellar/gcc/13.2.0/bin/gcc-13'. Any ideas on something I can try? Thank you very much.

Postscript: Sorry for my bad English ;)

MaximilianCarver commented 10 months ago

UPDATE: I'm trying to see if it's a problem with the cc compiler, but it's not. I've been able to compile files with it. Upon entering the QEMU configuration file and modifying the line that refers to host_cc (line 243), to point to a path where the compiler is located, it gives me the same error (the linker error). The strange thing is that a normal file can actually be compiled in that path. It's quite puzzling. Does anyone have any ideas?

tux-linux commented 10 months ago

For me the problem was that OpenSSL was not in the right location. I ended up using the following configure command:

../configure --enable-sdl --disable-cocoa --target-list=arm-softmmu --disable-capstone --disable-pie --disable-slirp --extra-cflags=-I/opt/homebrew/opt/openssl/include --extra-ldflags='-L/opt/homebrew/opt/openssl/include -L/opt/homebrew/opt/openssl/lib -lcrypto'

Of course, I had OpenSSL installed by Homebrew

MaximilianCarver commented 10 months ago

Hello, @tux-linux I just tried this, and the error has changed. Instead of showing the CC error, it now displays an error: glib-2.56 gthread-2.0 is required to compile QEMU. Did you also encounter this error? Do you know how to fix it? Greetings and thank you very much.

tux-linux commented 10 months ago

Maybe you could try installing the glib Homebrew package?

tux-linux commented 10 months ago

Also, I think I used clang (llvm) on my side for compiling QEMU; maybe that could make a difference

MaximilianCarver commented 10 months ago

Hello, @tux-linux: I already have GLib installed. I've tried reinstalling it, and it gives the same error. Regarding using LLVM, I'll try that now. Thank you very much.

MaximilianCarver commented 10 months ago

Hello again, @tux-linux , I tried using LLVM (setting in my zshrc this: export PATH=$PATH:/opt/homebrew/opt/llvm/bin/clang), but I'm still getting the GLib error. My version of GLib is 2.78.3. Any idea what might be going on? Thanks.

tux-linux commented 10 months ago

When you run cc, does it launch clang?

MaximilianCarver commented 10 months ago

Yes, when I run 'cc' in the terminal, clang (with llvm) is executed.

clang: error: no input files
tux-linux commented 10 months ago

Sorry, I don't have a clue, then

florian-obradovic commented 10 months ago
brew install openssl@3.0

../configure --enable-sdl --disable-cocoa --target-list=arm-softmmu --disable-capstone --disable-pie --disable-slirp --extra-cflags=-I/opt/homebrew/opt/openssl@3.0/include --extra-ldflags='-L/opt/homebrew/opt/openssl@3.0/lib -lcrypto'
MaximilianCarver commented 10 months ago

Hello, floral-obradovic, I just tried what you've provided, and I'm getting this error: ERROR: glib-2.56 gthread-2.0 is required to compile QEMU Any ideas on how to solve this? Thank you very much

florian-obradovic commented 9 months ago

I think this should help brew install glib (gthread comes with Glib). CleanShot 2024-01-28 at 22 40 13@2x

MaximilianCarver commented 9 months ago

Hello, I already had glib installed when the error occurred. I have reinstalled it, and the same issue persists. Any ideas? Thanks

florian-obradovic commented 9 months ago

hm.. no, sorry... I can only show you a list of my installed apps on the test Mac with macOS Sonoma 14.3:

brew list
==> Formulae
aom             gnuplot             libheif             lua             rubberband
aribb24             gnutls              libidn              lua@5.3             sdl2
assimp              go              libidn2             lz4             shared-mime-info
at-spi2-core            gobject-introspection       libiscsi            lzo             snappy
atk             graphene            liblinear           m4              speedtest-cli
autoconf            graphite2           liblqr              mbedtls             speex
automake            grep                libmicrohttpd           md4c                spice-gtk
azure-cli           gsettings-desktop-schemas   libmng              monolith            spice-protocol
bash                gst-libav           libnghttp2          mpdecimal           sqlite
bdw-gc              gst-plugins-bad         libnice             mpg123              srt
borgbackup-fuse         gst-plugins-base        libogg              mtr             srtp
bpytop              gst-plugins-good        libomp              musepack            subfinder
broot               gst-plugins-ugly        libpcap             ncdu                svt-av1
brotli              gstreamer           libpng              ncurses             taglib
c-ares              gtk+3               libpsl              netperf-enable-demo     tcpdump
ca-certificates         gtk4                libpthread-stubs        nettle              telnet
cairo               guile               libraw              ninja               tesseract
capstone            harfbuzz            libreplaygain           nmap                theora
cjson               hicolor-icon-theme      librist             node@16             tmux
cmake               highway             librsvg             nuclei              tree
concurrencykit          htop                libsamplerate           oniguruma           ucl
cunit               hunspell            libshout            opencore-amr            unbound
dav1d               icu4c               libslirp            openexr             unshield
dbus                iftop               libsndfile          openjpeg            upx
dnsperf             imath               libsodium           openssh             usbredir
docbook             iperf               libsoup             openssl@1.1         utf8proc
docbook-xsl         iperf3              libsoxr             openssl@3           vde
double-conversion       jansson             libssh              opus                wakeonlan
dtc             jasper              libssh2             orc             watch
faac                jbig2dec            libtasn1            osx-cpu-temp            webp
faad2               jpeg-turbo          libtiff             p11-kit             wget
fdk-aac             jpeg-xl             libtool             pango               wimlib
ffmpeg              jq              libunibreak         parallel            wireguard-go
fio             json-glib           libunistring            pcre                wireguard-tools
flac                lame                libusb              pcre2               x264
fontconfig          ldns                libusrsctp          pixman              x265
fping               leptonica           libuv               pkg-config          xmlto
freetype            libarchive          libvidstab          py3cairo            xorgproto
frei0r              libass              libvirt             pygobject3          xvid
fribidi             libavif             libvmaf             python-packaging        xxhash
fzf             libb2               libvorbis           python-pyparsing        xz
gd              libbluray           libvpx              python-setuptools       yajl
gdbm                libcbor             libx11              python@3.10         yarn
gdk-pixbuf          libcerf             libxau              python@3.11         zeromq
gettext             libcuefile          libxcb              python@3.12         zimg
ghostscript         libde265            libxdmcp            python@3.9          zola
giflib              libepoxy            libxext             qemu                zsh-autosuggestions
glib                libevent            libxfixes           qt              zsh-syntax-highlighting
glib-networking         libffi              libxi               qt@5                zstd
gmp             libfido2            libxrender          rav1e
gnu-getopt          libgcrypt           libxtst             readline
gnu-sed             libgpg-error            little-cms2         rtmpdump