Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1673466 > unrolled thread

[PATCH 0/3] kselftest build errors

Started byMarcin Nowakowski <marcin.nowakowski@imgtec.com>
First post2017-06-23 12:40 +0200
Last post2017-06-29 10:40 +0200
Articles 9 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/3] kselftest build errors Marcin Nowakowski <marcin.nowakowski@imgtec.com> - 2017-06-23 12:40 +0200
    [PATCH 3/3] selftests/intel_pstate: fix undefined reference when building Marcin Nowakowski <marcin.nowakowski@imgtec.com> - 2017-06-23 12:40 +0200
    [PATCH 1/3] selftests/{net,memfd}: fix undefined references to external libraries Marcin Nowakowski <marcin.nowakowski@imgtec.com> - 2017-06-23 12:40 +0200
    [PATCH 2/3] selftests/gpio: fix build error Marcin Nowakowski <marcin.nowakowski@imgtec.com> - 2017-06-23 12:40 +0200
      Re: [PATCH 2/3] selftests/gpio: fix build error Fathi Boudra <fathi.boudra@linaro.org> - 2017-06-28 10:40 +0200
    Re: [PATCH 0/3] kselftest build errors Shuah Khan <shuah@kernel.org> - 2017-06-23 21:50 +0200
      Re: [PATCH 0/3] kselftest build errors Fathi Boudra <fathi.boudra@linaro.org> - 2017-06-28 10:40 +0200
        Re: [PATCH 0/3] kselftest build errors Shuah Khan <shuah@kernel.org> - 2017-06-28 16:30 +0200
          Re: [PATCH 0/3] kselftest build errors Fathi Boudra <fathi.boudra@linaro.org> - 2017-06-29 10:40 +0200

#1673466 — [PATCH 0/3] kselftest build errors

FromMarcin Nowakowski <marcin.nowakowski@imgtec.com>
Date2017-06-23 12:40 +0200
Subject[PATCH 0/3] kselftest build errors
Message-ID<tVual-YI-13@gated-at.bofh.it>
This patch series fixes build errors observed when building net, memfd, gpio and intel_pstate tests

Marcin Nowakowski (3):
  selftests/{net,memfd}: fix undefined references to external libraries
  selftests/gpio: fix build error
  selftests/intel_pstate: fix undefined reference when building

 tools/testing/selftests/gpio/Makefile         | 2 +-
 tools/testing/selftests/intel_pstate/Makefile | 2 +-
 tools/testing/selftests/memfd/Makefile        | 4 ++--
 tools/testing/selftests/net/Makefile          | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

-- 
2.7.4

[toc] | [next] | [standalone]


#1673467 — [PATCH 3/3] selftests/intel_pstate: fix undefined reference when building

FromMarcin Nowakowski <marcin.nowakowski@imgtec.com>
Date2017-06-23 12:40 +0200
Subject[PATCH 3/3] selftests/intel_pstate: fix undefined reference when building
Message-ID<tVuam-YI-15@gated-at.bofh.it>
In reply to#1673466
Currently the build fails with:

/tmp/ccmgtz8N.o: In function `main':
aperf.c:(.text+0x278): undefined reference to `sqrt'
collect2: error: ld returned 1 exit status

Replace LDFLAGS with LDLIBS to ensure proper ordering of arguments in
build rules.

Signed-off-by: Marcin Nowakowski <marcin.nowakowski@imgtec.com>
---
 tools/testing/selftests/intel_pstate/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/intel_pstate/Makefile b/tools/testing/selftests/intel_pstate/Makefile
index 19678e9..80fd0ba 100644
--- a/tools/testing/selftests/intel_pstate/Makefile
+++ b/tools/testing/selftests/intel_pstate/Makefile
@@ -1,5 +1,5 @@
 CFLAGS := $(CFLAGS) -Wall -D_GNU_SOURCE
-LDFLAGS := $(LDFLAGS) -lm
+LDLIBS := $(LDFLAGS) -lm
 
 TEST_GEN_FILES := msr aperf
 
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1673468 — [PATCH 1/3] selftests/{net,memfd}: fix undefined references to external libraries

FromMarcin Nowakowski <marcin.nowakowski@imgtec.com>
Date2017-06-23 12:40 +0200
Subject[PATCH 1/3] selftests/{net,memfd}: fix undefined references to external libraries
Message-ID<tVuam-YI-17@gated-at.bofh.it>
In reply to#1673466
net test fails to link properly due to a missing reference to -lnuma and
fails with:
reuseport_bpf_numa.c:138: undefined reference to `numa_run_on_node'
reuseport_bpf_numa.c:230: undefined reference to `numa_available'
reuseport_bpf_numa.c:233: undefined reference to `numa_max_node'
collect2: error: ld returned 1 exit status

running make -p shows that this is due to a wrong LDFLAGS variable
definition which doesn't include the output prefix location:

 # makefile (from 'Makefile', line 6)
reuseport_bpf_numa: LDFLAGS += -lnuma
 # Not a target:
reuseport_bpf_numa:

The same issue has been observed in memfd with its references to
libfuse.

Resolve this by adding a pattern-matching to allow the binary name to be
prefixed with an output location.

For memfd also replace LDFLAGS with LDLIBS definition to ensure correct
ordering of arguments in the make's implicit rules.

Fixes: a8ba798bc8ec ('selftests: enable O and KBUILD_OUTPUT')

Signed-off-by: Marcin Nowakowski <marcin.nowakowski@imgtec.com>
---
 tools/testing/selftests/memfd/Makefile | 4 ++--
 tools/testing/selftests/net/Makefile   | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/memfd/Makefile b/tools/testing/selftests/memfd/Makefile
index 79891d0..754e92f 100644
--- a/tools/testing/selftests/memfd/Makefile
+++ b/tools/testing/selftests/memfd/Makefile
@@ -6,8 +6,8 @@ CFLAGS += -I../../../../usr/include/
 TEST_PROGS := run_fuse_test.sh
 TEST_GEN_FILES := memfd_test fuse_mnt fuse_test
 
-fuse_mnt.o: CFLAGS += $(shell pkg-config fuse --cflags)
-fuse_mnt: LDFLAGS += $(shell pkg-config fuse --libs)
+%/fuse_mnt: CFLAGS += $(shell pkg-config fuse --cflags)
+%/fuse_mnt: LDLIBS += $(shell pkg-config fuse --libs)
 
 include ../lib.mk
 
diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile
index 35cbb4c..d7abe8b 100644
--- a/tools/testing/selftests/net/Makefile
+++ b/tools/testing/selftests/net/Makefile
@@ -3,7 +3,7 @@
 CFLAGS =  -Wall -Wl,--no-as-needed -O2 -g
 CFLAGS += -I../../../../usr/include/
 
-reuseport_bpf_numa: LDFLAGS += -lnuma
+%/reuseport_bpf_numa: LDFLAGS += -lnuma
 
 TEST_PROGS := run_netsocktests run_afpackettests test_bpf.sh netdevice.sh
 TEST_GEN_FILES =  socket
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1673470 — [PATCH 2/3] selftests/gpio: fix build error

FromMarcin Nowakowski <marcin.nowakowski@imgtec.com>
Date2017-06-23 12:40 +0200
Subject[PATCH 2/3] selftests/gpio: fix build error
Message-ID<tVuam-YI-25@gated-at.bofh.it>
In reply to#1673466
While building selftests/gpio, gpio-utils from linux/tools/gpio as built
in the process as well. However, the OUTPUT make variable usage in
selftests breaks the build system in linux/tools/gpio resulting in its
output files placed in the selftests folder (due to lack of trailing
slash in the path, the files are placed directly in selftests):

make -f linux/tools/build/Makefile.build dir=. obj=lsgpio
make[3]: Entering directory '/mnt/ssd/MIPS/linux-next/tools/gpio'
CC    linux/tools/testing/selftests/gpiolsgpio.o
CC    linux/tools/testing/selftests/gpiogpio-utils.o
LD    linux/tools/testing/selftests/gpiolsgpio-in.o

This pollutes the selftests directory and, most importantly, makes it
impossible for selftests/gpio to find the object file it's looking for
to link the test:

cc -O2 -g -std=gnu99 -Wall -I../../../../usr/include/
gpio-mockup-chardev.c ../../../gpio/gpio-utils.o
../../../../usr/include/linux/gpio.h  -lmount -I/usr/include/libmount -o
gpio-mockup-chardev
gcc: error: ../../../gpio/gpio-utils.o: No such file or directory

Fix this by clearing the OUTPUT variable when invoking linux/tools/gpio
make to ensure it's built where expected.

Note, that this solution is not ideal as the output is placed in
linux/tools/gpio rather than a location relative to OUTPUT, but this at
least ensures the build succeeds.
Due to differences and complexities of selftests and linux/tools build
systems, it's not trivial to ensure linux/tools get built properly when
invoked recursively from selftests build and this is left as a future
task to resolve properly.

Fixes: a8ba798bc8ec ('selftests: enable O and KBUILD_OUTPUT')

Signed-off-by: Marcin Nowakowski <marcin.nowakowski@imgtec.com>
---
 tools/testing/selftests/gpio/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/gpio/Makefile b/tools/testing/selftests/gpio/Makefile
index 298929d..950956e 100644
--- a/tools/testing/selftests/gpio/Makefile
+++ b/tools/testing/selftests/gpio/Makefile
@@ -23,7 +23,7 @@ LDLIBS += -lmount -I/usr/include/libmount
 $(BINARIES): ../../../gpio/gpio-utils.o ../../../../usr/include/linux/gpio.h
 
 ../../../gpio/gpio-utils.o:
-	make ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C ../../../gpio
+	make ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C ../../../gpio OUTPUT=
 
 ../../../../usr/include/linux/gpio.h:
 	make -C ../../../.. headers_install INSTALL_HDR_PATH=$(shell pwd)/../../../../usr/
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1676442 — Re: [PATCH 2/3] selftests/gpio: fix build error

FromFathi Boudra <fathi.boudra@linaro.org>
Date2017-06-28 10:40 +0200
SubjectRe: [PATCH 2/3] selftests/gpio: fix build error
Message-ID<tXgFX-4t8-1@gated-at.bofh.it>
In reply to#1673470
On 23 June 2017 at 13:37, Marcin Nowakowski
<marcin.nowakowski@imgtec.com> wrote:
> While building selftests/gpio, gpio-utils from linux/tools/gpio as built
> in the process as well. However, the OUTPUT make variable usage in
> selftests breaks the build system in linux/tools/gpio resulting in its
> output files placed in the selftests folder (due to lack of trailing
> slash in the path, the files are placed directly in selftests):
>
> make -f linux/tools/build/Makefile.build dir=. obj=lsgpio
> make[3]: Entering directory '/mnt/ssd/MIPS/linux-next/tools/gpio'
> CC    linux/tools/testing/selftests/gpiolsgpio.o
> CC    linux/tools/testing/selftests/gpiogpio-utils.o
> LD    linux/tools/testing/selftests/gpiolsgpio-in.o
>
> This pollutes the selftests directory and, most importantly, makes it
> impossible for selftests/gpio to find the object file it's looking for
> to link the test:
>
> cc -O2 -g -std=gnu99 -Wall -I../../../../usr/include/
> gpio-mockup-chardev.c ../../../gpio/gpio-utils.o
> ../../../../usr/include/linux/gpio.h  -lmount -I/usr/include/libmount -o
> gpio-mockup-chardev
> gcc: error: ../../../gpio/gpio-utils.o: No such file or directory
>
> Fix this by clearing the OUTPUT variable when invoking linux/tools/gpio
> make to ensure it's built where expected.
>
> Note, that this solution is not ideal as the output is placed in
> linux/tools/gpio rather than a location relative to OUTPUT, but this at
> least ensures the build succeeds.
> Due to differences and complexities of selftests and linux/tools build
> systems, it's not trivial to ensure linux/tools get built properly when
> invoked recursively from selftests build and this is left as a future
> task to resolve properly.
>
> Fixes: a8ba798bc8ec ('selftests: enable O and KBUILD_OUTPUT')
>
> Signed-off-by: Marcin Nowakowski <marcin.nowakowski@imgtec.com>

FWIW, I've tested the patch and it fixes the issue mentioned.

Tested-by: Fathi Boudra <fathi.boudra@linaro.org>

> ---
>  tools/testing/selftests/gpio/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/gpio/Makefile b/tools/testing/selftests/gpio/Makefile
> index 298929d..950956e 100644
> --- a/tools/testing/selftests/gpio/Makefile
> +++ b/tools/testing/selftests/gpio/Makefile
> @@ -23,7 +23,7 @@ LDLIBS += -lmount -I/usr/include/libmount
>  $(BINARIES): ../../../gpio/gpio-utils.o ../../../../usr/include/linux/gpio.h
>
>  ../../../gpio/gpio-utils.o:
> -       make ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C ../../../gpio
> +       make ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C ../../../gpio OUTPUT=
>
>  ../../../../usr/include/linux/gpio.h:
>         make -C ../../../.. headers_install INSTALL_HDR_PATH=$(shell pwd)/../../../../usr/
> --
> 2.7.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

[toc] | [prev] | [next] | [standalone]


#1673800

FromShuah Khan <shuah@kernel.org>
Date2017-06-23 21:50 +0200
Message-ID<tVCKC-6lJ-11@gated-at.bofh.it>
In reply to#1673466
On 06/23/2017 04:37 AM, Marcin Nowakowski wrote:
> This patch series fixes build errors observed when building net, memfd, gpio and intel_pstate tests
> 
> Marcin Nowakowski (3):
>   selftests/{net,memfd}: fix undefined references to external libraries
>   selftests/gpio: fix build error
>   selftests/intel_pstate: fix undefined reference when building
> 
>  tools/testing/selftests/gpio/Makefile         | 2 +-
>  tools/testing/selftests/intel_pstate/Makefile | 2 +-
>  tools/testing/selftests/memfd/Makefile        | 4 ++--
>  tools/testing/selftests/net/Makefile          | 2 +-
>  4 files changed, 5 insertions(+), 5 deletions(-)
> 

Hi Marcin,

SeongJae Park sent me fixes for the memfd/net/intel_pstate problems
last week. I pulled those in already.

The gpio fix is something I need to look at closely to see if this is
the way to go. I will get back to you on that.

thanks,
-- Shuah

[toc] | [prev] | [next] | [standalone]


#1676444

FromFathi Boudra <fathi.boudra@linaro.org>
Date2017-06-28 10:40 +0200
Message-ID<tXgFY-4t8-11@gated-at.bofh.it>
In reply to#1673800
On 23 June 2017 at 22:44, Shuah Khan <shuah@kernel.org> wrote:
> On 06/23/2017 04:37 AM, Marcin Nowakowski wrote:
>> This patch series fixes build errors observed when building net, memfd, gpio and intel_pstate tests
>>
>> Marcin Nowakowski (3):
>>   selftests/{net,memfd}: fix undefined references to external libraries
>>   selftests/gpio: fix build error
>>   selftests/intel_pstate: fix undefined reference when building
>>
>>  tools/testing/selftests/gpio/Makefile         | 2 +-
>>  tools/testing/selftests/intel_pstate/Makefile | 2 +-
>>  tools/testing/selftests/memfd/Makefile        | 4 ++--
>>  tools/testing/selftests/net/Makefile          | 2 +-
>>  4 files changed, 5 insertions(+), 5 deletions(-)
>>
>
> Hi Marcin,
>
> SeongJae Park sent me fixes for the memfd/net/intel_pstate problems
> last week. I pulled those in already.
>
> The gpio fix is something I need to look at closely to see if this is
> the way to go. I will get back to you on that.

Any updates on the gpio fix? I've tested it and it works for me.

> thanks,
> -- Shuah
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

[toc] | [prev] | [next] | [standalone]


#1676715

FromShuah Khan <shuah@kernel.org>
Date2017-06-28 16:30 +0200
Message-ID<tXm8G-7TU-19@gated-at.bofh.it>
In reply to#1676444
On 06/28/2017 02:30 AM, Fathi Boudra wrote:
> On 23 June 2017 at 22:44, Shuah Khan <shuah@kernel.org> wrote:
>> On 06/23/2017 04:37 AM, Marcin Nowakowski wrote:
>>> This patch series fixes build errors observed when building net, memfd, gpio and intel_pstate tests
>>>
>>> Marcin Nowakowski (3):
>>>   selftests/{net,memfd}: fix undefined references to external libraries
>>>   selftests/gpio: fix build error
>>>   selftests/intel_pstate: fix undefined reference when building
>>>
>>>  tools/testing/selftests/gpio/Makefile         | 2 +-
>>>  tools/testing/selftests/intel_pstate/Makefile | 2 +-
>>>  tools/testing/selftests/memfd/Makefile        | 4 ++--
>>>  tools/testing/selftests/net/Makefile          | 2 +-
>>>  4 files changed, 5 insertions(+), 5 deletions(-)
>>>
>>
>> Hi Marcin,
>>
>> SeongJae Park sent me fixes for the memfd/net/intel_pstate problems
>> last week. I pulled those in already.
>>
>> The gpio fix is something I need to look at closely to see if this is
>> the way to go. I will get back to you on that.
> 
> Any updates on the gpio fix? I've tested it and it works for me.
> 

I haven't decided yet.

thanks,
-- Shuah

[toc] | [prev] | [next] | [standalone]


#1677526

FromFathi Boudra <fathi.boudra@linaro.org>
Date2017-06-29 10:40 +0200
Message-ID<tXD9w-5gl-9@gated-at.bofh.it>
In reply to#1676715
On 28 June 2017 at 17:21, Shuah Khan <shuah@kernel.org> wrote:
> On 06/28/2017 02:30 AM, Fathi Boudra wrote:
>> On 23 June 2017 at 22:44, Shuah Khan <shuah@kernel.org> wrote:
>>> On 06/23/2017 04:37 AM, Marcin Nowakowski wrote:
>>>> This patch series fixes build errors observed when building net, memfd, gpio and intel_pstate tests
>>>>
>>>> Marcin Nowakowski (3):
>>>>   selftests/{net,memfd}: fix undefined references to external libraries
>>>>   selftests/gpio: fix build error
>>>>   selftests/intel_pstate: fix undefined reference when building
>>>>
>>>>  tools/testing/selftests/gpio/Makefile         | 2 +-
>>>>  tools/testing/selftests/intel_pstate/Makefile | 2 +-
>>>>  tools/testing/selftests/memfd/Makefile        | 4 ++--
>>>>  tools/testing/selftests/net/Makefile          | 2 +-
>>>>  4 files changed, 5 insertions(+), 5 deletions(-)
>>>>
>>>
>>> Hi Marcin,
>>>
>>> SeongJae Park sent me fixes for the memfd/net/intel_pstate problems
>>> last week. I pulled those in already.
>>>
>>> The gpio fix is something I need to look at closely to see if this is
>>> the way to go. I will get back to you on that.
>>
>> Any updates on the gpio fix? I've tested it and it works for me.
>>
>
> I haven't decided yet.

another alternative is to use realpath:
-GPIODIR := ../../../gpio
+GPIODIR := $(realpath ../../../gpio)

btw, this commit:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=51c6bd7cbe0366b642d8ac90d98739c39ab091a9
should be reverted once the build error is addressed because they
shouldn't have been there in the first place due to lack of trailing
slash in the path.

> thanks,
> -- Shuah

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web