Last active
          May 13, 2022 04:33 
        
      - 
      
 - 
        
Save anjannath/cea4dab84e375a57364bf55df9ba9a15 to your computer and use it in GitHub Desktop.  
    Instructions for building qemu on macOS
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | install the dependencies as seen on the brew formulae here: https://github.com/Homebrew/homebrew-core/blob/master/Formula/qemu.rb | |
| export LIBRARY_PATH=/tmp/anjan/libs | |
| export CPATH=/tmp/anjan/libs | |
| LDFLAGS=-L/tmp/anjan/libs/lib | |
| CPPFLAGS=-I/tmp/anjan/libs/include | |
| ./configure | |
| make install | |
| ## Cp out the shared library objects the qemu binary is linked to | |
| otool -L /tmp/anjan/qemu/bin/qemu-system-x86_64 | grep homebrew | awk '{print $1}' | xargs -t -I % cp % /tmp/anjan/qemu/libs/ | |
| ## Change the path of the dylibs in the qemu-system-* binary | |
| otool -L /tmp/anjan/qemu/bin/qemu-system-x86_64 | grep homebrew | awk '{print $1}' | xargs -t -I % sh -c 'install_name_tool -change % /tmp/anjan/qemu/libs/$(basename %) /tmp/anjan/qemu/bin/qemu-system-x86_64' | |
| ## Build gettext | |
| $ ./configure --disable-dependency-tracking --disable-silent-rules --disable-debug --prefix=/tmp/anjan/libs --with-included-glib --with-included-libcroco --with-included-libunistring --with-included-libxml --with-emacs --with-lispdir=/tmp/anjan/libs/share/emacs/site-lisp/gettext --disable-java --disable-csharp --without-git --without-cvs --without-xz --with-included-gettext | |
| ## Build libffi | |
| $ ./configure --disable-debug --disable-dependency-tracking --prefix=/tmp/anjan/libs --libdir=/tmp/anjan/libs/lib | |
| $ make install | |
| ## Build PCRE | |
| ## "--enable-jit" if MacOS.version >= :sierra && !Hardware::CPU.arm? | |
| $ ./configure --disable-dependency-tracking --enable-utf8 --enable-pcre8 --enable-pcre16 --enable-pcre32 --enable-unicode-properties --enable-pcregrep-libz --enable-pcregrep-libbz2 --prefix=/tmp/anjan/libs | |
| $ make; make test; make install | |
| ## Build glib (https://raw.githubusercontent.com/Homebrew/formula-patches/43467fd8dfc0e8954892ecc08fab131242dca025/glib/hardcoded-paths.diff) | |
| $ mkdir build; cd build | |
| $ meson --prefix=/tmp/anjan/libs --libdir=/tmp/anjan/libs/lib --buildtype=release --wrap-mode=nofallback --default-library=both --localstatedir=/var -Diconv=auto -Dgio_module_dir=/tmp/anjan/libs/lib/gio/modules -Dbsymbolic_functions=false -Ddtrace=false .. | |
| $ ninja -v | |
| $ ninja install -v | |
| $ #need to rewrite some python #! inside /tmp/anjan/libs/bin/(file *) | |
| ## Build jpeg | |
| $ ./configure --disable-dependency-tracking --disable-silent-rules --prefix=/tmp/anjan/libs | |
| $ make install | |
| ## Build libpng | |
| $ ./configure --disable-dependency-tracking --disable-silent-rules --prefix=/tmp/anjan/libs | |
| $ make; make test; make install | |
| ## Build libslirp (still linking to glib from homebrew, see pkg-config modifications needed | |
| ## std_meson_args = --prefix=/tmp/anjan/libs --libdir=/tmp/anjan/libs/lib --buildtype=release --wrap-mode=nofallback | |
| $ meson build -Ddefault_library=both --prefix=/tmp/anjan/libs --libdir=/tmp/anjan/libs/lib --buildtype=release --wrap-mode=nofallback | |
| $ ninja -C build install all | |
| ## Build libusb | |
| $ ./configure --disable-dependency-tracking --prefix=/tmp/anjan/libs | |
| $ make install | |
| ## Build lzo | |
| $ ./configure --disable-dependency-tracking --prefix=/tmp/anjan/libs --enable-shared | |
| $ make; make check; make install | |
| ## Build gmp (https://github.com/Homebrew/homebrew-core/blob/master/Formula/gmp.rb) (depends on kernel major version) | |
| ## std_configure_args = --disable-debug --disable-dependency-tracking --prefix=/tmp/anjan/libs --libdir=/tmp/anjan/libs/lib | |
| $ ./configure --prefix=/tmp/anjan/libs --libdir=/tmp/anjan/libs/lib --enable-cxx --with-pic --build=aarch64-apple-darwin21 | |
| $ make; make check; make install | |
| ## Build nettle | |
| $ ./configure --build=aarch64-apple-darwin21 --disable-dependency-tracking --prefix=/tmp/anjan/libs --enable-shared | |
| $ make; make check; make install | |
| ## Build pixman | |
| $ wget --content-disposition https://cairographics.org/releases/pixman-0.40.0.tar.gz | |
| $ ./configure --disable-dependency-tracking --disable-gtk --disable-silent-rules --prefix=/tmp/anjan/libs | |
| $ make install | |
| ## Build snappy (cmake) | |
| ## cmake std args = -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=/tmp/anjan/libs -DCMAKE_INSTALL_LIBDIR=/tmp/anjan/libs/lib -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILE=ON -Wno-dev -DBUILD_TESTING=OFF | |
| $ wget https://github.com/google/snappy/archive/1.1.9.tar.gz | |
| $ cmake . -DSNAPPY_BUILD_TESTS=OFF -DSNAPPY_BUILD_BENCHMARKS=OFF -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=/tmp/anjan/libs -DCMAKE_INSTALL_LIBDIR=/tmp/anjan/libs/lib -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILE=ON -Wno-dev -DBUILD_TESTING=OFF | |
| $ make install | |
| ## Build vde | |
| ## sourceforge download | |
| $ ./configure --prefix=/tmp/anjan/libs/ --disable-python | |
| $ make install | |
| ## gnutls | |
| $ ./configure --disable-dependency-tracking --disable-silent-rules --prefix=/tmp/anjan/libs --sysconfdir=/tmp/anjan/libs/etc --with-default-trust-store-file=/opt/homebrew/Cellar/ca-certificates/2022-04-26/share/ca-certificates/cacert.pem --disable-heartbeat-support --with-p11-kit --with-included-unistring | |
| === tough nuts === | |
| ## Build libssh | |
| ## Build libncurses | |
      
      
  Author
  
  
      
          
      
      
            anjannath
  
      
      
      commented 
        May 13, 2022 
      
    
  
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment