-
Notifications
You must be signed in to change notification settings - Fork 6
Common Errors
This page contains a list of various errors emitted by the VSL compiler you may get. Some of these don't have a specific solution.
The VSL compiler will automatically link your program with the appropriate libraries. In order to this VSL must identify the system compiler. By default VSL will use other compiler toolchains such as clang
, gcc
. If none of these are available VSL will attempt to use ld
and locate a crt0. If a linker could not be found, this will be emitted. Your options are:
- Instead, you can compile to an unlinked object using
vsl build -t obj
- Locate your linker and post an [issue](issue specifying your OS, linker name, the absolute path to the linker, and the flags required to run it.
- Install a linker. You can do this by installing clang or gcc. You may need to reference your OS manual for information on how to setup a C toolchain
- Manually specify a linker using
vsl build --linker <linker executable>
. An example execution isvsl build --linker ld.lld . -o myapp.out
VSL links with the 'C runtime' which simply allows a VSL program to start correctly across various platforms. The C-runtime is generally at /usr/lib/crt{0,1,i}
however if this is not found you will get this error. Your options are:
- Instead, you can compile to an object file using
vsl build -t obj
- If you have
clang
run:clang <object file> -o myexe.out
- If you have
gcc
run:gcc <object file> -o myexe.out
- If you have
- Locate your C-runtime and post an issue specifying your OS, OS version, and the location of the C-runtime you have found for your OS
- Post an issue with your OS, and the version of the OS, and maybe in a future version, support will be added.
If your error looks something like:
Intrinsic has incorrect argument type!
void (i8*, i8*, i64, i1)* @llvm.memcpy.p0i8.p0i8.i64
this means your LLVM needs to be updated. VSL works with LLVM 7.0+, we recommend referencing VSL's recommended LLVM installation
VSL generic parameters cannot be used in an expression directly. Instead, take a user-provided value and pass that into a container of that type. Here is an example:
class A<T> {
let values: T[]
public init() {
values[0] = T()
}
}
let a = A<Int>()
instead do something like:
class A<T> {
let values: T[] = []
func add(value: T) {
self.values.append(value)
}
}
let a = A<Int>()
a.add(value: 0)
If you get an error like:
Compiler Error: Tail of property is dynamic field but it was never compiled.
120 | private func convertToPhysicalIndex(index: Int) -> Int {
121 | if index < 0 {
> 122 | return self.length + index
| ^^^^^^
then that means there is an internal compiler error. To resolve this, identify what expression is calling the generic method from which the error is thrown. Then leave an issue with as much detail and a reproducible example of the error and it will attempt to be fixed.
- Introduction
- Installation
- VSL By Example
- Usage
- WASM (WebAssembly)
- The Basics
- Your First Program
- Syntax
- Concepts
- Modules
- Advanced Details
- Interop
- VSL Development
- Common Errors