This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Cannot build OpenBSD hosted mingw32 targeted cross compiller. Looking for help.


Nedko Arnaudov <nedko.arnaudov@atia.com> wrote:

> I'm trying to build (on OpenBSD), compiler that runs on OpenBSD and
> produces mingw32 (win32) code. Target and host are both i386. I've used
> http://www.libsdl.org/extras/win32/cross/build-cross.sh to do
> things. Script seems to be tested by author on linux system so I suppose
> that problem is related to OpenBSD host rather than mingw target.

<snip>

>  /home/nedko/cross-tools/i386-mingw32/include
>  /home/nedko/cross-tools/i386-mingw32/sys-include
> End of search list.

 Ok, the GCC-build searches the MinGW-headers from these places
($prefix/$target/*include') and it is surprising that you didn't put them
there before starting to build GCC, as if you hadn't consulted your
fine GCC-manual (RTFM) and the build instructions for cross-GCCs
ever...  Also all the target libs must be preinstalled from the MinGW
runtime and w32api packages (into $prefix/$target/lib).

 That there are two places, one for the 'runtime' (standard 'posix') headers
and one for the w32api headers, shouldn't make things harder... You
might ask which one could be a better place for the 'system specific'
headers (w32api), but please don't ask this, just think what the 'sys-'
in the name could mean...

> I have sys/times.h in /usr/include but may be it is not the one that
> xgcc is looking for. Any help will be appreciated.

 You cannot use the host includes with any cross-GCC, maybe with
one for another kind of OpenBSD for x86, like for 'i686-openbsd' if
your host is 'i386-openbsd', but it is then quite the same target...

 The C headers are generally target-dependent, so a GCC for MinGW
uses MinGW-headers meanwhile a GCC for OpenBSD uses OpenBSD
headers. There COULD be common headers for them both and the
proper place for them could be the $local_prefix/include', as default
'/usr/local/include', or '$prefix/include'.  The $prefix is usually common
for all GCCs, so the last could be nice... The 1st place is not enabled
as default for cross-GCCs...

 Trying the command 'i386-mingw32-cpp -v' should tell the built-in
header search paths (when you have this installed, now the 'cpp' in
your $build/gcc is available for this purpose)...

 There is now a mess with the use of the '$prefix/$target/*include' dirs,
so the standard headers 'limits.h', 'stdlib.h' and 'unistd.h' must be seen
also in the 'sys-include', so please symlink them there before starting to
build your GCC. Please send your complaint about this issue to the 'gcc-bug'
maillist...  The de-facto standard is to use the 'include' for the standard
headers and the 'sys-include' for the system (specific) headers, but
somehow these two things have been mixed now, the name 'system
headers' has been used for the 'standard headers' in 'gcc/Makefile.in'
and elsewhere and therefore the current mess and the workaround.

 Here are the equivalents from the native world, these two directories
in a cross-GCC will usually make people mixed but seeing these docs
should help:

---------------------------------------- clip --------------------------------------------
SYSTEM_INCLUDE_DIR
Define this macro as a C string constant if you wish to specify a system-specific
directory to search for header files before the standard directory.
SYSTEM_INCLUDE_DIR comes before STANDARD_INCLUDE_DIR in the search 
order.

Cross compilers do not use this macro and do not search the directory
specified.

STANDARD_INCLUDE_DIR
Define this macro as a C string constant if you wish to override the standard
choice of `/usr/include' as the default prefix to try when searching for header
files.

Cross compilers do not use this macro and do not search either `/usr/include'
or its replacement.
---------------------------------------- clip --------------------------------------------

 It would sound sane that a native GCC for MinGW would have these both
defined and the runtime and w32api headers splitted into these suggested
directories. But unfortunately this isn't true, the latter has been redefined to
override the '/usr/include', but the first has no definition and directories
aimed for common use with many GCCs have been used for the MinGW-
specific headers... A mess there, but you have a possibility to be more
sane on OpenBSD.   BTW, there are targets like BeOS and Mach which
have also two kind of target headers and so have the first defined for
native GCCs...

Cheers, Kai


------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]