Link error undefined reference to _getentropy.o

Post Reply
cy33hc
Posts: 3
Joined: Sun Jul 21, 2024 8:12 am

Link error undefined reference to _getentropy.o

Post by cy33hc » Sun Jul 21, 2024 8:20 am

Hi. I'm using devkitA64-r26.1-2 and getting a link error below.

/opt/devkitpro/devkitA64/bin/../lib/gcc/aarch64-none-elf/14.1.0/../../../../aarch64-none-elf/bin/ld: /opt/devkitpro/devkitA64/bin/../lib/gcc/aarch64-none-elf/14.1.0/../../../../aarch64-none-elf/lib/pic/libg.a(libc_a-sysgetentropy.o): in function `getentropy':
(.text.getentropy+0x28): undefined reference to `_getentropy_r'
collect2: error: ld returned 1 exit status

WinterMute
Site Admin
Posts: 1986
Joined: Tue Aug 09, 2005 3:21 am
Location: UK
Contact:

Re: Link error undefined reference to _getentropy.o

Post by WinterMute » Sun Jul 21, 2024 3:20 pm

What's pulling in getentropy?

We can have a look & see what we can do, will take a little toolchain fiddling though.
Help keep devkitPro toolchains free, Donate today

Personal Blog

cy33hc
Posts: 3
Joined: Sun Jul 21, 2024 8:12 am

Re: Link error undefined reference to _getentropy.o

Post by cy33hc » Sun Jul 21, 2024 7:45 pm

I believe it's from libarchive. If I exclude libarchive, then I just get a bunch of link errors related to libarchive and don't see getentropy link error

cy33hc
Posts: 3
Joined: Sun Jul 21, 2024 8:12 am

Re: Link error undefined reference to _getentropy.o

Post by cy33hc » Sun Jul 21, 2024 10:11 pm

I built libarchive myself and I dont get the getentropy link error. Used cmake instead. Used same version 3.7.2 and patches distributed with pacman.

cmake -DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/Switch.cmake -DBUILD_TESTING=OFF -DENABLE_BZip2=OFF -DENABLE_CAT=OFF -DENABLE_CPIO=OFF -DENABLE_TAR=OFF -DENABLE_TEST=OFF -DENABLE_UNZIP=OFF -DENABLE_ZSTD=ON -DENABLE_OPENSSL=OFF ..
Last edited by cy33hc on Sun Jul 21, 2024 10:18 pm, edited 3 times in total.

WinterMute
Site Admin
Posts: 1986
Joined: Tue Aug 09, 2005 3:21 am
Location: UK
Contact:

Re: Link error undefined reference to _getentropy.o

Post by WinterMute » Tue Jul 23, 2024 5:43 pm

Your self build has disabled half the options in libarchive and I'm not sure that's actually the source of your issue. As far as I can tell none of our portlibs reference getentropy so I'm not really sure what's happening. Can you by any chance provide a small code sample which shows the error you've reported?
Help keep devkitPro toolchains free, Donate today

Personal Blog

cy33hc
Posts: 3
Joined: Sun Jul 21, 2024 8:12 am

Re: Link error undefined reference to _getentropy.o

Post by cy33hc » Wed Jul 24, 2024 2:29 am

Rebuilt again using cmake, using same disabled options from configure except for disabling additionally the TEST code. Didn't get link error to getentropy

cmake -DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/Switch.cmake -DENABLE_CAT=OFF -DENABLE_CPIO=OFF -DENABLE_TAR=OFF -DENABLE_UNZIP=OFF -DENABLE_ZSTD=ON -DENABLE_OPENSSL=OFF -DENABLE_LIBXML2=OFF -DENABLE_ACL=OFF -DENABLE_TEST=OFF -DBUILD_TESTING=OFF ..

The ENABLE_CAT=OFF, ENABLE_CPIO=OFF, ENABLE_TAR=OFF, ENABLE_UNZIP=OFF etc.. are the same as disable-bsdcat, disable-bsdtar , disable-bsdunzip, disable-bsdcpio etc..

./configure --prefix="${PORTLIBS_PREFIX}" --host=aarch64-none-elf \
--disable-shared --enable-static \
--disable-bsdtar --disable-bsdcat \
--disable-bsdunzip --disable-bsdcpio --disable-acl \
--without-xml2 --without-openssl

I used libarchive in my project. https://github.com/cy33hc/switch-ezremo ... p_util.cpp

Currently building the app using libarchive that I built myself.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests