nutanix / libvfio-user

framework for emulating devices in userspace
BSD 3-Clause "New" or "Revised" License
166 stars 51 forks source link

Compilation error on Fedora 30 OS #21

Closed changpe1 closed 4 years ago

changpe1 commented 4 years ago

Error information: [ 8%] Building C object lib/CMakeFiles/muser.dir/libmuser_pci.c.o /home/changpe1/libmuser/lib/libmuser_pci.c: In function ‘muser_pci_hdr_write_bar’: /home/changpe1/libmuser/lib/libmuser_pci.c:61:24: error: taking address of packed member of ‘union ’ may result in an unaligned pointer value [-Werror=address-of-packed-member] 61 | bar = (uint32_t *) & lm_get_pci_config_space(lm_ctx)->hdr.bars[bar_index]; | ^~~~~~~~~~~~~~ cc1: all warnings being treated as errors make[3]: [lib/CMakeFiles/muser.dir/build.make:89: lib/CMakeFiles/muser.dir/libmuser_pci.c.o] Error 1 make[2]: [CMakeFiles/Makefile2:91: lib/CMakeFiles/muser.dir/all] Error 2

Version: commit 380f37d5713 OS: Fedora 30 Gcc:Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/9/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none OFFLOAD_TARGET_DEFAULT=1 Target: x86_64-redhat-linux Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,objc,obj-c++,ada,go,d,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux Thread model: posix gcc version 9.1.1 20190503 (Red Hat 9.1.1-1) (GCC)

tmakatos commented 4 years ago

BAR0 is at offset 0x10, so it's properly aligned, therefore there's no problem in this case. I'll fix it to avoid the warning though.

tmakatos commented 4 years ago

@changpe1 could check whether https://github.com/nutanix/muser/pull/24 solves your problem? I've only checked that it compiles, haven't tested it yet.

changpe1 commented 4 years ago

@tmakatos The issue is fixed with your patch.