* [PATCH 1/1] selftests: timers: use LDLIBS instead of LDFLAGS to link against libpthread
@ 2017-06-28 9:18 Fathi Boudra
2017-06-28 14:20 ` Shuah Khan
0 siblings, 1 reply; 8+ messages in thread
From: Fathi Boudra @ 2017-06-28 9:18 UTC (permalink / raw)
To: linux-kselftest, Shuah Khan
Cc: linux-kernel, John Stultz, Denys Dmytriyenko, Fathi Boudra
timers test fails to build due to undefined reference:
aarch64-linaro-linux-gcc --sysroot=/build/tmp-rpb-glibc/sysroots/hikey
-O2 -pipe -g -feliminate-unused-debug-types -O3 -Wl,-no-as-needed -Wall
-DKTEST -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -lrt -lpthread
posix_timers.c
-o /build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers
/tmp/cc1FTZzT.o: In function `check_timer_create':
/usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers.c:157:
undefined reference to `timer_create'
/usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers.c:170:
undefined reference to `timer_settime'
collect2: error: ld returned 1 exit status
Use LDLIBS instead of LDFLAGS to properly link against libpthread and fix
this build issue.
Signed-off-by: Denys Dmytriyenko <denys@ti.com>
Signed-off-by: Fathi Boudra <fathi.boudra@linaro.org>
---
tools/testing/selftests/timers/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/timers/Makefile b/tools/testing/selftests/timers/Makefile
index 5fa1d7e9a915..f48d7ca9d9b1 100644
--- a/tools/testing/selftests/timers/Makefile
+++ b/tools/testing/selftests/timers/Makefile
@@ -1,6 +1,6 @@
BUILD_FLAGS = -DKTEST
CFLAGS += -O3 -Wl,-no-as-needed -Wall $(BUILD_FLAGS)
-LDFLAGS += -lrt -lpthread
+LDLIBS += -lrt -lpthread
# these are all "safe" tests that don't modify
# system time or require escalated privileges
--
2.13.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/1] selftests: timers: use LDLIBS instead of LDFLAGS to link against libpthread
2017-06-28 9:18 [PATCH 1/1] selftests: timers: use LDLIBS instead of LDFLAGS to link against libpthread Fathi Boudra
@ 2017-06-28 14:20 ` Shuah Khan
2017-06-28 14:37 ` Fathi Boudra
0 siblings, 1 reply; 8+ messages in thread
From: Shuah Khan @ 2017-06-28 14:20 UTC (permalink / raw)
To: Fathi Boudra, linux-kselftest
Cc: linux-kernel, John Stultz, Denys Dmytriyenko, Shuah Khan
On 06/28/2017 03:18 AM, Fathi Boudra wrote:
> timers test fails to build due to undefined reference:
>
> aarch64-linaro-linux-gcc --sysroot=/build/tmp-rpb-glibc/sysroots/hikey
> -O2 -pipe -g -feliminate-unused-debug-types -O3 -Wl,-no-as-needed -Wall
> -DKTEST -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -lrt -lpthread
> posix_timers.c
> -o /build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers
> /tmp/cc1FTZzT.o: In function `check_timer_create':
> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers.c:157:
> undefined reference to `timer_create'
> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers.c:170:
> undefined reference to `timer_settime'
> collect2: error: ld returned 1 exit status
>
> Use LDLIBS instead of LDFLAGS to properly link against libpthread and fix
> this build issue.
>
> Signed-off-by: Denys Dmytriyenko <denys@ti.com>
> Signed-off-by: Fathi Boudra <fathi.boudra@linaro.org>
I can't reproduce this on linux-kselftest next on x86_64. Is this arm64 speocific
problem? Please try this on linux-kselftest latest.
thanks,
-- Shuah
> ---
> tools/testing/selftests/timers/Makefile | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/timers/Makefile b/tools/testing/selftests/timers/Makefile
> index 5fa1d7e9a915..f48d7ca9d9b1 100644
> --- a/tools/testing/selftests/timers/Makefile
> +++ b/tools/testing/selftests/timers/Makefile
> @@ -1,6 +1,6 @@
> BUILD_FLAGS = -DKTEST
> CFLAGS += -O3 -Wl,-no-as-needed -Wall $(BUILD_FLAGS)
> -LDFLAGS += -lrt -lpthread
> +LDLIBS += -lrt -lpthread
>
> # these are all "safe" tests that don't modify
> # system time or require escalated privileges
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/1] selftests: timers: use LDLIBS instead of LDFLAGS to link against libpthread
2017-06-28 14:20 ` Shuah Khan
@ 2017-06-28 14:37 ` Fathi Boudra
2017-06-28 14:41 ` Shuah Khan
0 siblings, 1 reply; 8+ messages in thread
From: Fathi Boudra @ 2017-06-28 14:37 UTC (permalink / raw)
To: Shuah Khan; +Cc: linux-kselftest, linux-kernel, John Stultz, Denys Dmytriyenko
On 28 June 2017 at 17:20, Shuah Khan <shuah@kernel.org> wrote:
> On 06/28/2017 03:18 AM, Fathi Boudra wrote:
>> timers test fails to build due to undefined reference:
>>
>> aarch64-linaro-linux-gcc --sysroot=/build/tmp-rpb-glibc/sysroots/hikey
>> -O2 -pipe -g -feliminate-unused-debug-types -O3 -Wl,-no-as-needed -Wall
>> -DKTEST -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -lrt -lpthread
>> posix_timers.c
>> -o /build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers
>> /tmp/cc1FTZzT.o: In function `check_timer_create':
>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers.c:157:
>> undefined reference to `timer_create'
>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers.c:170:
>> undefined reference to `timer_settime'
>> collect2: error: ld returned 1 exit status
>>
>> Use LDLIBS instead of LDFLAGS to properly link against libpthread and fix
>> this build issue.
>>
>> Signed-off-by: Denys Dmytriyenko <denys@ti.com>
>> Signed-off-by: Fathi Boudra <fathi.boudra@linaro.org>
>
> I can't reproduce this on linux-kselftest next on x86_64. Is this arm64 speocific
> problem? Please try this on linux-kselftest latest.
yes, I tried linux-kselftest next and can reproduce.
Maybe related to native build vs cross-build?
I don't think it's arm64 specific.
> thanks,
> -- Shuah
>
>> ---
>> tools/testing/selftests/timers/Makefile | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/tools/testing/selftests/timers/Makefile b/tools/testing/selftests/timers/Makefile
>> index 5fa1d7e9a915..f48d7ca9d9b1 100644
>> --- a/tools/testing/selftests/timers/Makefile
>> +++ b/tools/testing/selftests/timers/Makefile
>> @@ -1,6 +1,6 @@
>> BUILD_FLAGS = -DKTEST
>> CFLAGS += -O3 -Wl,-no-as-needed -Wall $(BUILD_FLAGS)
>> -LDFLAGS += -lrt -lpthread
>> +LDLIBS += -lrt -lpthread
>>
>> # these are all "safe" tests that don't modify
>> # system time or require escalated privileges
>>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/1] selftests: timers: use LDLIBS instead of LDFLAGS to link against libpthread
2017-06-28 14:37 ` Fathi Boudra
@ 2017-06-28 14:41 ` Shuah Khan
2017-06-28 15:00 ` Fathi Boudra
0 siblings, 1 reply; 8+ messages in thread
From: Shuah Khan @ 2017-06-28 14:41 UTC (permalink / raw)
To: Fathi Boudra
Cc: linux-kselftest, linux-kernel, John Stultz, Denys Dmytriyenko,
Shuah Khan
On 06/28/2017 08:37 AM, Fathi Boudra wrote:
> On 28 June 2017 at 17:20, Shuah Khan <shuah@kernel.org> wrote:
>> On 06/28/2017 03:18 AM, Fathi Boudra wrote:
>>> timers test fails to build due to undefined reference:
>>>
>>> aarch64-linaro-linux-gcc --sysroot=/build/tmp-rpb-glibc/sysroots/hikey
>>> -O2 -pipe -g -feliminate-unused-debug-types -O3 -Wl,-no-as-needed -Wall
>>> -DKTEST -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -lrt -lpthread
>>> posix_timers.c
>>> -o /build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers
>>> /tmp/cc1FTZzT.o: In function `check_timer_create':
>>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers.c:157:
>>> undefined reference to `timer_create'
>>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers.c:170:
>>> undefined reference to `timer_settime'
>>> collect2: error: ld returned 1 exit status
>>>
>>> Use LDLIBS instead of LDFLAGS to properly link against libpthread and fix
>>> this build issue.
>>>
>>> Signed-off-by: Denys Dmytriyenko <denys@ti.com>
>>> Signed-off-by: Fathi Boudra <fathi.boudra@linaro.org>
>>
>> I can't reproduce this on linux-kselftest next on x86_64. Is this arm64 speocific
>> problem? Please try this on linux-kselftest latest.
>
> yes, I tried linux-kselftest next and can reproduce.
> Maybe related to native build vs cross-build?
> I don't think it's arm64 specific.
>
Can you confirm that this change doesn't cause problems in native
build environments.
thanks,
-- Shuah
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/1] selftests: timers: use LDLIBS instead of LDFLAGS to link against libpthread
2017-06-28 14:41 ` Shuah Khan
@ 2017-06-28 15:00 ` Fathi Boudra
2017-06-28 15:11 ` Shuah Khan
0 siblings, 1 reply; 8+ messages in thread
From: Fathi Boudra @ 2017-06-28 15:00 UTC (permalink / raw)
To: Shuah Khan; +Cc: linux-kselftest, linux-kernel, John Stultz, Denys Dmytriyenko
On 28 June 2017 at 17:41, Shuah Khan <shuah@kernel.org> wrote:
> On 06/28/2017 08:37 AM, Fathi Boudra wrote:
>> On 28 June 2017 at 17:20, Shuah Khan <shuah@kernel.org> wrote:
>>> On 06/28/2017 03:18 AM, Fathi Boudra wrote:
>>>> timers test fails to build due to undefined reference:
>>>>
>>>> aarch64-linaro-linux-gcc --sysroot=/build/tmp-rpb-glibc/sysroots/hikey
>>>> -O2 -pipe -g -feliminate-unused-debug-types -O3 -Wl,-no-as-needed -Wall
>>>> -DKTEST -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -lrt -lpthread
>>>> posix_timers.c
>>>> -o /build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers
>>>> /tmp/cc1FTZzT.o: In function `check_timer_create':
>>>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers.c:157:
>>>> undefined reference to `timer_create'
>>>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers.c:170:
>>>> undefined reference to `timer_settime'
>>>> collect2: error: ld returned 1 exit status
>>>>
>>>> Use LDLIBS instead of LDFLAGS to properly link against libpthread and fix
>>>> this build issue.
>>>>
>>>> Signed-off-by: Denys Dmytriyenko <denys@ti.com>
>>>> Signed-off-by: Fathi Boudra <fathi.boudra@linaro.org>
>>>
>>> I can't reproduce this on linux-kselftest next on x86_64. Is this arm64 speocific
>>> problem? Please try this on linux-kselftest latest.
>>
>> yes, I tried linux-kselftest next and can reproduce.
>> Maybe related to native build vs cross-build?
>> I don't think it's arm64 specific.
>>
>
> Can you confirm that this change doesn't cause problems in native
> build environments.
yes, I tested on x86 in native build environment as well. It builds
and run fine.
I noticed my patchset for LDFLAGS vs LDLIBS changes don't apply
cleanly on linux-kselftest next branch. I'm happy to respin the serie
on top of next branch if you're willing to take them.
> thanks,
> -- Shuah
Cheers,
Fathi
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/1] selftests: timers: use LDLIBS instead of LDFLAGS to link against libpthread
2017-06-28 15:00 ` Fathi Boudra
@ 2017-06-28 15:11 ` Shuah Khan
2017-06-28 15:56 ` Fathi Boudra
0 siblings, 1 reply; 8+ messages in thread
From: Shuah Khan @ 2017-06-28 15:11 UTC (permalink / raw)
To: Fathi Boudra
Cc: linux-kselftest, linux-kernel, John Stultz, Denys Dmytriyenko,
Shuah Khan
On 06/28/2017 09:00 AM, Fathi Boudra wrote:
> On 28 June 2017 at 17:41, Shuah Khan <shuah@kernel.org> wrote:
>> On 06/28/2017 08:37 AM, Fathi Boudra wrote:
>>> On 28 June 2017 at 17:20, Shuah Khan <shuah@kernel.org> wrote:
>>>> On 06/28/2017 03:18 AM, Fathi Boudra wrote:
>>>>> timers test fails to build due to undefined reference:
>>>>>
>>>>> aarch64-linaro-linux-gcc --sysroot=/build/tmp-rpb-glibc/sysroots/hikey
>>>>> -O2 -pipe -g -feliminate-unused-debug-types -O3 -Wl,-no-as-needed -Wall
>>>>> -DKTEST -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -lrt -lpthread
>>>>> posix_timers.c
>>>>> -o /build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers
>>>>> /tmp/cc1FTZzT.o: In function `check_timer_create':
>>>>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers.c:157:
>>>>> undefined reference to `timer_create'
>>>>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers.c:170:
>>>>> undefined reference to `timer_settime'
>>>>> collect2: error: ld returned 1 exit status
>>>>>
>>>>> Use LDLIBS instead of LDFLAGS to properly link against libpthread and fix
>>>>> this build issue.
>>>>>
>>>>> Signed-off-by: Denys Dmytriyenko <denys@ti.com>
>>>>> Signed-off-by: Fathi Boudra <fathi.boudra@linaro.org>
>>>>
>>>> I can't reproduce this on linux-kselftest next on x86_64. Is this arm64 speocific
>>>> problem? Please try this on linux-kselftest latest.
>>>
>>> yes, I tried linux-kselftest next and can reproduce.
>>> Maybe related to native build vs cross-build?
>>> I don't think it's arm64 specific.
>>>
>>
>> Can you confirm that this change doesn't cause problems in native
>> build environments.
>
> yes, I tested on x86 in native build environment as well. It builds
> and run fine.
>
> I noticed my patchset for LDFLAGS vs LDLIBS changes don't apply
> cleanly on linux-kselftest next branch. I'm happy to respin the serie
> on top of next branch if you're willing to take them.
>
Yeah. I knew your series won't apply on top of linux-kselftest next just
looking at that patches. Hence the question whether or not these problems
have been reproduced on linux-kselftest.
Please redo the patches. The net patch needs to be done on top of
SeongJae Park's fix
selftest/net/Makefile: Specify output with $(OUTPUT)
btw - with the the above fix, I don't see any failures on x86_64.
I am curious why it fails in cross-build? Could you figure out if
your cross-build environment is good.
thanks,
-- Shuah
thanks,
-- Shuah
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/1] selftests: timers: use LDLIBS instead of LDFLAGS to link against libpthread
2017-06-28 15:11 ` Shuah Khan
@ 2017-06-28 15:56 ` Fathi Boudra
2017-06-28 16:04 ` Denys Dmytriyenko
0 siblings, 1 reply; 8+ messages in thread
From: Fathi Boudra @ 2017-06-28 15:56 UTC (permalink / raw)
To: Shuah Khan; +Cc: linux-kselftest, linux-kernel, John Stultz, Denys Dmytriyenko
On 28 June 2017 at 18:11, Shuah Khan <shuah@kernel.org> wrote:
> On 06/28/2017 09:00 AM, Fathi Boudra wrote:
>> On 28 June 2017 at 17:41, Shuah Khan <shuah@kernel.org> wrote:
>>> On 06/28/2017 08:37 AM, Fathi Boudra wrote:
>>>> On 28 June 2017 at 17:20, Shuah Khan <shuah@kernel.org> wrote:
>>>>> On 06/28/2017 03:18 AM, Fathi Boudra wrote:
>>>>>> timers test fails to build due to undefined reference:
>>>>>>
>>>>>> aarch64-linaro-linux-gcc --sysroot=/build/tmp-rpb-glibc/sysroots/hikey
>>>>>> -O2 -pipe -g -feliminate-unused-debug-types -O3 -Wl,-no-as-needed -Wall
>>>>>> -DKTEST -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -lrt -lpthread
>>>>>> posix_timers.c
>>>>>> -o /build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers
>>>>>> /tmp/cc1FTZzT.o: In function `check_timer_create':
>>>>>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers.c:157:
>>>>>> undefined reference to `timer_create'
>>>>>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers.c:170:
>>>>>> undefined reference to `timer_settime'
>>>>>> collect2: error: ld returned 1 exit status
>>>>>>
>>>>>> Use LDLIBS instead of LDFLAGS to properly link against libpthread and fix
>>>>>> this build issue.
>>>>>>
>>>>>> Signed-off-by: Denys Dmytriyenko <denys@ti.com>
>>>>>> Signed-off-by: Fathi Boudra <fathi.boudra@linaro.org>
>>>>>
>>>>> I can't reproduce this on linux-kselftest next on x86_64. Is this arm64 speocific
>>>>> problem? Please try this on linux-kselftest latest.
>>>>
>>>> yes, I tried linux-kselftest next and can reproduce.
>>>> Maybe related to native build vs cross-build?
>>>> I don't think it's arm64 specific.
>>>>
>>>
>>> Can you confirm that this change doesn't cause problems in native
>>> build environments.
>>
>> yes, I tested on x86 in native build environment as well. It builds
>> and run fine.
>>
>> I noticed my patchset for LDFLAGS vs LDLIBS changes don't apply
>> cleanly on linux-kselftest next branch. I'm happy to respin the serie
>> on top of next branch if you're willing to take them.
>>
>
> Yeah. I knew your series won't apply on top of linux-kselftest next just
> looking at that patches. Hence the question whether or not these problems
> have been reproduced on linux-kselftest.
>
> Please redo the patches. The net patch needs to be done on top of
>
> SeongJae Park's fix
>
> selftest/net/Makefile: Specify output with $(OUTPUT)
>
> btw - with the the above fix, I don't see any failures on x86_64.
> I am curious why it fails in cross-build? Could you figure out if
> your cross-build environment is good.
I'm using openembedded to cross-build a full distro, not only kselftest.
I'm confident my cross-build environment is good.
The issue encountered is the same as
https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git/commit/?h=next&id=dc816e5d84cbc28baf776799839a632d6002236f
Using LDFLAGS vs LDLIBS affects the ordering of the linker flags.
* with LDFLAGS
aarch64-linux-gnu-gcc -lrt -lpthread posix_timers.c -o posix_timers
* with LDLIBS
aarch64-linux-gnu-gcc posix_timers.c -lrt -lpthread -o posix_timers
> thanks,
> -- Shuah
>
> thanks,
> -- Shuah
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/1] selftests: timers: use LDLIBS instead of LDFLAGS to link against libpthread
2017-06-28 15:56 ` Fathi Boudra
@ 2017-06-28 16:04 ` Denys Dmytriyenko
0 siblings, 0 replies; 8+ messages in thread
From: Denys Dmytriyenko @ 2017-06-28 16:04 UTC (permalink / raw)
To: Fathi Boudra; +Cc: Shuah Khan, linux-kselftest, linux-kernel, John Stultz
On Wed, Jun 28, 2017 at 06:56:30PM +0300, Fathi Boudra wrote:
> On 28 June 2017 at 18:11, Shuah Khan <shuah@kernel.org> wrote:
> > On 06/28/2017 09:00 AM, Fathi Boudra wrote:
> >> On 28 June 2017 at 17:41, Shuah Khan <shuah@kernel.org> wrote:
> >>> On 06/28/2017 08:37 AM, Fathi Boudra wrote:
> >>>> On 28 June 2017 at 17:20, Shuah Khan <shuah@kernel.org> wrote:
> >>>>> On 06/28/2017 03:18 AM, Fathi Boudra wrote:
> >>>>>> timers test fails to build due to undefined reference:
> >>>>>>
> >>>>>> aarch64-linaro-linux-gcc --sysroot=/build/tmp-rpb-glibc/sysroots/hikey
> >>>>>> -O2 -pipe -g -feliminate-unused-debug-types -O3 -Wl,-no-as-needed -Wall
> >>>>>> -DKTEST -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -lrt -lpthread
> >>>>>> posix_timers.c
> >>>>>> -o /build/tmp-rpb-glibc/work/hikey-linaro-linux/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers
> >>>>>> /tmp/cc1FTZzT.o: In function `check_timer_create':
> >>>>>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers.c:157:
> >>>>>> undefined reference to `timer_create'
> >>>>>> /usr/src/debug/kselftests/4.12-r0/linux-4.12-rc7/tools/testing/selftests/timers/posix_timers.c:170:
> >>>>>> undefined reference to `timer_settime'
> >>>>>> collect2: error: ld returned 1 exit status
> >>>>>>
> >>>>>> Use LDLIBS instead of LDFLAGS to properly link against libpthread and fix
> >>>>>> this build issue.
> >>>>>>
> >>>>>> Signed-off-by: Denys Dmytriyenko <denys@ti.com>
> >>>>>> Signed-off-by: Fathi Boudra <fathi.boudra@linaro.org>
> >>>>>
> >>>>> I can't reproduce this on linux-kselftest next on x86_64. Is this arm64 speocific
> >>>>> problem? Please try this on linux-kselftest latest.
> >>>>
> >>>> yes, I tried linux-kselftest next and can reproduce.
> >>>> Maybe related to native build vs cross-build?
> >>>> I don't think it's arm64 specific.
> >>>>
> >>>
> >>> Can you confirm that this change doesn't cause problems in native
> >>> build environments.
> >>
> >> yes, I tested on x86 in native build environment as well. It builds
> >> and run fine.
> >>
> >> I noticed my patchset for LDFLAGS vs LDLIBS changes don't apply
> >> cleanly on linux-kselftest next branch. I'm happy to respin the serie
> >> on top of next branch if you're willing to take them.
> >>
> >
> > Yeah. I knew your series won't apply on top of linux-kselftest next just
> > looking at that patches. Hence the question whether or not these problems
> > have been reproduced on linux-kselftest.
> >
> > Please redo the patches. The net patch needs to be done on top of
> >
> > SeongJae Park's fix
> >
> > selftest/net/Makefile: Specify output with $(OUTPUT)
> >
> > btw - with the the above fix, I don't see any failures on x86_64.
> > I am curious why it fails in cross-build? Could you figure out if
> > your cross-build environment is good.
>
> I'm using openembedded to cross-build a full distro, not only kselftest.
> I'm confident my cross-build environment is good.
>
> The issue encountered is the same as
> https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git/commit/?h=next&id=dc816e5d84cbc28baf776799839a632d6002236f
>
> Using LDFLAGS vs LDLIBS affects the ordering of the linker flags.
> * with LDFLAGS
> aarch64-linux-gnu-gcc -lrt -lpthread posix_timers.c -o posix_timers
> * with LDLIBS
> aarch64-linux-gnu-gcc posix_timers.c -lrt -lpthread -o posix_timers
It's GNU Make and linker specific, not cross vs. native.
The default Makefile rule looks like:
$(CC) $(CFLAGS) $(LDFLAGS) $@ $^ $(LDLIBS)
When linking is done by gcc itself, no issue, but when it needs to be passed
to proper ld, only LDLIBS follows and then ld cannot know what libs to link
with.
More detail:
https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html
LDFLAGS
Extra flags to give to compilers when they are supposed to invoke the linker,
‘ld’, such as -L. Libraries (-lfoo) should be added to the LDLIBS variable
instead.
LDLIBS
Library flags or names given to compilers when they are supposed to invoke the
linker, ‘ld’. LOADLIBES is a deprecated (but still supported) alternative to
LDLIBS. Non-library linker flags, such as -L, should go in the LDFLAGS
variable.
https://lkml.org/lkml/2010/2/10/362
tools/perf: libraries must come after objects
Link order matters, especially now since distributions are
using -Wl,--as-needed.
--
Denys
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2017-06-28 16:05 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-28 9:18 [PATCH 1/1] selftests: timers: use LDLIBS instead of LDFLAGS to link against libpthread Fathi Boudra
2017-06-28 14:20 ` Shuah Khan
2017-06-28 14:37 ` Fathi Boudra
2017-06-28 14:41 ` Shuah Khan
2017-06-28 15:00 ` Fathi Boudra
2017-06-28 15:11 ` Shuah Khan
2017-06-28 15:56 ` Fathi Boudra
2017-06-28 16:04 ` Denys Dmytriyenko
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.