On Sat, Aug 27, 2022 at 12:15 PM Shane <skullrat...@gmail.com> wrote:
>
> My understanding then is that cmd/dist first builds for the host here (in my 
> case, for Linux) and then builds for the target starting here. Since there is 
> always a build for the host first, then since my host OS is Linux, the 
> linux_syscall.c is always part of the compilation (since I do not disable 
> cgo). If anything is incorrect with my understanding, please correct me.
>
> I believe then I need to have both Linux system headers and Solaris system 
> headers available on my build machine for the cross-compile, if I want to 
> build Go for Solaris with cgo support.
>
> Is it possible for there to be two header files with the same name but 
> different OS have the same #include path in the cgo source code? If so, could 
> the C compiler get the correct header for the target of the cgo? For example, 
> how could the C compiler know to use the Linux unistd.h header for the Linux 
> build, and later use the Solaris unistd.h header for the Solaris build?

I'm not sure whether this answers your question, but normally a system
will have a native compiler that will look for header files in
/usr/include.  It can also have a cross-compiler that looks for header
files in some other location.  A cross-compiler should never look in
/usr/include, it should only look at the cross-compilation 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/CAOyqgcWgft7wLnAC-AOTePFve33zpz0%2Bugm%2Birk42XFhPpceDw%40mail.gmail.com.

Reply via email to