From 2684ef94e3ef2761d643c3a1c58effcd8be3a163 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Sat, 26 Oct 2024 18:10:44 +0300 Subject: [PATCH] ci: test -os linux cross compilation on macOS --- .github/workflows/macos_ci.yml | 4 ++++ ROADMAP.md | 3 ++- vlib/picoev/loop_linux.c.v | 1 + vlib/v/builder/cc.v | 4 ++-- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/macos_ci.yml b/.github/workflows/macos_ci.yml index c67e669d1b..b823836751 100644 --- a/.github/workflows/macos_ci.yml +++ b/.github/workflows/macos_ci.yml @@ -98,3 +98,7 @@ jobs: run: v test examples/readline/ - name: Test vlib modules with -skip-unused run: v -skip-unused test vlib/builtin/ vlib/math vlib/flag/ vlib/os/ vlib/strconv/ + - name: Test cross compilation to Linux + run: | + v -d use_openssl -cc clang -showcc -gc none -o hi -os linux examples/hello_world.v + v -d use_openssl -cc clang -showcc -gc none -o hi -os linux examples/veb/veb_example.v diff --git a/ROADMAP.md b/ROADMAP.md index 3c57a345bf..29dc957c98 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -43,13 +43,14 @@ For a list of all features and fixes, check out the changelog. - [x] Lambdas: `a.sort(|a, b| a > b)` - [ ] Custom attributes - [ ] Contexts that are passed implicitly (e.g. for custom allocation/memory management) +- [ ] Direct C/C++ interop without generating wrappers ## [Version 0.6] - [ ] Integrate the new parallel parser/checker/cgen - [ ] Incremental compilation +- [ ] Runtime race detector - [ ] [Thread safe maps](https://github.com/vlang/v/discussions/11729) -- [ ] Direct C/C++ interop without generating wrappers - [ ] `recover()` from panics - [ ] -usecache on by default - [ ] -skip-unused on by default diff --git a/vlib/picoev/loop_linux.c.v b/vlib/picoev/loop_linux.c.v index e8b9a6363b..c21c3bae8b 100644 --- a/vlib/picoev/loop_linux.c.v +++ b/vlib/picoev/loop_linux.c.v @@ -1,6 +1,7 @@ module picoev #include +#include // needed for cross compiling to linux fn C.epoll_create(int) int fn C.epoll_wait(int, voidptr, int, int) int diff --git a/vlib/v/builder/cc.v b/vlib/v/builder/cc.v index 83b89ac4d0..088019da2e 100644 --- a/vlib/v/builder/cc.v +++ b/vlib/v/builder/cc.v @@ -848,7 +848,7 @@ fn (mut b Builder) cc_linux_cross() { obj_file := b.out_name_c + '.o' cflags := b.get_os_cflags() defines, others, libs := cflags.defines_others_libs() - mut cc_args := []string{} + mut cc_args := []string{cap: 20} cc_args << '-w' cc_args << '-fPIC' cc_args << '-c' @@ -916,7 +916,7 @@ fn (mut b Builder) cc_freebsd_cross() { obj_file := b.out_name_c + '.o' cflags := b.get_os_cflags() defines, others, libs := cflags.defines_others_libs() - mut cc_args := []string{} + mut cc_args := []string{cap: 20} cc_args << '-w' cc_args << '-fPIC' cc_args << '-c'