Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't compile on Apple Silicon #303

Closed
sylvainfilteau opened this issue Nov 19, 2020 · 5 comments
Closed

Doesn't compile on Apple Silicon #303

sylvainfilteau opened this issue Nov 19, 2020 · 5 comments

Comments

@sylvainfilteau
Copy link

sylvainfilteau commented Nov 19, 2020

Followed instructions in README.md, don't know how to go further than that.

Tested on MacBookAir10,1 with M1.

% git clone https://github.com/moby/hyperkit
Cloning into 'hyperkit'...
remote: Enumerating objects: 3761, done.
remote: Total 3761 (delta 0), reused 0 (delta 0), pack-reused 3761
Receiving objects: 100% (3761/3761), 12.72 MiB | 19.19 MiB/s, done.
Resolving deltas: 100% (1950/1950), done.
% cd hyperkit
% make
gen src/lib/dtrace.d
cc src/lib/vmm/intel/vmcs.c
error: include location '/usr/local/include' is unsafe for cross-compilation [-Werror,-Wpoison-system-directories]
1 error generated.
make: *** [build/lib/vmm/intel/vmcs.o] Error 1
@chadbrewbaker
Copy link

I know homebrew is using /opt/homebrew. Perhaps do /opt/hyperkit ?

@chadbrewbaker
Copy link

chadbrewbaker commented Nov 19, 2020

See machyve/xhyve#206 . You get that error when building with make instead of xcodebuild.

Issue is probably best categorized hyperkit is waiting on macOS aarch64 support in xhyve.

@Code-Hex
Copy link

Code-Hex commented Dec 4, 2020

I could compile this but architecture is x86_64.

  1. brew install llvm and use that's clang (version 11.0.0)
  2. apply this patch
  3. make
diff --git a/Makefile b/Makefile
index 474e48b..d06ec05 100644
--- a/Makefile
+++ b/Makefile
@@ -83,7 +83,7 @@ HAVE_OCAML_QCOW := $(shell if ocamlfind query qcow prometheus-app uri logs logs.
 ifeq ($(HAVE_OCAML_QCOW),YES)
 CFLAGS += -DHAVE_OCAML=1 -DHAVE_OCAML_QCOW=1 -DHAVE_OCAML=1
 
-LIBEV_FILE=/usr/local/lib/libev.a
+LIBEV_FILE=/opt/homebrew/lib/libev.a
 LIBEV=$(shell if test -e $(LIBEV_FILE) ; then echo $(LIBEV_FILE) ; fi )
 
 # prefix vsock file names if PRI_ADDR_PREFIX
@@ -92,8 +92,8 @@ ifneq ($(PRI_ADDR_PREFIX),)
 CFLAGS += -DPRI_ADDR_PREFIX=\"$(PRI_ADDR_PREFIX)\"
 endif
 
-# override default connect socket name if 
-# CONNECT_SOCKET_NAME is defined 
+# override default connect socket name if
+# CONNECT_SOCKET_NAME is defined
 ifneq ($(CONNECT_SOCKET_NAME),)
 CFLAGS += -DCONNECT_SOCKET_NAME=\"$(CONNECT_SOCKET_NAME)\"
 endif
diff --git a/config.mk b/config.mk
index 8b99ff1..5a3b257 100644
--- a/config.mk
+++ b/config.mk
@@ -45,7 +45,9 @@ CFLAGS_WARN := \
   -Wno-reserved-id-macro \
   -Wno-unknown-warning-option \
   -Wno-unused-macros \
-  -Wno-switch-enum
+  -Wno-switch-enum \
+  -Wno-extra-semi-stmt \
+  -Wno-implicit-fallthrough
 
 CFLAGS_DIAG := \
   -fmessage-length=152 \
diff --git a/src/lib/block_if.c b/src/lib/block_if.c
index 3b743c3..d952c69 100644
--- a/src/lib/block_if.c
+++ b/src/lib/block_if.c
@@ -136,29 +136,6 @@ struct blockif_sig_elem {
 
 static struct blockif_sig_elem *blockif_bse_head;
 
-
-static ssize_t
-preadv(int fd, const struct iovec *iov, int iovcnt, off_t offset)
-{
-	off_t res;
-
-	res = lseek(fd, offset, SEEK_SET);
-	assert(res == offset);
-	return (readv(fd, iov, iovcnt));
-}
-
-
-static ssize_t
-pwritev(int fd, const struct iovec *iov, int iovcnt, off_t offset)
-{
-	off_t res;
-
-	res = lseek(fd, offset, SEEK_SET);
-	assert(res == offset);
-	return (writev(fd, iov, iovcnt));
-}
-
-
 static inline size_t iovec_len(const struct iovec *iov, int iovcnt)
 {
 	size_t len = 0;

@nikolasrieble
Copy link

I could compile on the M1 without any patch. Thus I think this issue can be closed.
Also see #310 for a follow up issue.

@rn
Copy link
Member

rn commented Jul 6, 2021

It won't work though. all of the low level code in hyperkit is x86 specific. I'm not aware of porting any of the code to work on M1 so closing for now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants