Open MatejMagat305 opened 1 year ago
What error message is shown? Can you write a short reproducible case?
What error message is shown? Can you write a short reproducible case?
och sorry, it is not exciplit enough ..., this is error on termux from vab:
vab compiling didn't succeed.
vab.android.CompileError: failed to compile .c to .o:
vab.android.compile_v_imports_c_dependencies: getting NDK sysroot path.
vab.android.ndk.sysroot_path couldn't locate sysroot at
/data/data/com.termux/files/home/android-ndk-r23c/toolchains/llvm/prebuilt//sysroot
I notice that after prebuilt/
and before /sysroot
is empty space, which is related contrete funkcion ..., and how to reproduce?
so install termux and vlang on termux and try compile:
module main
pub fn host_arch() string {
$if linux {
return 'linux-x86_64'
} $else $if macos {
return 'darwin-x86_64'
} $else $if windows {
return 'windows-x86_64'
} $else $if termux {
return 'linux-aarch64'
} $else {
return 'unknown'
}
}
fn main(){
println(host_arch())
}
and see print empty line
That's really strange... even if none of the $if
s match, it should return unknown
, not ''
.
That's really strange... even if none of the
$if
s match, it should returnunknown
, not''
.
it is litle bit similar to #17038, but this is more evident ... .
Therefore it is strange I put there like error ...
With -o .c
it produce:
VV_LOCAL_SYMBOL string main__host_arch(void) {
#if defined(__linux__)
{
}
#elif defined(__APPLE__)
{
}
#elif defined(_WIN32)
{
}
#elif defined(__TERMUX__)
{
string _t2 = _SLIT("linux-aarch64");
return _t2;
}
#else
{
}
#endif
return (string){.str=(byteptr)"", .is_lit=1};
}
has clang __termux__
?
but it is weird before I was compile right way at making video ...
Try changing the code to:
$if termux {
return 'linux-aarch64'
} $else $if linux {
return 'linux-x86_64'
} $else $if macos {
return 'darwin-x86_64'
} $else $if windows {
return 'windows-x86_64'
} $else {
return 'unknown'
}
Try changing the code to:
$if termux { return 'linux-aarch64' } $else $if linux { return 'linux-x86_64' } $else $if macos { return 'darwin-x86_64' } $else $if windows { return 'windows-x86_64' } $else { return 'unknown' }
Yes, it is working on termux, but will it working on other or is termux sometime go tu linux branch?
When I try this:
pub fn host_arch() string {
$if linux {
return 'linux-x86_64'
}
$if macos {
return 'darwin-x86_64'
}
$if windows {
return 'windows-x86_64'
}
$if termux {
return 'linux-aarch64'
}
return 'unknown'
}```
It is working too
I wonder if this is why I initially used the runtime os.user_os() instead, note how it's similarly structured without the use of $else
🤔
Describe the bug
vab compiling didn't succeed. vab.android.CompileError: failed to compile .c to .o: vab.android.compile_v_imports_c_dependencies: getting NDK sysroot path. vab.android.ndk.sysroot_path couldn't locate sysroot at
/data/data/com.termux/files/home/android-ndk-r23c/toolchains/llvm/prebuilt//sysroot
Before sysroot is empty space, there would belinux-aarch64
It caused by function host_arch(), which should return string in sysroot_path()
Expected Behavior
Funtion return one of string
Current Behavior
Return empty string
Reproduction Steps
Well I don't know whether is meaningfull to termux, but probably it is problem of whole vabbelow in commentPossible Solution
Additional Information/Context
It is posibly related with #17258, because after this was crash, but this PR was passed all test, so I don t know ..., so probably not it is seems like that in termux due to some reason in some part of process miss "__TERMUX__" see below
V version
V 0.3.3 47e8d96
Environment details (OS name and version, etc.)
OS: termux, 4.14.190-perf-25421105-abP619XXU1BVK6, #1 SMP PREEMPT Fri Nov 25 19:21:57 KST 2022 Processor: 8 cpus, 64bit, little endian CC version: clang version 15.0.7
getwd: /data/data/com.termux/files/home vmodules: /data/data/com.termux/files/home/.vmodules vroot: /data/data/com.termux/files/home/v vexe: /data/data/com.termux/files/home/v/v vexe mtime: 2023-02-08 20:27:15 is vroot writable: true is vmodules writable: true V full version: V 0.3.3 fbfdab9.47e8d96
Git version: git version 2.39.1 Git vroot status: weekly.2023.06-9-g47e8d967 .git/config present: true thirdparty/tcc status: thirdparty-unknown-unknown de82a130