How can I add LDFLAGS for bsp build?

DAVE ERICKSON daveerickson at shaw.ca
Fri Jul 22 14:09:34 UTC 2022


Hi Y.HB 

LDFLAGS sets both the library kind to include in the archive build but it also uses the -L flags to know where to look for it. The -lm can mean the libm.a. libm.so libm.la so it searches the LD_LIBRARY_PATH environment variable to find one that fits. If you want expressly to include the libm.a you should specify it instead of -lm. The first thing I recommend is find the symbols inside the Makefile configured for the . Look for the LDFLAGS and then your LD_LIBRARY_PATH to see if it matches where that arm-rtems5/lib/libm.a is. 

You can even use the flag argument: arm-rtems5/lib/libm.a or ./arm-rtems5/lib/libm.a to express the precise library and location to use. 

This is one important distinction that many people confuse about how automake and autoconf work: There is no "internal logic" in the autotools way of creating recipes for Makefiles. m4 is used for pattern processing. You must express what you want it to make, it won't go looking anywhere else than what is specified. 

It's not cmake, scons, or raw make. GNU Autotools creates recipe files, like config.status, that just hold environmental variables. 

DaemonDave on github. 


From: "Y. HB" <sprhawk at gmail.com> 
To: "rtems-users at rtems.org" <users at rtems.org> 
Sent: Friday, July 22, 2022 12:11:38 AM 
Subject: Re: How can I add LDFLAGS for bsp build? 

I added -lm in LDFLAGS in my custom bsps/arm/tms570/config/xxx.cfg 

the flag is added to compiling arguments, but it still reported undefined reference to 'floor', but I see there is floor symbols in the arm-rtems5/lib/libm.a 

Why is it? 

Thanks 

On Fri, Jul 22, 2022 at 1:43 PM Y. HB < [ mailto:sprhawk at gmail.com | sprhawk at gmail.com ] > wrote: 



Hello 

I'm working on a custom tms570 bsp upon RTEMS 5.1, but it depends on math lib (-lm), how can I add this flag to the bsp build? 

Shall I add LDFLAGS="-lm" during configure or shall I change some variables in c/src/lib/libbsp/arm/xxxx/Makefile.am? 

Thanks 




_______________________________________________ 
users mailing list 
users at rtems.org 
http://lists.rtems.org/mailman/listinfo/users 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20220722/446760ce/attachment.htm>


More information about the users mailing list