Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

gcc-4.7.1-6 missing stubs-soft.h on hard-float systems, clang-3.1.4 wants it #255

Closed
krovetz opened this Issue · 9 comments

2 participants

@krovetz

On any hard-float system, when I install both gcc and clang, clang won't work because /usr/include/gnu/stubs-soft.h is missing.

clang -mfpu=vfp -mfloat-abi=hard test.c
In file included from test.c:1:
In file included from /usr/include/stdio.h:27:
In file included from /usr/include/features.h:399:
/usr/include/gnu/stubs.h:7:11: fatal error: 'gnu/stubs-soft.h' file not found
# include <gnu/stubs-soft.h>
          ^
1 error generated.

/usr/include/gnu/stubs-hard.h is installed because we are on a hard-float system, but /usr/include/gnu/stubs.h has the following compile time macro

#if !defined __ARM_PCS_VFP
# include <gnu/stubs-soft.h>
#endif
#if defined __ARM_PCS_VFP
# include <gnu/stubs-hard.h>
#endif

__ARM_PCS_VFP must not be defined under clang, because compiling with clang fails when it can't find stubs-soft.h.

I work around the issue by doing the following, which appears to do no harm.

ln -s /usr/include/gnu/stubs-hard.h /usr/include/gnu/stubs-soft.h

Looks like a clang bug, but I thought I'd let you all know, in case you wanted to add the link to make things work.

@kmihelich
Owner

What if you -D__ARM_PCS_VFP in your command? I'm not sure if there's a way for us to tell clang to always include that definition by default, you're welcome to have a look into the build procedures and see though. This seems like something that should be happening in clang without us having to hack around it.

@krovetz

As suspected, that does fix the problem.

I just submitted this as a bug over at clang's bugzilla, too.

@kmihelich
Owner

You'd think specifying -mfloat-abi=hard would trigger something. We can leave this open for a while to check back on the situation, or just close and wait for them to see what the problem is.

@kmihelich
Owner

@krovetz any news on the bug you filed?

@krovetz
@kmihelich
Owner

@krovetz llvm 3.2 is in the repos now, see if that fixes this.

@krovetz

I went to check if this was fixed and found a couple of issues.

1) When I updated my raspberry pi to the latest toolchain, clang broke entirely.

pi> clang -v
clang: error while loading shared libraries: libLLVM-3.2.so: cannot open shared object file: No such file or directory
pi> ls /lib/llvm/libLLVM-3.2.so
/lib/llvm/libLLVM-3.2.so

2) I just did a fresh install on an NSA-320 and then installed gcc and clang. clang was unable to compile a hello world program, even though gcc could.

[krovetz@alarm ~]$ gcc -march=armv5te hello.c 
[krovetz@alarm ~]$ ./a.out
Hello world!
[krovetz@alarm ~]$ clang -march=armv5te hello.c
In file included from hello.c:1:
/usr/include/stdio.h:388:32: error: 'format' attribute parameter 2 is out of
      bounds
     __THROWNL __attribute__ ((__format__ (__printf__, 3, 4)));
                               ^                       ~
/usr/include/stdio.h:392:32: error: 'format' attribute parameter 2 is out of
      bounds
     __THROWNL __attribute__ ((__format__ (__printf__, 3, 0)));
                               ^                       ~
/usr/include/stdio.h:414:22: error: 'format' attribute parameter 2 is out of
      bounds
     __attribute__ ((__format__ (__printf__, 2, 0)));
                     ^                       ~
/usr/include/stdio.h:416:22: error: 'format' attribute parameter 2 is out of
      bounds
     __attribute__ ((__format__ (__printf__, 2, 3)));
                     ^                       ~
/usr/include/stdio.h:473:22: error: 'format' attribute parameter 2 is out of
      bounds
     __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
                     ^                      ~
/usr/include/stdio.h:480:22: error: 'format' attribute parameter 2 is out of
      bounds
     __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
                     ^                      ~
/usr/include/stdio.h:485:30: error: 'format' attribute parameter 2 is out of
      bounds
     __THROW __attribute__ ((__format__ (__scanf__, 2, 0)));
                             ^                      ~
/usr/include/stdio.h:498:22: error: 'format' attribute parameter 2 is out of
      bounds
     __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
                     ^                      ~
/usr/include/stdio.h:501:22: error: 'format' attribute parameter 2 is out of
      bounds
     __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
                     ^                      ~
/usr/include/stdio.h:506:22: error: 'format' attribute parameter 2 is out of
      bounds
     __attribute__ ((__format__ (__scanf__, 2, 0)));
                     ^                      ~
10 errors generated.
@kmihelich
Owner

For the first error, it's already a known issue with the hardfloat toolchain components and ld.so.cache problem. There are glibc devs looking into what's causing it.

v5 should be good, though I'd have to look into that error.

@kmihelich kmihelich closed this
@krovetz

Yes. All works now. Thanks.

A recent fresh install onto a cubieboard has perfectly working gcc and clang.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.