cross-compile with uClibc toolchain #13

Closed
wbx-github opened this Issue Jun 28, 2014 · 5 comments

Comments

Projects
None yet
4 participants
Contributor

wbx-github commented Jun 28, 2014

Hi,

I get a compile error when cross-compiling with a uClibc based toolchain.
Buildroot has a fix included, which works for me.
Any idea why it is not yet included?

--- ltp-full-20140422.orig/testcases/realtime/lib/libstats.c 2014-04-23 10:37:00.000000000 +0200
+++ ltp-full-20140422/testcases/realtime/lib/libstats.c 2014-06-27 10:55:59.401744516 +0200
@@ -46,6 +46,11 @@
#include <libstats.h>
#include <librttest.h>

+#ifdef UCLIBC
+/* 10^x = 10^(log e^x) = (e^x)^log10 = e^(x * log 10) /
+#define exp10(x) (exp((x) * log(10)))
+#endif /
UCLIBC */
+
int save_stats = 0;

/* static helper functions */

best regards
Waldemar

Owner

metan-ucw commented Jul 2, 2014

Well it's not included in LTP because nobody has tried to upstream it.

Looking at manual pages, the exp10() is a GNU extension, so better solution would be:

  • Adding configure check for exp10() function
  • Defining it only when it's not available

Also prefered place to send LTP patches is mailing list at ltp-list@lists.sourceforge.net.

Owner

vapier commented Jul 5, 2014

might also be useful to add this define to uClibc itself. not that it'd preclude doing what Cyril described.

Member

ngie-eign commented Jul 9, 2014

+1

@metan-ucw metan-ucw closed this in 0ec088f Jul 15, 2014

Contributor

wbx-github commented Sep 1, 2014

Hi,

Today I updated to latest release which includes the new exp10 check.
Unfortunately it does not work for me.
The config.log contains:
configure:5051: checking for exp10
configure:5067: /home/wbx/adk/toolchain_qemu-sparc_uclibc_sparc/usr/bin/sparc-openadk-linux-uclibc-gcc -o conftest -mcpu=v8 -fwrapv -fno-ident -fhonour-copts -Os -pipe -g3 -fomit-frame-pointer -fno-unwind-tables -fno-asynchronous-unwind-tables -DNDEBUG -L/home/wbx/adk/target_qemu-sparc_uclibc_sparc/lib -L/home/wbx/adk/target_qemu-sparc_uclibc_sparc/usr/lib -Wl,-O1 -Wl,-rpath -Wl,/usr/lib -Wl,-rpath-link -Wl,/home/wbx/adk/target_qemu-sparc_uclibc_sparc/usr/lib conftest.c >&5
conftest.c: In function 'main':
conftest.c:31:14: warning: incompatible implicit declaration of built-in function 'exp10' [enabled by default]
exp10(0.00);
^
configure:5067: $? = 0
configure:5069: result: yes

The check succeeds, because the gcc exp10 builtin function is used. Later then I get a linking error.
Is it possible to add -fno-builtin just for the test? (I have added it globally for my build right now)

best regards
Waldemar

Owner

vapier commented Sep 2, 2014

we try to make tests w/out specific flags. you could also solve it by utilizing an external variable.

int main(int argc, char *argv[]) { return exp10((float)argc); }

see if that works on your side.

jstancek added a commit that referenced this issue May 22, 2017

pipeio: avoid SAFE macros in cleanup()
Only newlib testcases support SAFE macros in cleanup().
When SAFE_UNLINK fails, it creates infinite loop between
tst_brk_ and cleanup:

 #0  tst_res__ at tst_res.c:153
 #1  0x0000000000407ba8 in tst_brk__ at tst_res.c:480
 #2  0x00000000004081fe in tst_brkm_ at tst_res.c:577
 #3  0x000000000040a7c9 in safe_unlink at safe_macros.c:358
 #4  0x0000000000404abd in cleanup () at pipeio.c:497
 #5  0x0000000000407bc7 in tst_brk__ at tst_res.c:498
 #6  0x00000000004081fe in tst_brkm_ at tst_res.c:577
 #7  0x000000000040c1d6 in def_handler at tst_sig.c:231
 #8  <signal handler called>
 #9  0x00007f29c2cbd1f7 in __GI_raise at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
 #10 0x00007f29c2cbe8e8 in __GI_abort () at abort.c:90
 #11 0x00000000004081af in tst_brkm_ at tst_res.c:581
 #12 0x000000000040a7c9 in safe_unlink at safe_macros.c:358
 #13 0x0000000000404abd in cleanup () at pipeio.c:497
 #14 0x0000000000407bc7 in tst_brk__ at tst_res.c:498
 #15 0x00000000004081fe in tst_brkm_ at tst_res.c:577
 #16 0x000000000040c1d6 in def_handler at tst_sig.c:231
 #17 <signal handler called>
 #18 0x00007f29c2cbd1f7 in __GI_raise at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
 #19 0x00007f29c2cbe8e8 in __GI_abort () at abort.c:90
 #20 0x00000000004081af in tst_brkm_ at tst_res.c:581
 #21 0x000000000040a7c9 in safe_unlink at safe_macros.c:358
 #22 0x0000000000404abd in cleanup () at pipeio.c:497
 ...

Signed-off-by: Jan Stancek <jstancek@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment