Skip to content

Common Errors

Vihan edited this page May 31, 2019 · 6 revisions

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.

Linker Not Found

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:

  1. Instead, you can compile to an unlinked object using vsl build -t obj
  2. 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.
  3. 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
  4. Manually specify a linker using vsl build --linker <linker executable>. An example execution is vsl build --linker ld.lld . -o myapp.out

CRT Not Found

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:

  1. Instead, you can compile to an object file using vsl build -t obj
    1. If you have clang run: clang <object file> -o myexe.out
    2. If you have gcc run: gcc <object file> -o myexe.out
  2. 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
  3. Post an issue with your OS, and the version of the OS, and maybe in a future version, support will be added.

Intrinsic has incorrect argument type!

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

Cannot use generic parameter in an expression

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)

"Tail of property is dynamic"

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.