On Sun, Sep 6, 2020 at 1:53 PM 'Hubert Hirtz' via golang-nuts
<golang-nuts@googlegroups.com> wrote:
>
> I am trying to cross-compile a project that depends on sqlite3 on a
> amd64 machine (host) for an armhf machine (target), using clang with the
> appropriate "--target" flag.
>
> The build fails on runtime/cgo with the following errors:
>
> ```
> # runtime/cgo
> In file included from gcc_libinit.c:8:
> /usr/include/pthread.h:672:6: error: 'regparm' is not valid on this platform
> /usr/include/bits/pthreadtypes-arch.h:52:50: note: expanded from macro
> '__cleanup_fct_attribute'
> In file included from gcc_libinit.c:8:
> /usr/include/pthread.h:684:3: error: 'regparm' is not valid on this platform
> /usr/include/bits/pthreadtypes-arch.h:52:50: note: expanded from macro
> '__cleanup_fct_attribute'
> In file included from gcc_libinit.c:8:
> /usr/include/pthread.h:725:6: error: 'regparm' is not valid on this platform
> /usr/include/bits/pthreadtypes-arch.h:52:50: note: expanded from macro
> '__cleanup_fct_attribute'
> ```
>
> Here is the `go env` and the full build output (run with `-x`):
> <https://paste.sr.ht/~taiite/b6b47c78cc399d41b398f1076f55a5a1cc75526e>
>
> Do you have any idea why it fails or if I missed something?

In order to cross-compile a Go program that uses cgo, you need a
complete C cross-compiler.  In this case your C cross-compiler appears
to be using the native header files, which can't work.  It needs to
use the cross-compiler header files.

Ian

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcUf-oJQGRcs%3D_kwVRATD4%2B6jRS1hsJUZdPu%2BnznKYLHRA%40mail.gmail.com.

Reply via email to