On Wed, Jun 12, 2024 at 4:43 PM Ross Burton <ross.bur...@arm.com> wrote:
>
> On 12 Jun 2024, at 11:44, Kaiwan N Billimoria via lists.yoctoproject.org 
> <kaiwan.billimoria=gmail....@lists.yoctoproject.org> wrote:
> >
> > Hello all!
> >
> > I have a newbie question regarding creating a recipe for C code, where
> > the project already has a custom Makefile -which of course must be
> > used for the build.
> > From what I recall, the recipe doesn't have to do anything special;
> > bitbake will pick up the Makefile and do the 'make'...
> >
> > However, when experimenting with a v simple 'hello, world' C program
> > and Makefile, I find that am unable to get a 'debug build'
> > helloworld_dbg binary executable - it simply seems to use the default
> > $(CFLAGS) value and I can't seem to influence it, via the recipe or
> > the Makefile??
>
> Your helloworld_dbg target uses CFLAGS_DBG but I don’t see that defined 
> anywhere.
Hi Ross, thanks. Yes, sorry, another mistake on my part: I tried
defining CFLAGS_DBG in the recipe and access it in the Makefile but
that too didn;t seem to work...
>
> What’s your actual intention here?
To get two binaries: one, a stripped non-debug production version, and
two, (helloworld_dbg) the 'debug' version, non-stripped, with debug
symbols.

>If helloworld_dbg should be unstripped, then the idiom is to _always_ build 
>unstripped binaries (which is why CFLAGS has -g in) and at packaging time 
>bitbake will extract the debug symbols and put them into the -dbg package.
Ah, so I gather, as you've said, that bitbake will not strip the
binary and will provide the debug symbols in -dbg package.

So my question really is: the deployed 'production' binary should be
stripped and optimized, thus should not be compiled with -g and -O0
right?
But the generated helloworld binary shows like this:
$ file .../tmp-glibc/work/cortexa72-kaiwanTECH-linux/hellomake/1.0/helloworld
.../tmp-glibc/work/cortexa72-kaiwanTECH-linux/hellomake/1.0/helloworld:
ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), dynamically
linked, interpreter /usr/lib/ld-linux-aarch64.so.1,
BuildID[sha1]=ae3... for GNU/Linux 5.15.0, with debug_info, not
stripped

The last part clearly says 'with debug_info, not stripped'; this, IMO,
conflicts with what we want for production... That's the thing I am
not getting.

Thanks,
Kaiwan.
>
> Ross
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#63328): https://lists.yoctoproject.org/g/yocto/message/63328
Mute This Topic: https://lists.yoctoproject.org/mt/106629727/21656
Group Owner: yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to