moby / hyperkit

A toolkit for embedding hypervisor capabilities in your application
BSD 2-Clause "Simplified" License
3.61k stars 327 forks source link

Build error message show 'set but not used [-Werror,-Wunused-but-set-variable]' in clang version 1316.0.21.2.5 #332

Open rheno opened 2 years ago

rheno commented 2 years ago
   cc src/lib/vmm/vmm.c
src/lib/vmm/vmm.c:846:14: error: variable 'wmesg' set but not used [-Werror,-Wunused-but-set-variable]
        const char *wmesg;
                    ^
src/lib/vmm/vmm.c:1012:9: error: variable 'done' set but not used [-Werror,-Wunused-but-set-variable]
        int i, done;
               ^
2 errors generated.
make: [build/lib/vmm/vmm.o] Error 1 (ignored)
cc src/lib/vmm/vmm_instruction_emul.c
src/lib/vmm/vmm_instruction_emul.c:1656:8: error: variable 'cookie' set but not used [-Werror,-Wunused-but-set-variable]
        void *cookie;
              ^
src/lib/vmm/vmm_instruction_emul.c:1653:8: error: variable 'retries' set but not used [-Werror,-Wunused-but-set-variable]
        u_int retries;
              ^
2 errors generated.
make: [build/lib/vmm/vmm_instruction_emul.o] Error 1 (ignored)
cc src/lib/vmm/x86.c
src/lib/vmm/x86.c:72:34: error: variable 'amd_feature2' set but not used [-Werror,-Wunused-but-set-variable]
        u_int cpu_feature, amd_feature, amd_feature2, cpu_high, cpu_exthigh;
                                        ^
src/lib/vmm/x86.c:72:21: error: variable 'amd_feature' set but not used [-Werror,-Wunused-but-set-variable]
        u_int cpu_feature, amd_feature, amd_feature2, cpu_high, cpu_exthigh;
                           ^
2 errors generated.
make: [build/lib/vmm/x86.o] Error 1 (ignored)
cc src/lib/acpitbl.c
cc src/lib/atkbdc.c
cc src/lib/block_if.c
cc src/lib/consport.c
cc src/lib/dbgport.c
cc src/lib/fwctl.c
cc src/lib/inout.c
cc src/lib/ioapic.c
cc src/lib/log.c
cc src/lib/md5c.c
cc src/lib/mem.c
cc src/lib/mevent.c
cc src/lib/mptbl.c
cc src/lib/pci_ahci.c
src/lib/pci_ahci.c:1277:11: error: variable 'start_track' set but not used [-Werror,-Wunused-but-set-variable]
                uint8_t start_track, *bp, buf[50];
                        ^
src/lib/pci_ahci.c:1388:25: error: variable 'sc' set but not used [-Werror,-Wunused-but-set-variable]
        struct pci_ahci_softc *sc;
                               ^
src/lib/pci_ahci.c:1801:6: error: variable 'cfl' set but not used [-Werror,-Wunused-but-set-variable]
        int cfl;
            ^
src/lib/pci_ahci.c:1799:25: error: variable 'sc' set but not used [-Werror,-Wunused-but-set-variable]
        struct pci_ahci_softc *sc;
                               ^
src/lib/pci_ahci.c:1798:26: error: variable 'prdt' set but not used [-Werror,-Wunused-but-set-variable]
        struct ahci_prdt_entry *prdt;
                                ^
5 errors generated.
make: [build/lib/pci_ahci.o] Error 1 (ignored)
cc src/lib/pci_emul.c
src/lib/pci_emul.c:857:11: error: variable 'table_bar' set but not used [-Werror,-Wunused-but-set-variable]
        int off, table_bar;
                 ^
1 error generated.
make: [build/lib/pci_emul.o] Error 1 (ignored)
cc src/lib/pci_hostbridge.c
cc src/lib/pci_irq.c
cc src/lib/pci_lpc.c
cc src/lib/pci_uart.c
cc src/lib/pci_virtio_9p.c
src/lib/pci_virtio_9p.c:163:15: error: variable 'freevec' set but not used [-Werror,-Wunused-but-set-variable]
        int nvec, i, freevec;
                     ^
1 error generated.
make: [build/lib/pci_virtio_9p.o] Error 1 (ignored)
cc src/lib/pci_virtio_block.c
cc src/lib/pci_virtio_net_tap.c
cc src/lib/pci_virtio_net_vmnet.c
cc src/lib/pci_virtio_net_vpnkit.c
src/lib/pci_virtio_net_vpnkit.c:1036:6: error: variable 'mac_provided' set but not used [-Werror,-Wunused-but-set-variable]
        int mac_provided;
            ^
1 error generated.
make: [build/lib/pci_virtio_net_vpnkit.o] Error 1 (ignored)
cc src/lib/pci_virtio_rnd.c
cc src/lib/pci_virtio_sock.c
cc src/lib/pm.c
cc src/lib/post.c
cc src/lib/rtc.c
cc src/lib/smbiostbl.c
cc src/lib/task_switch.c
cc src/lib/uart_emul.c
cc src/lib/virtio.c
cc src/lib/xmsr.c
cc src/lib/firmware/bootrom.c
cc src/lib/firmware/kexec.c
cc src/lib/firmware/fbsd.c
cc src/lib/firmware/multiboot.c
cc src/hyperkit.c
src/hyperkit.c:336:28: error: variable 'string' set but not used [-Werror,-Wunused-but-set-variable]
        int bytes, port, in, out, string;
                                  ^
src/hyperkit.c:607:17: error: variable 'prevcpu' set but not used [-Werror,-Wunused-but-set-variable]
        int error, rc, prevcpu;
                       ^
src/hyperkit.c:855:6: error: variable 'dump_guest_memory' set but not used [-Werror,-Wunused-but-set-variable]
        int dump_guest_memory, max_vcpus, mptgen;
            ^
3 errors generated.
make: [build/hyperkit.o] Error 1 (ignored)
cat Info.plist.in | sed "s/%VERSION%/v0.20210107-16-g3cb0d54/" > Info.plist
ld hyperkit.sym
clang: error: no such file or directory: 'build/lib/vmm/vmm.o'
clang: error: no such file or directory: 'build/lib/vmm/vmm_instruction_emul.o'
clang: error: no such file or directory: 'build/lib/vmm/x86.o'
clang: error: no such file or directory: 'build/lib/pci_ahci.o'
clang: error: no such file or directory: 'build/lib/pci_emul.o'
clang: error: no such file or directory: 'build/lib/pci_virtio_9p.o'
clang: error: no such file or directory: 'build/lib/pci_virtio_net_vpnkit.o'
clang: error: no such file or directory: 'build/hyperkit.o'
make: [build/hyperkit.sym] Error 1 (ignored)
dsym hyperkit.dSYM
error: cannot parse the debug map for 'build/hyperkit.sym': No such file or directory
make: [build/hyperkit.sym] Error 1 (ignored)
strip hyperkit
error: /Library/Developer/CommandLineTools/usr/bin/strip: can't open file: build/hyperkit.sym (No such file or directory)
make: [build/hyperkit] Error 1 (ignored)
sign hyperkit
build/hyperkit: No such file or directory
make: [build/hyperkit] Error 1 (ignored) 
pthoelken commented 2 years ago

I have the same errors while building on my macOS (Silicon) ... also brew install hyperkit does not work! Is Silicon Mac supported in hyperkit latest release?

faddah commented 2 years ago

i am seeing this error also, Apple Silicon M1 Chip in a 2020 MacBook Air, 16 GB RAM, Mac OS Monterey v12.5. is anything being done on PR #335 to update this to handle Apple Silicon chips in the compile?

% git clone https://github.com/moby/hyperkit
Cloning into 'hyperkit'...
remote: Enumerating objects: 3891, done.
remote: Counting objects: 100% (62/62), done.
remote: Compressing objects: 100% (34/34), done.
remote: Total 3891 (delta 28), reused 48 (delta 27), pack-reused 3829
Receiving objects: 100% (3891/3891), 12.81 MiB | 526.00 KiB/s, done.
Resolving deltas: 100% (2022/2022), done.
% cd hyperkit 
% make
gen src/lib/dtrace.d
cc src/lib/vmm/intel/vmcs.c
cc src/lib/vmm/intel/vmx.c
cc src/lib/vmm/intel/vmx_msr.c
cc src/lib/vmm/io/vatpic.c
cc src/lib/vmm/io/vatpit.c
cc src/lib/vmm/io/vhpet.c
cc src/lib/vmm/io/vioapic.c
cc src/lib/vmm/io/vlapic.c
cc src/lib/vmm/io/vpmtmr.c
cc src/lib/vmm/io/vrtc.c
cc src/lib/vmm/vmm.c
src/lib/vmm/vmm.c:846:14: error: variable 'wmesg' set but not used [-Werror,-Wunused-but-set-variable]
        const char *wmesg;
                    ^
src/lib/vmm/vmm.c:1012:9: error: variable 'done' set but not used [-Werror,-Wunused-but-set-variable]
        int i, done;
               ^
2 errors generated.
make: *** [build/lib/vmm/vmm.o] Error 1
faddah@FaddahsoakinAir hyperkit % arch -arm64 make
cc src/lib/vmm/vmm.c
src/lib/vmm/vmm.c:846:14: error: variable 'wmesg' set but not used [-Werror,-Wunused-but-set-variable]
        const char *wmesg;
                    ^
src/lib/vmm/vmm.c:1012:9: error: variable 'done' set but not used [-Werror,-Wunused-but-set-variable]
        int i, done;
               ^
2 errors generated.
make: *** [build/lib/vmm/vmm.o] Error 1
mohd-akram commented 1 year ago

Run make CFLAGS_WARN=.

lamb commented 1 year ago

use make CFLAGS_WARN=-Wunused-but-set-variable