Skip to content

Undefined reference #39

@jankokondic

Description

@jankokondic

I'm trying to use the daulet/tokenizers library in a Go program via cgo, but I'm encountering an issue when running the program — I get errors saying that functions like from_file, encode, etc. are undefined ("undefined reference").

What I did:

  • Cloned the tokenizers repository.

  • Ran make build, which successfully generated the static library libtokenizers.a.

  • Wrote a minimal Go program that calls functions from the library.

  • Tried to run the program with the following command:

go run -ldflags="-extldflags '-L./'" .

The libtokenizers.a file is located in the current directory.

The problem:
During the build process, I get linker errors indicating that functions such as from_file, encode, etc. cannot be found.

Image
Image

I'd really appreciate any help or advice on how to correctly link this library with a Go program.

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions