Compile qemu

最後更新: 2017-05-31

介紹

 


OS: Cetnos 6

 

Required additional packages

    yum install git

    yum install glib2-devel libfdt-devel libaio-devel libcap-devel libiscsi-devel zlib-devel pixman-devel

    yum groupinstall "Development Tools"

Get Source

cd /usr/src

git clone git://git.qemu-project.org/qemu.git                        # ~ 191M

cd qemu

git branch -a | grep stable-2

git checkout stable-2.8

Configure

--target-list=LIST       set target list (default: build everything)

x86_64-softmmu ..             # x86_64-linux-use

xxx-softmmu                      # will compile qemu-system-xxx

xxx-linux-user compiles qemu-xxx (User-mode emulation)

QEMU runs single Linux or Darwin/macOS programs that were compiled for a different instruction set.
System calls are thunked for endianness and for 32/64 bit mismatches.

--static                 enable static build [no]

Build

# Configure QEMU for x86_64 only - faster build

./configure --target-list=x86_64-softmmu --static

# Build in parallel (nproc)

make -j2

 


U14 static build

 

 * 最後都 build 唔到

apt-get install git libglib2.0-dev libfdt-dev libpixman-1-dev zlib1g-dev

Script

./configure --target-list=x86_64-softmmu \
 --disable-xen \
 --disable-spice \
 --disable-guest-agent \
 --disable-docs \
 --static

--static

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

config.log

/usr/bin/ld: cannot find -lc
collect2: ld returned 1 exit status

The linker cannot find the C libraries required for statically linking your library.

yum install glibc-static libtool

You can try and see if libc.a already exists on your system by calling

find /usr -name libc.a

============

ERROR: zlib check failed
       Make sure to have the zlib libs and headers installed.

yum install zlib-static

============

ERROR: sizeof(size_t) doesn't match GLIB_SIZEOF_SIZE_T.
       You probably need to set PKG_CONFIG_LIBDIR
       to point to the right pkg-config files for your
       build target

export PKG_CONFIG_LIBDIR=/usr/bin/pkg-config

============

ERROR: glib-2.22 gthread-2.0 is required to compile QEMU