Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

util: fix build with CFLAGS="-g" #12

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

wfrisch
Copy link

@wfrisch wfrisch commented Aug 29, 2024

The build process fails with debug symbols enabled, at least on my system.
CFLAGS="-g" make V=1:

cc -g -DSMC_TOOLS_RELEASE=1.8.3 -I/usr/include/libnl3  smcd.o infod.o ueidd.o seidd.o devd.o linkgroupd.o statsd.o libnetlink.o util.o  -lnl-genl-3 -lnl-3 -lm -o smcd
[...]
/home/user/smc-tools/dev.c:151:(.text+0x246): undefined reference to `is_str_empty'

It appears the root cause is that CFLAGS=-g influences the compiler's inlining decisions, leading to a situation where the is_str_empty function is not inlined, and the linker is searching for an out-of-line definition that isn’t present.

The most straightforward fix is to declare this function static inline.

@JanKarcher
Copy link

Hi Wolfgang,
thanks for pointing this out.
We are going to include this fix in the next version. Can you send your s-o-b to include in your commit?
Thanks
Jan

The build process fails with debug symbols enabled. It appears that
`CFLAGS=-g` influences the compiler's inlining decisions, leading to a
situation where the `is_str_empty` function is not inlined, and the
linker is searching for an out-of-line definition that isn’t present.
The most straightforward fix is to declare this function
`static inline`.

Signed-off-by: Wolfgang Frisch <[email protected]>
@wfrisch
Copy link
Author

wfrisch commented Sep 4, 2024

Hi Jan,

done. I just updated my branch with a more detailed commit message.

All the best,
Wolfgang

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants