Revision of RelocatableHOWTOforMinGW from 2009, May 17 - 19:00

Printer-friendly version

HOWTO Understanding effects of build directory options on a relocatable MinGW GCC default's paths

Summury and purpose of this document

There are some things which are still marked as TODO is in this. This gonna be done later.

Target of this document: trying to better understand the effect of build time options on the resulting GCC's defaults paths. The best wish which this test try to get is to have a multi-arch singled-versioned and relocatable installation directory. Comments and analysies given in this document, all goes to this direction. This document may not fullfill expectations from peoples with other wishes.

The document is divided into two main parts: tests at build time and tests with a relocated installation directory (the bigest part).

Tests at build time

The build was done with the following options:

Script variables:

  • mypkgname=....
  • name=gcc
  • package=gcc-4.2.1-2
  • build=i386-mingw32
  • host=i386-mingw32
  • target=i386-mingw32
  • prefix=/<my-msys-personal-home-dir>/$name
  • temp=$name

Options:

  • --with-pkgversion=$mypkgname
  • --build=$build
  • --host=$host
  • --target=$target
  • --prefix=$prefix
  • --with-sysroot=$prefix/$target/test1
  • --with-local-prefix=$prefix/$target/test2
  • --with-build-sysroot=$prefix/$target/test3
  • --disable-rpath
  • --disable-version-specific-runtime-libs
  • --enable-languages=c
  • --enable-libada
  • --enable-threads
  • --disable-shared
  • --disable-sjlj-exceptions
  • --disable-win32-registry
  • --enable-nls
  • --disable-bootstrap
  • --with-gnu-gcc
  • --with-gnu-as
  • --with-gnu-ld
  • --with-stabs

Comments

Do not forget:

  • Sysroot is set to /<install-dir>/<arch>/test1
  • Local prefix is set to /<install-dir>/<arch>/test2
  • Build sysroot is set to /<install-dir>/<arch>/test3

A native compiler will be built the same way as if it was a cross compiler, to have a cleaner installation (each arch beside of each others, even the native one).

You will see theses test1, test2, test3 in some paths list later. Do not forget what it is standing for (see above).

The build was started frm a build directory beside the source directory, with an installation directory bside the two laters, the a make and a make install was runned. The installation directory initially only contains <arch> and <arch>/test1 and <arch>/test2 and <arch>/test3.

Some thing was then deduced from error messages during the build process.

The build process expect a mingw/include in <install-dir>/<arch>/test3 (the build sysroot directory). It has complained with this message :

> The directory that should contain system headers does not exist:
> /<install-dir>/<arch>/test3/mingw/include

This mingw/include directory is mandatory during the build process, but it may be empty (the build process can terminates normally with an empty mingw/include).

The build process obviously complains about missing includes. Some test were done to list all directory where theses includes may be found.

Includes search when configuring gcc during the build process:

  • Not searched in /<install-dir>/<arch>/test1/include (sysroot/include)
  • Not searched in /<install-dir>/<arch>/test2/include (localprefix/include)
  • Searched in prefix/<arch>/include
  • Searched in /<install-dir>/<arch>/test3/mingw/include (buildsysroot/mingw/include)
  • Searched in /<install-dir>/<arch>/test3/include (buildsysroot/include)

Comments

The <install-dir> did not contained any libs. The build still terminates normally.

Tests on a relocated installation directory (get and drop anywhere)

Next, <install-dir> is renamed into an <reloc-dir>, to test how install relocation works.

The resulting gcc, after relocation, use the following default paths:

  • Install:
    • <install-dir>/lib/gcc/<arch>/<version>/
  • Programs:
    • <reloc-dir>/libexec/gcc/<arch>/<version>/
    • <reloc-dir>/libexec/gcc/
    • <install-dir>/libexec/gcc/<arch>/<version>/
    • <install-dir>/libexec/gcc/<arch>/<version>/
    • <install-dir>/libexec/gcc/<arch>/
    • <install-dir>/lib/gcc/<arch>/<version>/
    • <install-dir>/lib/gcc/<arch>/
    • /usr/libexec/gcc/<arch>/<version>/
    • /usr/libexec/gcc/<arch>/
    • /usr/lib/gcc/<arch>/<version>/
    • /usr/lib/gcc/<arch>/
    • <reloc-dir>/<arch>/bin/<arch>/<version>/
    • <reloc-dir>/<arch>/bin/
    • <install-dir>/<arch>/bin/<arch>/<version>/
    • <install-dir>/<arch>/bin/
  • Libraries:
    • <reloc-dir>/lib/gcc/<arch>/<version>/
    • <reloc-dir>/lib/gcc/
    • <install-dir>/lib/gcc/<arch>/<version>/
    • /usr/lib/gcc/<arch>/<version>/
    • <reloc-dir>/<arch>/lib/<arch>/<version>/
    • <reloc-dir>/<arch>/lib/
    • <install-dir>/<arch>/lib/<arch>/<version>/
    • <install-dir>/<arch>/lib/
    • <reloc-dir>/lib/<arch>/<version>/
    • <reloc-dir>/lib/
    • <install-dir>/lib/<arch>/<version>/
    • <install-dir>/lib/
    • <reloc-dir>/<arch>/test1/mingw/lib/<arch>/<version>/
    • <reloc-dir>/<arch>/test1/mingw/lib/
  • Includes:
    • <reloc-dir>/<arch>/test1<install-dir>/include
    • <install-dir>/lib/gcc/<arch>/<version>/include
    • <install-dir>/<arch>/include
    • <reloc-dir>/<arch>/test1/mingw/include
    • <reloc-dir>/lib/gcc/<arch>/<version>/include

Comments

Note: this list was obtained with “./gcc --print-search-dirs and” “./gcc -v -c test.c”, after reformating and canonicalization of path, followed by some symbolic substitutions.

Suspected bug: Did you notice the first include path ? It seems there is a bug here. Two absolute path are appended. I've meet it every time during all the teste I've made. I've also found some buggy path concatenation in some Configure.log files.

Note: some paths were printed with “/” as the path separator while some other was printed with “\” as the path separator. I've substitued all with “/” as MinGW GCC accept both.

Notice that <arch>/include only exist with the <install-dir> prefix. This may be a trouble (see later).

In the purpose of a relocatable installation, the list may be reduced to:

  • Programs:
    • <reloc-dir>/libexec/gcc/<arch>/<version>/
    • <reloc-dir>/libexec/gcc/
    • <reloc-dir>/<arch>/bin/<arch>/<version>/
    • <reloc-dir>/<arch>/bin/
  • Libraries:
    • <reloc-dir>/lib/gcc/<arch>/<version>/
    • <reloc-dir>/lib/gcc/
    • <reloc-dir>/<arch>/lib/<arch>/<version>/
    • <reloc-dir>/<arch>/lib/
    • <reloc-dir>/lib/<arch>/<version>/
    • <reloc-dir>/lib/
    • <reloc-dir>/<arch>/test1/mingw/lib/<arch>/<version>/
    • <reloc-dir>/<arch>/test1/mingw/lib/
  • Includes:
    • <reloc-dir>/<arch>/test1/mingw/include
    • <reloc-dir>/lib/gcc/<arch>/<version>/include

Comments

Note: this list is obtained removing all path starting with <install-dir> and path which are POSIX paths (ex. “/usr/libexec”), thus keeping only paths starting with <reloc-dir>. The first include buggy path was removed too.

In the purpose to have a clean single versioned relocatable installation, the list may be reduced again to:

  • Programs:
    • <reloc-dir>/libexec/gcc/
    • <reloc-dir>/<arch>/bin/
  • Libraries:
    • <reloc-dir>/lib/gcc/
    • <reloc-dir>/<arch>/lib/
    • <reloc-dir>/lib/
    • <reloc-dir>/<arch>/test1/mingw/lib/
  • Includes:
    • <reloc-dir>/<arch>/test1/mingw/include

Comments

Note: this list was obtained removing all path containing <version>.

In the purpose of a multi-arch single versioned and relocatable installation, we notice there gonna be a trouble with the default include paths : it only looks in <reloc-dir>/<arch>/test1/mingw/include.

The favorite path for programs would probably be <reloc-dir>/<arch>/bin/, the favorite path for libs would probably be <reloc-dir>/lib/ and <reloc-dir>/<arch>/lib/. There are no good candidates for includes (an <arch>/include would be nice).

A special specs file may be needed to workaround the default include paths problem (this is still TODO).

TODOs

TODO: a workaround for the default include paths (probably using the specs file)

TODO: run the same test and the same analysies with some others

  • --with-sysroot=...
  • --with-local-prefix=...
  • --with-build-sysroot=...

The first one to do should be using the <arch> path for with-sysroot and with--build-sysroot.

TODO: run the same test and the analysies without a setting for --with-build-sysroot.

--~~~~

Site Status

Site maintenance performed successfully, site online Dec 13th 12:00 AM Eastern.