Bug 13696

Summary: 1.32+ tree fails to build on Android NDK due to missing librt
Product: Busybox Reporter: Chris Renshaw <osm0sis>
Component: OtherAssignee: unassigned
Status: RESOLVED FIXED    
Severity: major CC: busybox-cvs
Priority: P5    
Version: 1.32.x   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Host: Target:
Build:
Attachments: Makefile.flags patch for the reported issue.

Description Chris Renshaw 2021-03-31 23:29:43 UTC
Created attachment 8856 [details]
Makefile.flags patch for the reported issue.

The addition of librt to Makefile.flags in https://git.busybox.net/busybox/commit/?id=be5a505d771a77c640acc35ceaa470c80e62f954 broke NDK builds.

/home/chris/x-tools/arm-linux-androideabi-r15c-api21-unified/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld.bfd.exe: cannot find -lrt
collect2.exe: error: ld returned 1 exit status
Note: if build needs additional libraries, put them in CONFIG_EXTRA_LDLIBS.
Example: CONFIG_EXTRA_LDLIBS="pthread dl tirpc audit pam"
make: *** [Makefile:719: busybox_unstripped] Error 1

I noticed the -lcrypt check for Android in the same area, presumably for a similar issue where the needed calls are already in bionic, so here's a patch using the same methodology to fix -lrt.
Comment 1 Denys Vlasenko 2021-04-14 17:02:38 UTC
Applied, thanks
Comment 2 Chris Renshaw 2021-04-14 19:43:47 UTC
I see you simplified it! Looks good. Thanks!