builtin: fix `-cc gcc -gc boehm` on linux and macos (#14115)

lemon 2022-04-21 06:12:17 +09:00 committed by Jef Roosens
parent 47ae5a93d4
commit 262ec40851
Signed by: Jef Roosens
GPG Key ID: B75D4F293C7052DB
2 changed files with 14 additions and 1 deletions

View File

@ -81,6 +81,18 @@ fn get_all_commands() []Command {
runcmd: .execute runcmd: .execute
expect: 'Hello, World!\n' expect: 'Hello, World!\n'
} }
if os.getenv('V_CI_MUSL').len == 0 {
for compiler_name in ['clang', 'gcc'] {
if _ := os.find_abs_path_of_executable(compiler_name) {
res << Command{
line: '$vexe -cc $compiler_name -gc boehm run examples/hello_world.v'
okmsg: '`v -cc $compiler_name -gc boehm run examples/hello_world.v` works'
runcmd: .execute
expect: 'Hello, World!\n'
}
}
}
}
res << Command{ res << Command{
line: '$vexe interpret examples/hello_world.v' line: '$vexe interpret examples/hello_world.v'
okmsg: 'V can interpret hello world.' okmsg: 'V can interpret hello world.'

View File

@ -32,13 +32,14 @@ $if dynamic_boehm ? {
$if macos || linux { $if macos || linux {
#flag -DGC_PTHREADS=1 #flag -DGC_PTHREADS=1
#flag -I@VEXEROOT/thirdparty/libgc/include #flag -I@VEXEROOT/thirdparty/libgc/include
#flag -lpthread -ldl #flag -lpthread
$if (prod && !tinyc && !debug) || !(amd64 || arm64 || i386 || arm32) { $if (prod && !tinyc && !debug) || !(amd64 || arm64 || i386 || arm32) {
// TODO: replace the architecture check with a `!$exists("@VEXEROOT/thirdparty/tcc/lib/libgc.a")` comptime call // TODO: replace the architecture check with a `!$exists("@VEXEROOT/thirdparty/tcc/lib/libgc.a")` comptime call
#flag @VEXEROOT/thirdparty/libgc/gc.o #flag @VEXEROOT/thirdparty/libgc/gc.o
} $else { } $else {
#flag @VEXEROOT/thirdparty/tcc/lib/libgc.a #flag @VEXEROOT/thirdparty/tcc/lib/libgc.a
} }
#flag -ldl
} $else $if freebsd { } $else $if freebsd {
// Tested on FreeBSD 13.0-RELEASE-p3, with clang, gcc and tcc: // Tested on FreeBSD 13.0-RELEASE-p3, with clang, gcc and tcc:
#flag -DBUS_PAGE_FAULT=T_PAGEFLT #flag -DBUS_PAGE_FAULT=T_PAGEFLT