Skip to contentSkip to conversation

perf 3.8-rc build failure: undefined reference to `strlcpy'

DISCUSSION Thomas Backlund 3 participants 6 messages Jan 29, 2013 – Jan 30, 2013

lore
Share & tools
lore
#0 lore raw

[tmb@tmb linux-3.8-rc5]$ make -C tools/perf -s V=1 HAVE_CPLUS_DEMANGLE=1 prefix=%{_prefix} all

...

/tmp/ccJEJv6m.o: In function `main':
:(.text+0x14): undefined reference to `strlcpy'
collect2: ld returned 1 exit status

...

This did not show up in 3.7

--
Thomas

#1 lore raw
Quoted 6 lines · Thomas Backlund

[tmb@tmb linux-3.8-rc5]$ make -C tools/perf -s V=1 HAVE_CPLUS_DEMANGLE=1 prefix=%{_prefix} all

...

Quoted 7 lines

/tmp/ccJEJv6m.o: In function `main':
:(.text+0x14): undefined reference to `strlcpy'
collect2: ld returned 1 exit status

...

This did not show up in 3.7

Ditto here:

/tmp/ccC1kLwn.o: In function `main':
:(.text+0x14): undefined reference to `strlcpy'
collect2: error: ld returned 1 exit status

Someone needs to get HAVE_STRLCPY and tools/perf/util/path.c in order so that the linker sees it, IMHO.

Signature · 5 lines
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
#2 lore raw

Hi Borislav,

Quoted 15 lines · Borislav Petkov
Quoted 6 lines · Thomas Backlund

[tmb@tmb linux-3.8-rc5]$ make -C tools/perf -s V=1 HAVE_CPLUS_DEMANGLE=1 prefix=%{_prefix} all

...

Quoted 7 lines

/tmp/ccJEJv6m.o: In function `main':
:(.text+0x14): undefined reference to `strlcpy'
collect2: ld returned 1 exit status

...

This did not show up in 3.7

Quoted 8 lines

Ditto here:

/tmp/ccC1kLwn.o: In function `main':
:(.text+0x14): undefined reference to `strlcpy'
collect2: error: ld returned 1 exit status

Someone needs to get HAVE_STRLCPY and tools/perf/util/path.c in order so that the linker sees it, IMHO.

Please see my reply on another post from Thomas:

https://lkml.org/lkml/2013/1/29/32

It's not like a build failure of perf tools, it's just a result of feature test so should not affect the build of perf itself, right? Why it confuses us is that we don't show any compile message if -s option is given to make, so I posted a patch to hide CHK and above failure message when -s option is specified.

Thanks,
Namhyung

#3 lore raw
Quoted 6 lines · Namhyung Kim

Please see my reply on another post from Thomas:

https://lkml.org/lkml/2013/1/29/32

It's not like a build failure of perf tools, it's just a result of feature test so should not affect the build of perf itself, right?

Doh, I see it. It is the -DHAVE_STRLCPY test, of course. And it happens only with a V=1 build, so actually there's not a build problem.

Quoted 3 lines

Why it confuses us is that we don't show any compile message if -s option is given to make, so I posted a patch to hide CHK and above failure message when -s option is specified.

Hm, trying your patch ontop of acme's perf/core still shows CHK stuff

$ make -s tools/perf
    DESCEND perf
    CHK -fstack-protector-all
    CHK -Wstack-protector
    CHK -Wvolatile-register-var
    CHK bionic
    CHK libelf
    CHK libdw
    ...

and that's because I'm doing the build from the toplevel repo and not in perf/. If I switch to perf first, it is silent:

$ make -s
Makefile:809: No bfd.h/libbfd found, install binutils-dev[el]/zlib-static to gain symbol demangling
Makefile:846: No numa.h found, disables 'perf bench numa mem' benchmark, please install numa-libs-devel or libnuma-dev
$

Oh, and one more thing, there's tools/scripts/Makefile.include which looks at -s already and perf/Makefile includes it so you probably want to put your change there so that all tools use it.

Thanks.

Signature · 5 lines
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
#4 lore raw
Quoted 28 lines · Borislav Petkov
Quoted 6 lines · Namhyung Kim

Please see my reply on another post from Thomas:

https://lkml.org/lkml/2013/1/29/32

It's not like a build failure of perf tools, it's just a result of feature test so should not affect the build of perf itself, right?

Doh, I see it. It is the -DHAVE_STRLCPY test, of course. And it happens only with a V=1 build, so actually there's not a build problem.

Quoted 3 lines

Why it confuses us is that we don't show any compile message if -s option is given to make, so I posted a patch to hide CHK and above failure message when -s option is specified.

Hm, trying your patch ontop of acme's perf/core still shows CHK stuff

$ make -s tools/perf
    DESCEND perf
    CHK -fstack-protector-all
    CHK -Wstack-protector
    CHK -Wvolatile-register-var
    CHK bionic
    CHK libelf
    CHK libdw
    ...
Quoted 7 lines

and that's because I'm doing the build from the toplevel repo and not in perf/. If I switch to perf first, it is silent:

$ make -s
Makefile:809: No bfd.h/libbfd found, install binutils-dev[el]/zlib-static to gain symbol demangling
Makefile:846: No numa.h found, disables 'perf bench numa mem' benchmark, please install numa-libs-devel or libnuma-dev
$

That's because the toplevel Makefile resets MAKEFLAGS in the middle:

Makefile:1330
# Clear a bunch of variables before executing the submake
tools/: FORCE
$(Q)mkdir -p $(objtree)/tools
$(Q)$(MAKE) LDFLAGS= MAKEFLAGS= O=$(objtree) subdir=tools -C $(src)/tools/

  tools/%: FORCE
  	$(Q)mkdir -p $(objtree)/tools
  	$(Q)$(MAKE) LDFLAGS= MAKEFLAGS= O=$(objtree) subdir=tools -C $(src)/tools/ $*

So why should it be reset in the first place?

Quoted 4 lines

Oh, and one more thing, there's tools/scripts/Makefile.include which looks at -s already and perf/Makefile includes it so you probably want to put your change there so that all tools use it.

Are you suggesting that moving "try-cc" to the Makefile.include?

Thanks,
Namhyung

#5 lore raw
Quoted 1 line · Namhyung Kim

That's because the toplevel Makefile resets MAKEFLAGS in the middle:

That was me: ea01fa9f63aef

Quoted 3 lines

Makefile:1330
# Clear a bunch of variables before executing the submake

and I added this because there was a problem AFAICR. And why I added it, is not documented in the patch commit message, crap.

Quoted 9 lines
  tools/: FORCE
  	$(Q)mkdir -p $(objtree)/tools
  	$(Q)$(MAKE) LDFLAGS= MAKEFLAGS= O=$(objtree) subdir=tools -C $(src)/tools/
  
  tools/%: FORCE
  	$(Q)mkdir -p $(objtree)/tools
  	$(Q)$(MAKE) LDFLAGS= MAKEFLAGS= O=$(objtree) subdir=tools -C $(src)/tools/ $*

So why should it be reset in the first place?

Oh yeah, it was some interaction with the toplevel Makefile that caused issues. Here's one, if you remove MAKEFLAGS= above and dump it in the target, here's what you get:

$ make -j9 tools/perf_clean
MAKEFLAGS: --no-print-directory -Rr --jobserver-fds=5,7 -j -I /w/kernel/linux-2.6
    DESCEND perf
make[2]: warning: jobserver unavailable: using -j1.  Add `+' to parent make rule.
    SUBDIR ../lib/traceevent/
*.o *~ libtraceevent.a libtraceevent.so *.a *.so ep_version.h .*.d
/bin/sh: 1: *.o: not found
make[4]: *** [clean] Error 127
make[3]: *** [sub-make] Error 2
make[2]: *** [/w/kernel/linux-2.6/tools/perf/libtraceevent.a-clean] Error 2
make[1]: *** [perf_clean] Error 2
make: *** [tools/perf_clean] Error 2

The "rm -f" is missing at the beginning of the line because kbuild does remove build files differently.

If you leave it in, it works fine:

DESCEND perf
SUBDIR ../lib/traceevent/
rm -f *.o *~ libtraceevent.a libtraceevent.so *.a *.so ep_version.h .*.d
...

Quoted 5 lines
Quoted 3 lines

Oh, and one more thing, there's tools/scripts/Makefile.include which looks at -s already and perf/Makefile includes it so you probably want to put your change there so that all tools use it.

Are you suggesting that moving "try-cc" to the Makefile.include?

Forget it, I got confused with the QUIET_* thingies in <tools/scripts/Makefile.include>

Thanks.

Signature · 5 lines
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--