Skip to content

MacOS arm64 toolchain - C++ link error: (.text._getentropy_r+0x12): undefined reference to `_getentropy' #37

@MarcoBonino

Description

@MarcoBonino

Hello!

I'm trying to use the toolchain 14.2.0 (also tried with 13.2.0). I'm always getting the same link error when my code use some c++ std things (like cout or vector).

I downloaded the toolchain but also tried to install it via package manager. Same error.

See the example:

$ cat main.cpp                                                                                                                                                                                                                               
#include <iostream>

int main() {
  std::cout << "Hello!" << std::endl;
  return 0;
}

Compilation:

$ /Users/makko/Library/xPacks/@xpack-dev-tools/riscv-none-elf-gcc/14.2.0-2.1/.content/bin/riscv-none-elf-g++ -o hello main.cpp 
/Users/makko/Library/xPacks/@xpack-dev-tools/riscv-none-elf-gcc/14.2.0-2.1/.content/bin/../lib/gcc/riscv-none-elf/14.2.0/../../../../riscv-none-elf/bin/ld: /Users/makko/Library/xPacks/@xpack-dev-tools/riscv-none-elf-gcc/14.2.0-2.1/.content/bin/../lib/gcc/riscv-none-elf/14.2.0/../../../../riscv-none-elf/lib/libc.a(libc_a-getentropyr.o): in function `_getentropy_r':
(.text._getentropy_r+0x12): undefined reference to `_getentropy'
collect2: error: ld returned 1 exit status

Am I doing something wrong ? Could you help on this ?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions