X-Spam-Check-By: sourceware.org Message-ID: <44E0A9E7.2030101@laposte.net> Date: Mon, 14 Aug 2006 17:50:47 +0100 From: Damien Fouilleul User-Agent: Thunderbird 1.5.0.5 (Windows/20060719) MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: GCC: problem with library search path when targeting mingw Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com hello, I'm a big fan of cygwin and I use it a lot to compile mingw apps, however with the latest mingw-runtime, I'm having trouble running configure scripts successfully as test such 'dlopen() in -ldl', which used to fail for mingw target (as expected) now succeeds. This causes havoc in compilation as the resulting config.h file contains reference to APIs not supported by mingw. after having a look at gcc -mno-cygwin -print-search-dirs, I think I may have found the culprit in the following element of the library search path: '/usr/lib/gcc/i686-pc-mingw/3.4.4/../../..', as this points back straight at /usr/lib, the cygin main library path. This means now that the following command $ gcc -mno-cygwin dlopen-test.c -dl Now passes with flying colors. I have to edit all my config.h as I do not know of any way to remove this path from the search paths Similarily, I have a similar but less serious problems with headers paths for files such as math.h, float.h, these are available for both cygwin and mingw, but they are different files.Unfortunately, "/usr/lib/gcc/i686-pc-cygwin/3.4.4/include" has precedence over '/usr/lib/gcc/i686-pc-mingw32/3.4.4/../../../../i686-pc-mingw32/include' when targetting mingw by default, therefore the cygwin version is chosen over the mingw one. In 99% of cases, this is usually not a problem, as the files are nearly identical, but they are some Microsoft specific code in the mingw, which is required to compile Trolltech QT, for example. If i use the following compiler option '-isystem /usr/include/mingw', then everything works fine. I hope this help Damien -------- For reference: binutils-20060709-1 gcc-3.4.4-1 mingw-runtime-3.10.1 $ gcc -mno-cygwin -print-search-dirs install: /usr/lib/gcc/i686-pc-mingw32/3.4.4/ programs: =/usr/lib/gcc/i686-pc-mingw32/3.4.4/:/usr/lib/gcc/i686-pc-mingw32/3.4.4/:/usr/lib/gcc/i686-pc-mingw32/:/usr/lib/gcc/i686-pc-mingw32/3.4.4/:/usr/lib/gcc/i686-pc-mingw32/:/usr/libexec/gcc/i686-pc-mingw32/3.4.4/:/usr/libexec/gcc/i686-pc-mingw32/:/usr/lib/gcc/i686-pc-mingw32/3.4.4/:/usr/lib/gcc/i686-pc-mingw32/:/usr/lib/gcc/i686-pc-mingw32/3.4.4/../../../../i686-pc-mingw32/bin/i686-pc-mingw32/3.4.4/:/usr/lib/gcc/i686-pc-mingw32/3.4.4/../../../../i686-pc-mingw32/bin/ libraries: =/usr/lib/gcc/i686-pc-mingw32/3.4.4/:/usr/lib/gcc/i686-pc-mingw32/3.4.4/:/usr/lib/gcc/i686-pc-mingw32/3.4.4/../../../../i686-pc-mingw32/lib/i686-pc-mingw32/3.4.4/:/usr/lib/gcc/i686-pc-mingw32/3.4.4/../../../../i686-pc-mingw32/lib/:/usr/lib/gcc/i686-pc-mingw32/3.4.4/../../../i686-pc-mingw32/3.4.4/:/usr/lib/gcc/i686-pc-mingw32/3.4.4/../../../:/lib/i686-pc-mingw32/3.4.4/:/lib/:/usr/lib/i686-pc-mingw32/3.4.4/:/usr/lib/ $ gcc -print-search-dirs install: /usr/lib/gcc/i686-pc-cygwin/3.4.4/ programs: =/usr/lib/gcc/i686-pc-cygwin/3.4.4/:/usr/lib/gcc/i686-pc-cygwin/3.4.4/:/usr/lib/gcc/i686-pc-cygwin/:/usr/lib/gcc/i686-pc-cygwin/3.4.4/:/usr/lib/gcc/i686-pc-cygwin/:/usr/libexec/gcc/i686-pc-cygwin/3.4.4/:/usr/libexec/gcc/i686-pc-cygwin/:/usr/lib/gcc/i686-pc-cygwin/3.4.4/:/usr/lib/gcc/i686-pc-cygwin/:/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/i686-pc-cygwin/3.4.4/:/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ libraries: =/usr/lib/gcc/i686-pc-cygwin/3.4.4/:/usr/lib/gcc/i686-pc-cygwin/3.4.4/:/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/lib/i686-pc-cygwin/3.4.4/:/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/lib/:/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../i686-pc-cygwin/3.4.4/:/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../:/lib/i686-pc-cygwin/3.4.4/:/lib/:/usr/lib/i686-pc-cygwin/3.4.4/:/usr/lib/ $ cpp -mno-cygwin --verbose test.c Reading specs from /usr/lib/gcc/i686-pc-mingw32/3.4.4/specs Configured with: /gcc/gcc-3.4.4/gcc-3.4.4-1/configure --verbose --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --enable-languages=c,ada,c++,d,f77,java,objc --enable-nls --without-included-gettext --enable-version-specific-runtime-libs --without-x --enable-libgcj --disable-java-awt --with-system-zlib --enable-interpreter --disable-libgcj-debug --enable-threads=posix --enable-java-gc=boehm --disable-win32-registry --enable-sjlj-exceptions --enable-hash-synchronization --enable-libstdcxx-debug : (reconfigured) Thread model: posix gcc version 3.4.4 (cygming special) (gdc 0.12, using dmd 0.125) /usr/lib/gcc/i686-pc-mingw32/3.4.4/cc1.exe -E -quiet -v -D__MSVCRT__ -D__MINGW32__ -DWIN32 -D_WIN32 -D__WIN32 -D__WIN32__ -DWINNT -idirafter /usr/lib/gcc/i686-pc-mingw32/3.4.4/../../../../include/w32api -idirafter /usr/lib/gcc/i686-pc-mingw32/3.4.4/../../../../i686-pc-mingw32/lib/../../include/w32api test.c -mno-cygwin -mtune=pentiumpro ignoring nonexistent directory "/usr/local/include/mingw" ignoring duplicate directory "/usr/include/mingw" ignoring duplicate directory "/usr/lib/gcc/i686-pc-mingw32/3.4.4/../../../../i686-pc-mingw32/lib/../../include/w32api" #include "..." search starts here: #include <...> search starts here: /usr/lib/gcc/i686-pc-cygwin/3.4.4/include /usr/lib/gcc/i686-pc-mingw32/3.4.4/../../../../i686-pc-mingw32/include /usr/lib/gcc/i686-pc-mingw32/3.4.4/../../../../include/w32api End of search list. # 1 "test.c" # 1 "" # 1 "" # 1 "test.c" # 1 "/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/float.h" 1 3 4 # 2 "test.c" 2 int main(int argc, char **argv) { return 0; } -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/