[LLVMdev] help with an error message using clang ?

809 views
Skip to first unread message

Christine Cheng

unread,
Sep 16, 2011, 7:40:11 PM9/16/11
to LLV...@cs.uiuc.edu
Hi,

I am new to LLVM and clang and I would like to seek some professional help. :)

I have been trying to compile some C code on a linux x86 computer for a Sparc machine.

I used:

 clang -ccc-host-triple sparc-unknown-linux -ccc-clang-archs sparc -pthreads -lm  -emit-llvm test.c -c -o -test.bc

The following error messages are produced:

/usr/include/pthread.h:665:6: error: 'regparm' is not valid on this platform
     __cleanup_fct_attribute;
     ^~~~~~~~~~~~~~~~~~~~~~~
In file included from TEST.C:46:
In file included from /usr/include/stdlib.h:320:
In file included from /usr/include/sys/types.h:271:
/usr/include/bits/pthreadtypes.h:222:50: note: instantiated from:
# define __cleanup_fct_attribute __attribute__ ((__regparm__ (1)))
                                                 ^            ~
In file included from TEST.C:65:
/usr/include/pthread.h:677:3: error: 'regparm' is not valid on this platform
  __cleanup_fct_attribute;
  ^~~~~~~~~~~~~~~~~~~~~~~
In file included from TEST.C:46:
In file included from /usr/include/stdlib.h:320:
In file included from /usr/include/sys/types.h:271:
/usr/include/bits/pthreadtypes.h:222:50: note: instantiated from:
# define __cleanup_fct_attribute __attribute__ ((__regparm__ (1)))
                                                 ^            ~
In file included from TEST.C:65:
/usr/include/pthread.h:718:6: error: 'regparm' is not valid on this platform
     __cleanup_fct_attribute __attribute__ ((__noreturn__))
     ^~~~~~~~~~~~~~~~~~~~~~~

What causes the errors and how can I fix it?

Thanks a lot and have a nice weekend!

Best,
Christine

Jim Grosbach

unread,
Sep 16, 2011, 7:47:07 PM9/16/11
to Christine Cheng, LLV...@cs.uiuc.edu

On Sep 16, 2011, at 4:40 PM, Christine Cheng wrote:

> Hi,
>
> I am new to LLVM and clang and I would like to seek some professional help. :)
>
> I have been trying to compile some C code on a linux x86 computer for a Sparc machine.
>
> I used:
>
> clang -ccc-host-triple sparc-unknown-linux -ccc-clang-archs sparc -pthreads -lm -emit-llvm test.c -c -o -test.bc
>
> The following error messages are produced:
>
> /usr/include/pthread.h:665:6: error: 'regparm' is not valid on this platform
> __cleanup_fct_attribute;
> ^~~~~~~~~~~~~~~~~~~~~~~
> In file included from TEST.C:46:
> In file included from /usr/include/stdlib.h:320:
> In file included from /usr/include/sys/types.h:271:
> /usr/include/bits/pthreadtypes.h:222:50: note: instantiated from:
> # define __cleanup_fct_attribute __attribute__ ((__regparm__ (1)))
> ^ ~
> In file included from TEST.C:65:
> /usr/include/pthread.h:677:3: error: 'regparm' is not valid on this platform
> __cleanup_fct_attribute;
> ^~~~~~~~~~~~~~~~~~~~~~~
> In file included from TEST.C:46:
> In file included from /usr/include/stdlib.h:320:
> In file included from /usr/include/sys/types.h:271:

The files in /usr/include are extremely unlikely to be the right ones. You need a Sparc standard library, not an x86 one like will be installed in /usr.


> /usr/include/bits/pthreadtypes.h:222:50: note: instantiated from:
> # define __cleanup_fct_attribute __attribute__ ((__regparm__ (1)))
> ^ ~
> In file included from TEST.C:65:
> /usr/include/pthread.h:718:6: error: 'regparm' is not valid on this platform
> __cleanup_fct_attribute __attribute__ ((__noreturn__))
> ^~~~~~~~~~~~~~~~~~~~~~~
>
> What causes the errors and how can I fix it?
>
> Thanks a lot and have a nice weekend!
>
> Best,
> Christine

> _______________________________________________
> LLVM Developers mailing list
> LLV...@cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

_______________________________________________
LLVM Developers mailing list
LLV...@cs.uiuc.edu http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

Eli Friedman

unread,
Sep 16, 2011, 7:56:07 PM9/16/11
to Christine Cheng, LLV...@cs.uiuc.edu

You're using headers from your x86 machine to compile code for Sparc
(and possibly a different OS?); that doesn't work in general. You'll
need to somehow use headers from your target Sparc machine to make
things work properly; you can probably just copy them, and use
-nostdinc plus some -I flags to make clang use them.

-Eli

Christine Cheng

unread,
Sep 16, 2011, 8:13:22 PM9/16/11
to Eli Friedman, LLV...@cs.uiuc.edu
Hi Eli,

Thanks for the reply. Indeed there is solaris on the Sparc machine. I was told that it is quite difficult to install LLVM there so I am doing what I am doing. Is there a way for me to get headers from the target Sparc machine without installing LLVM there?

Best,
Christine

Eli Friedman

unread,
Sep 16, 2011, 8:29:25 PM9/16/11
to Christine Cheng, LLV...@cs.uiuc.edu
On Fri, Sep 16, 2011 at 5:13 PM, Christine Cheng <clc...@stanford.edu> wrote:
> Hi Eli,
>
> Thanks for the reply. Indeed there is solaris on the Sparc machine. I was
> told that it is quite difficult to install LLVM there so I am doing what I
> am doing. Is there a way for me to get headers from the target Sparc machine
> without installing LLVM there?

You should be able to just rsync /usr/include/ from the Sparc machine.

Reply all
Reply to author
Forward
0 new messages