Hello all. I'm building cross-compiler with mingw-w64 with a goal to package them as debs using gcc 4.4.3 & stable binutils & trunk mingw-w64. I've build binutils, target system headers, make all-gcc, target runtime libs (mingw-w64-crt), and gcc again (make all) with those. All using --prefix=/usr and actually installing everything after each step. Works fine. Now instead of installing in the --prefix=/usr I want to install into DESTDIR=/home/me/something and continue with the build and only install into --prefix when I have finished installing everything. Well I set: --prefix=/usr --with-build-time-tools=/$(DESTDIR)/$(PREFIX)/$(TARGET)/bin --with-build-sysroot=$(DESTDIR) among other options just as host, enabled languages (c,c++,fortran) and etc. Well that fails on it's face =( first I did symlink /$(DESTDIR)/$(PREFIX)/$(TARGET)/ as $(GCC_SRCDIR)/windsup/mingw to get a few headers cause parts of the build where not picking them up from --with-build-sysroot. And after that linker fails with (even though I did --disable-multilib): make[2]: Entering directory `/home/dmitrij/src/mingw-w64/all-together/i686-w64-mingw32/gcc/i686-w64-mingw32/libgcc' # If this is the top-level multilib, build all the other # multilibs. # Early copyback; see "all" above for the rationale. The # early copy is necessary so that the gcc -B options find # the right startup files when linking shared libgcc. /bin/bash ../../../../gcc/libgcc/../mkinstalldirs ../.././gcc parts="crtbegin.o crtend.o crtfastmath.o"; \ for file in $parts; do \ rm -f ../.././gcc/$file; \ /usr/bin/install -c -m 644 $file ../.././gcc/; \ done # @multilib_flags@ is still needed because this may use # /home/dmitrij/src/mingw-w64/all-together/i686-w64-mingw32/gcc/./gcc/xgcc -B/home/dmitrij/src/mingw-w64/all-together/i686-w64-mingw32/gcc/./gcc/ -L/home/dmitrij/src/mingw-w64/all-together/i686-w64-mingw32/gcc/i686-w64-mingw32/winsup/mingw -L/home/dmitrij/src/mingw-w64/all-together/i686-w64-mingw32/gcc/i686-w64-mingw32/winsup/w32api/lib -isystem /home/dmitrij/src/mingw-w64/all-together/gcc/winsup/mingw/include -isystem /home/dmitrij/src/mingw-w64/all-together/gcc/winsup/w32api/include -B/usr/i686-w64-mingw32/bin/ -B/usr/i686-w64-mingw32/lib/ -isystem /usr/i686-w64-mingw32/include -isystem /usr/i686-w64-mingw32/sys-include and -O2 -I../../../gcc/gcc/../winsup/w32api/include -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual -Wold-style-definition -isystem ./include -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -Dinhibit_libc directly. # @multilib_dir@ is not really necessary, but sometimes it has # more uses than just a directory name. /bin/bash ../../../../gcc/libgcc/../mkinstalldirs . ln -s -f libgcc.map libgcc.map.def && if [ ! -d ./shlib ]; then mkdir ./shlib; else true; fi && /home/dmitrij/src/mingw-w64/all-together/i686-w64-mingw32/gcc/./gcc/xgcc -B/home/dmitrij/src/mingw-w64/all-together/i686-w64-mingw32/gcc/./gcc/ -L/home/dmitrij/src/mingw-w64/all-together/i686-w64-mingw32/gcc/i686-w64-mingw32/winsup/mingw -L/home/dmitrij/src/mingw-w64/all-together/i686-w64-mingw32/gcc/i686-w64-mingw32/winsup/w32api/lib -isystem /home/dmitrij/src/mingw-w64/all-together/gcc/winsup/mingw/include -isystem /home/dmitrij/src/mingw-w64/all-together/gcc/winsup/w32api/include -B/usr/i686-w64-mingw32/bin/ -B/usr/i686-w64-mingw32/lib/ -isystem /usr/i686-w64-mingw32/include -isystem /usr/i686-w64-mingw32/sys-include -O2 -I../../../gcc/gcc/../winsup/w32api/include -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual -Wold-style-definition -isystem ./include -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -Dinhibit_libc -shared -nodefaultlibs libgcc.map.def -Wl,--out-implib,./shlib/libgcc_s.a.tmp -o ./shlib/libgcc_s_sjlj-1.dll.tmp -g -O2 --sysroot=/home/dmitrij/src/mingw-w64/all-together/sysroot/i686-w64-mingw32 -B./ _chkstk_s.o _muldi3_s.o _negdi2_s.o _lshrdi3_s.o _ashldi3_s.o _ashrdi3_s.o _cmpdi2_s.o _ucmpdi2_s.o _clear_cache_s.o _enable_execute_stack_s.o _trampoline_s.o __main_s.o _absvsi2_s.o _absvdi2_s.o _addvsi3_s.o _addvdi3_s.o _subvsi3_s.o _subvdi3_s.o _mulvsi3_s.o _mulvdi3_s.o _negvsi2_s.o _negvdi2_s.o _ctors_s.o _ffssi2_s.o _ffsdi2_s.o _clz_s.o _clzsi2_s.o _clzdi2_s.o _ctzsi2_s.o _ctzdi2_s.o _popcount_tab_s.o _popcountsi2_s.o _popcountdi2_s.o _paritysi2_s.o _paritydi2_s.o _powisf2_s.o _powidf2_s.o _powixf2_s.o _powitf2_s.o _mulsc3_s.o _muldc3_s.o _mulxc3_s.o _multc3_s.o _divsc3_s.o _divdc3_s.o _divxc3_s.o _divtc3_s.o _bswapsi2_s.o _bswapdi2_s.o _fixunssfsi_s.o _fixunsdfsi_s.o _fixunsxfsi_s.o _fixsfdi_s.o _fixdfdi_s.o _fixxfdi_s.o _fixtfdi_s.o _fixunssfdi_s.o _fixunsdfdi_s.o _fixunsxfdi_s.o _fixunstfdi_s.o _floatdisf_s.o _floatdidf_s.o _floatdixf_s.o _floatditf_s.o _floatundisf_s.o _floatundidf_s.o _floatundixf_s.o _floatunditf_s.o _divdi3_s.o _moddi3_s.o _udivdi3_s.o _umoddi3_s.o _udiv_w_sdiv_s.o _udivmoddi4_s.o gthr-win32_s.o unwind-dw2_s.o unwind-dw2-fde_s.o unwind-sjlj_s.o gthr-gnat_s.o unwind-c_s.o emutls_s.o -lmingw32 -lmingwex -lmoldname -lmsvcrt -luser32 -lkernel32 -ladvapi32 -lshell32 && if [ -f ./shlib/libgcc_s_sjlj-1.dll ]; then mv -f ./shlib/libgcc_s_sjlj-1.dll ./shlib/libgcc_s_sjlj-1.dll.backup; else true; fi && mv ./shlib/libgcc_s_sjlj-1.dll.tmp ./shlib/libgcc_s_sjlj-1.dll && mv ./shlib/libgcc_s.a.tmp ./shlib/libgcc_s.a /home/dmitrij/src/mingw-w64/all-together/sysroot/usr/i686-w64-mingw32/bin/ld: dllcrt2.o: No such file: No such file or directory collect2: ld returned 1 exit status make[2]: *** [libgcc_s.dll] Error 1 make[2]: Leaving directory `/home/dmitrij/src/mingw-w64/all-together/i686-w64-mingw32/gcc/i686-w64-mingw32/libgcc' But: (sysroot == $(DESTDIR)) ~/src/mingw-w64/all-together$ find sysroot/ -name dllcrt2.o sysroot/usr/i686-w64-mingw32/lib/dllcrt2.o And just in case: from gcc config.log $ ../../gcc/configure --build=i486-linux-gnu --prefix=/usr --includedir=${prefix}/include --mandir=${prefix}/share/man\ --infodir=${prefix}/share/info --sysconfdir=/etc --localstatedir=/var --libexecdir=${prefix}/lib/mingw-w64-binutils --d\ isable-maintainer-mode --disable-dependency-tracking --disable-multilib --enable-languages=c,c++,fortran --target=i686-w\ 64-mingw32 --disable-multilib --with-build-sysroot=/home/dmitrij/src/mingw-w64/all-together/sysroot/i686-w64-mingw32 --w\ ith-build-time-tools=/home/dmitrij/src/mingw-w64/all-together/sysroot/usr/i686-w64-mingw32/bin and bintuils config.log $ ../../binutils/configure --build=i486-linux-gnu --prefix=/usr --includedir=${prefix}/include --mandir=${prefix}/shar\ e/man --infodir=${prefix}/share/info --sysconfdir=/etc --localstatedir=/var --libexecdir=${prefix}/lib/mingw-w64-binutil\ s --disable-maintainer-mode --disable-dependency-tracking --target=i686-w64-mingw32 --with-build-sysroot=/home/dmitrij/s\ rc/mingw-w64/all-together/sysroot/usr/i686-w64-mingw32 --with-build-time-tools=/home/dmitrij/src/mingw-w64/all-together/\ sysroot/usr/i686-w64-mingw32/bin --with-sysroot=/usr Questions: 1) What should my --with-build-sysroot be? $(DESTDIR), $(DESTDIR)/$(PREFIX) or $(DESTDIR)/$(PREFIX)/$(TARGET)? 2) Do I need to set --with-sysroot? 3) What is the layout of $(GCC_SRCDIR)/windsup? What should I stick into there such that gcc finds everything it needs and builds it for me =) I've tryied sticking in bintuils into $(GCC_SRCDIR) and that failed to build binutils though =( But I'd love to set up my sourcedir such that simple $(MAKE) will build everything for me: (binutils, headers, runtime & gcc) 4) Is it possible to achive what I'm trying to do? Please help me to get my head around all the sysroots =))))) Thanks.