"undefined reference to waitpid" when compiling with libarchive

Post Reply
SMB_Fan2010
Posts: 1
Joined: Fri Dec 22, 2023 12:21 am

"undefined reference to waitpid" when compiling with libarchive

Post by SMB_Fan2010 » Fri Dec 22, 2023 12:32 am

Hello,
I'm trying to make a 3DS homebrew app that needs to extract files from a ZIP archive using libarchive. However, when I try to compile it with make, I get a lot of undefined references. The one at the top always has to do with waitpid. Here's the full list of them:

Code: Select all

C:/devkitPro/devkitARM/bin/../lib/gcc/arm-none-eabi/13.2.0/../../../../arm-none-eabi/bin/ld.exe: C:/
devkitPro/portlibs/3ds/lib\libarchive.a(archive_read_support_filter_program.o): in function `child_s
top.isra.1':
archive_read_support_filter_program.c:(.text.child_stop.isra.1+0xa0): undefined reference to `waitpi
d'
C:/devkitPro/devkitARM/bin/../lib/gcc/arm-none-eabi/13.2.0/../../../../arm-none-eabi/bin/ld.exe: C:/
devkitPro/portlibs/3ds/lib\libarchive.a(archive_read_support_filter_program.o): in function `program
_filter_read':
archive_read_support_filter_program.c:(.text.program_filter_read+0x110): undefined reference to `__a
rchive_check_child'
C:/devkitPro/devkitARM/bin/../lib/gcc/arm-none-eabi/13.2.0/../../../../arm-none-eabi/bin/ld.exe: arc
hive_read_support_filter_program.c:(.text.program_filter_read+0x20c): undefined reference to `__arch
ive_check_child'
C:/devkitPro/devkitARM/bin/../lib/gcc/arm-none-eabi/13.2.0/../../../../arm-none-eabi/bin/ld.exe: C:/
devkitPro/portlibs/3ds/lib\libarchive.a(archive_read_support_filter_program.o): in function `__archi
ve_read_program':
archive_read_support_filter_program.c:(.text.__archive_read_program+0xa8): undefined reference to `_
_archive_create_child'
C:/devkitPro/devkitARM/bin/../lib/gcc/arm-none-eabi/13.2.0/../../../../arm-none-eabi/bin/ld.exe: C:/
devkitPro/portlibs/3ds/lib\libarchive.a(archive_write_disk_set_standard_lookup.o): in function `look
up_uid':
archive_write_disk_set_standard_lookup.c:(.text.lookup_uid+0xa4): undefined reference to `getpwnam'
C:/devkitPro/devkitARM/bin/../lib/gcc/arm-none-eabi/13.2.0/../../../../arm-none-eabi/bin/ld.exe: C:/
devkitPro/portlibs/3ds/lib\libarchive.a(archive_write_disk_set_standard_lookup.o): in function `look
up_gid':
archive_write_disk_set_standard_lookup.c:(.text.lookup_gid+0xa4): undefined reference to `getgrnam'
In my Makefile:

Code: Select all

LIBS	:= -lcurl -lmbedtls -lmbedx509 -lmbedcrypto -larchive -lcitro2d -lcitro3d -lctru -lm -lbz2 -llzma -lz

Code: Select all

LIBDIRS	:= $(PORTLIBS) $(CTRULIB)
How do I fix this? Thanks in advance!

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

Re: "undefined reference to waitpid" when compiling with libarchive

Post by WinterMute » Fri Dec 22, 2023 4:25 pm

I've upgraded 3ds libarchive to 3.7.2 and done some work on the patchsets. Update using (dkp-)pacman -Syu.

Rather than attempting to figure out all these libraries manually you'll be much better off using pkg-config which knows dependencies and their order.

Code: Select all

LIBS := 	-lcitro2d -lcitro3d `$(PREFIX)pkg-config --libs libarchive libcurl`
Should do what you need.
Help keep devkitPro toolchains free, Donate today

Personal Blog

SMB_Fan2010
Posts: 1
Joined: Fri Dec 22, 2023 12:21 am

Re: "undefined reference to waitpid" when compiling with libarchive

Post by SMB_Fan2010 » Fri Dec 22, 2023 9:08 pm

Sorry, didn't work 😒
I updated libarchive, but it still doesn't work. Here's the error i'm getting now:

Code: Select all

C:/devkitPro/devkitARM/bin/../lib/gcc/arm-none-eabi/13.2.0/../../../../arm-none-eabi/bin/ld.exe: can
not find -l-L/opt/devkitpro/portlibs/3ds/lib: No such file or directory
If your "solution" didn't actually work, how else can i fix this?
Last edited by SMB_Fan2010 on Fri Dec 22, 2023 9:16 pm, edited 1 time in total.

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

Re: "undefined reference to waitpid" when compiling with libarchive

Post by WinterMute » Fri Dec 22, 2023 11:38 pm

SMB_Fan2010 wrote: Fri Dec 22, 2023 9:08 pm Sorry, didn't work 😒
I updated libarchive, but it still doesn't work. Here's the error i'm getting now:

Code: Select all

C:/devkitPro/devkitARM/bin/../lib/gcc/arm-none-eabi/13.2.0/../../../../arm-none-eabi/bin/ld.exe: can
not find -l-L/opt/devkitpro/portlibs/3ds/lib: No such file or directory
If your "solution" didn't actually work, how else can i fix this?
Apologies. I added an extra -l to the line I gave you originally. I've corrected the line in my reply above - there was an extra -l in front of `$(PREFIX)
Help keep devkitPro toolchains free, Donate today

Personal Blog

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests