Subject: LIBRARY_PATH wierdness: WIN95B (OSR 2.x), B19.1, egcs, mingw32
From: [email-masked] (Matthew Moskewicz)

3 Jun 1998 10:35:57 -0700
Message-ID: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
To: [email-masked]

*************
Abstract:
*************

  Linking of hellowin.exe fails dependant on the ordering of  
/mingw32/lib and /mingw32/win32/lib in LIBRARY_PATH variable (!) :

  This works: 

  export "LIBRARY_PATH=/mingw32/win32/lib:/mingw32/lib"
  gcc -o h2.exe hellowin-mingw32.c -luser32 -Wl,--verbose

  This fails:

  export "LIBRARY_PATH=/mingw32/lib:/mingw32/win32/lib" 
  gcc -o h2.exe hellowin-mingw32.c -luser32 -Wl,--verbose

  (output of these compiles is at the end) 
  
  Explain that, folks! I somehow doubt this is reproducible on other
systems, but you never know. It looks like a simple problem, but I'm
stumped.

*****************
Prelims:
*****************

  I'll been playing with the tools on and off since B16. I've been
mostly off the list for a while, but now that I've got some free time
again, I've moved up to B19.1, and I'm playing with the Platform SDK
from Microsoft. Anyway, I'd like to congratulate everyone: things are
MUCH better now than they were in B16! I've got a lot of questions, but
I thought this one would make a good warm up. I'm having a *really* hard
time limiting myself to one question in this message ... but I'm sure
that doing so is Good For Me.

*****************
My setup: (I figure, do this once the right way, then cut&paste for
future messages)
*****************
 ABSTRACT:

all mounts binary, coolview installed, egcs installed, sergey's xemacs /
X11 / remote packages installed, recent mingw32 snapshot installed,
microsoft usb update installed (not quite the most recent one -- ver
..1214 on usbhub.sys -- but it seems to work)

I put the mingw32 specs over top of both the B19 and egcs specs files,
so I'm covered there. I removed the -iprefix /mingw32/include because it
looked shady. It was generating two -iprefix flags on compile, and gcc
was still finding the standard B19 headers first, so I don't think it
was working ... right, one question per message ... moving on.

*****************
[mingw32.bat]
*****************

@ECHO OFF

rem Questionable ?

SET USER=moskewcz
SET UID=500
SET HOST=BUFFY
SET DISPLAY=localhost:0

rem Normal stuff.

SET HOME=D:\u\%user%

SET MAKE_MODE=unix
SET CYGFS=D:/Cygnus/B19
SET GCC_EXEC_PREFIX=D:\CYGNUS\B19\H-I386~1\lib\gcc-lib\
SET TCL_LIBRARY=%CYGROOT%\share\tcl8.0\
SET GDBTK_LIBRARY=%CYGFS%/share/gdbtcl
SET
PATH=D:\CYGNUS\B19\H-I386~1\bin;%PATH%;D:\usr\local\bin;D:\usr\X11R6.4\bin;%HOME%\bin
SET TERM=linux
SET TERMINFO=D:\usr\local\share\terminfo
SET CYGWIN32=tty

SET LIBRARY_PATH=/mingw32/win32/lib:/mingw32/lib
SET C_INCLUDE_PATH=/mingw32/win32/include:/mingw32/include
SET CPLUS_INCLUDE_PATH=/mingw32/include/c++:%C_INCLUDE_PATH%

bash

********************
Installed Stuff
********************

BUFFY:/c/WINDOWS/SYSTEM> l cygwin* 
-rw-r--r--   1 moskewcz root       652961 May 14 04:24 cygwinb19.dll

(packages I've installed, correctly I hope):
BUFFY:/temp3> l
total 11598

5201813 May 20 15:07 X11R6.4-cygwinb19.tar.bz2
9354661 May 20 15:10 Xemacs-21.0-b41-cygwinb19.tar.bz2
306213 May 28 23:55 coolview.tar.gz
4696492 May 29 01:53 egcs-1.0.2-cygb19.tar.gz
2023196 May 29 01:52 gas-980303-cygb19.tar.gz
209427 May 29 04:56 mingjam_980128.tar.gz
153221 May 29 04:42 mingw32_980309.tar.gz
517638 May 29 01:52 remote.tar.gz
980296 May 21 22:35 usbupdus.exe
302817 May 29 04:47 win32api980428.tar.gz
ncurses4.1 as well, I must have misplaced the archive ...

(Note, don't be mislead by those dates ... use the file sizes)
(everything seems to work, including remote.tar.gz ...)

***************************
[output from 'bad' compile]
***************************

cd /d/u/moskewcz/scratch/
export "LIBRARY_PATH=/mingw32/lib:/mingw32/win32/lib" ; gcc -o h2.exe
hellowin-mingw32.c -luser32 -Wl,--verbose
GNU ld version 2.8.2 (with BFD 980303)
  Supported emulations:
   i386pe
using internal linker script:
==================================================
OUTPUT_FORMAT(pei-i386)
SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib);
SEARCH_DIR(/Cygnus/B19/H-i386-cygwin32/lib); SEARCH_DIR(/usr/local/lib);
SEARCH_DIR(/Cygnus/B19/H-i386-cygwin32/i386-cygwin32/lib);
ENTRY(_mainCRTStartup)
SECTIONS
{
  .text  __image_base__ + __section_alignment__  : 
  {
     *(.init)
    *(.text)
    *(.text$*)
     ___CTOR_LIST__ = .; __CTOR_LIST__ = . ; 
			LONG (-1); *(.ctors); *(.ctor); LONG (0); 
     ___DTOR_LIST__ = .; __DTOR_LIST__ = . ; 
			LONG (-1); *(.dtors); *(.dtor);  LONG (0); 
     *(.fini)
    /* ??? Why is .gcc_exc here?  */
     *(.gcc_exc)
     etext = .;
    *(.gcc_except_table)
  }
  .data BLOCK(__section_alignment__) : 
  {
    __data_start__ = . ;
    *(.data)
    *(.data2)
    *(.data$*)
    __data_end__ = . ;
    *(.data_cygwin_nocopy)
  }
  .bss BLOCK(__section_alignment__) :
  {
    __bss_start__ = . ;
    *(.bss)
    *(COMMON)
    __bss_end__ = . ;
  }
  .rdata BLOCK(__section_alignment__) :
  {
    *(.rdata)
    *(.rdata$*)
    *(.eh_frame)
  }
  .edata BLOCK(__section_alignment__) :
  {
    *(.edata)
  }
  /DISCARD/ :
  {
    *(.debug$S)
    *(.debug$T)
    *(.debug$F)
    *(.drectve)
  }
  .idata BLOCK(__section_alignment__) :
  {
    /* This cannot currently be handled with grouped sections.
	See pe.em:sort_sections.  */
    *(.idata$2)
    *(.idata$3)
     /* These zeroes mark the end of the import list.  */
     LONG (0); LONG (0); LONG (0); LONG (0); LONG (0);
    *(.idata$4)
    *(.idata$5)
    *(.idata$6)
    *(.idata$7)
  }
  .CRT BLOCK(__section_alignment__) :
  { 					
    *(.CRT$*)
  }
  .endjunk BLOCK(__section_alignment__) :
  {
    /* end is deprecated, don't use it */
     end = .;
     __end__ = .;
  }
  .reloc BLOCK(__section_alignment__) :
  { 					
    *(.reloc)
  }
  .rsrc BLOCK(__section_alignment__) :
  { 					
    *(.rsrc)
    *(.rsrc$*)
  }
  .stab BLOCK(__section_alignment__) (NOLOAD) :
  {
 /d/CYGNUS/B19/H-I386~1/i386-cygwin32/bin/ld.exe: cannot open crt1.o: No
such file or directory
   [ .stab ]
  }
  .stabstr BLOCK(__section_alignment__) (NOLOAD) :
  {
    [ .stabstr ]
  }
}

==================================================
attempt to open crt1.o failed

Compilation exited abnormally with code 1 at Wed Jun 03 00:49:18

****************************
[output from 'good' compile]
****************************

cd /d/u/moskewcz/scratch/
export "LIBRARY_PATH=/mingw32/win32/lib:/mingw32/lib" ; gcc -o h2.exe
hellowin-mingw32.c -luser32 -Wl,--verbose
GNU ld version 2.8.2 (with BFD 980303)
  Supported emulations:
   i386pe
using internal linker script:
==================================================
OUTPUT_FORMAT(pei-i386)
SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib);
SEARCH_DIR(/Cygnus/B19/H-i386-cygwin32/lib); SEARCH_DIR(/usr/local/lib);
SEARCH_DIR(/Cygnus/B19/H-i386-cygwin32/i386-cygwin32/lib);
ENTRY(_mainCRTStartup)
SECTIONS
{
  .text  __image_base__ + __section_alignment__  : 
  {
     *(.init)
    *(.text)
    *(.text$*)
     ___CTOR_LIST__ = .; __CTOR_LIST__ = . ; 
			LONG (-1); *(.ctors); *(.ctor); LONG (0); 
     ___DTOR_LIST__ = .; __DTOR_LIST__ = . ; 
			LONG (-1); *(.dtors); *(.dtor);  LONG (0); 
     *(.fini)
    /* ??? Why is .gcc_exc here?  */
     *(.gcc_exc)
     etext = .;
    *(.gcc_except_table)
  }
  .data BLOCK(__section_alignment__) : 
  {
    __data_start__ = . ;
    *(.data)
    *(.data2)
    *(.data$*)
    __data_end__ = . ;
    *(.data_cygwin_nocopy)
  }
  .bss BLOCK(__section_alignment__) :
  {
    __bss_start__ = . ;
    *(.bss)
    *(COMMON)
    __bss_end__ = . ;
  }
  .rdata BLOCK(__section_alignment__) :
  {
    *(.rdata)
    *(.rdata$*)
    *(.eh_frame)
  }
  .edata BLOCK(__section_alignment__) :
  {
    *(.edata)
  }
  /DISCARD/ :
  {
    *(.debug$S)
    *(.debug$T)
    *(.debug$F)
    *(.drectve)
  }
  .idata BLOCK(__section_alignment__) :
  {
    /* This cannot currently be handled with grouped sections.
	See pe.em:sort_sections.  */
    *(.idata$2)
    *(.idata$3)
     /* These zeroes mark the end of the import list.  */
     LONG (0); LONG (0); LONG (0); LONG (0); LONG (0);
    *(.idata$4)
    *(.idata$5)
    *(.idata$6)
    *(.idata$7)
  }
  .CRT BLOCK(__section_alignment__) :
  { 					
    *(.CRT$*)
  }
  .endjunk BLOCK(__section_alignment__) :
  {
    /* end is deprecated, don't use it */
     end = .;
     __end__ = .;
  }
  .reloc BLOCK(__section_alignment__) :
  { 					
    *(.reloc)
  }
  .rsrc BLOCK(__section_alignment__) :
  { 					
    *(.rsrc)
    *(.rsrc$*)
  }
  .stab BLOCK(__section_alignment__) (NOLOAD) :
  {
    [ .stab ]
  }
  .stabstr BLOCK(__section_alignment__) (NOLOAD) :
  {
    [ .stabstr ]
  }
}

==================================================
attempt to open \mingw32\lib\crt1.o succeeded
\mingw32\lib\crt1.o
attempt to open /tmp\cc0010891.o succeeded
/tmp\cc0010891.o
attempt to open
D:\CYGNUS\B19\H-I386~1\lib\gcc-lib\i386-cygwin32\egcs-2.90.27/libuser32.a
failed
attempt to open D:\CYGNUS\B19\H-I386~1\lib\gcc-lib/libuser32.a failed
attempt to open \mingw32\lib/libuser32.a failed
attempt to open
/Cygnus/B19/H-i386-cygwin32/lib/gcc-lib/i386-cygwin32\egcs-2.90.27/libuser32.a
failed
attempt to open
D:\CYGNUS\B19\H-I386~1\lib\gcc-lib\i386-cygwin32\egcs-2.90.27\../../../../i386-cygwin32\lib/libuser32.a
succeeded
(D:\CYGNUS\B19\H-I386~1\lib\gcc-lib\i386-cygwin32\egcs-2.90.27\../../../../i386-cygwin32\lib/libuser32.a)ds375.o
(D:\CYGNUS\B19\H-I386~1\lib\gcc-lib\i386-cygwin32\egcs-2.90.27\../../../../i386-cygwin32\lib/libuser32.a)dh.o
(D:\CYGNUS\B19\H-I386~1\lib\gcc-lib\i386-cygwin32\egcs-2.90.27\../../../../i386-cygwin32\lib/libuser32.a)dt.o
attempt to open
D:\CYGNUS\B19\H-I386~1\lib\gcc-lib\i386-cygwin32\egcs-2.90.27/libgcc.a
succeeded
attempt to open
D:\CYGNUS\B19\H-I386~1\lib\gcc-lib\i386-cygwin32\egcs-2.90.27/libmingw32.a
failed
attempt to open D:\CYGNUS\B19\H-I386~1\lib\gcc-lib/libmingw32.a failed
attempt to open \mingw32\lib/libmingw32.a succeeded
(\mingw32\lib/libmingw32.a)CRTglob.o
(\mingw32\lib/libmingw32.a)main.o
(\mingw32\lib/libmingw32.a)CRTfmode.o
(\mingw32\lib/libmingw32.a)gccmain.o
attempt to open
D:\CYGNUS\B19\H-I386~1\lib\gcc-lib\i386-cygwin32\egcs-2.90.27/libgcc.a
succeeded
(D:\CYGNUS\B19\H-I386~1\lib\gcc-lib\i386-cygwin32\egcs-2.90.27/libgcc.a)_ctors.o
attempt to open
D:\CYGNUS\B19\H-I386~1\lib\gcc-lib\i386-cygwin32\egcs-2.90.27/libmoldname.a
failed
attempt to open D:\CYGNUS\B19\H-I386~1\lib\gcc-lib/libmoldname.a failed
attempt to open \mingw32\lib/libmoldname.a succeeded
attempt to open
D:\CYGNUS\B19\H-I386~1\lib\gcc-lib\i386-cygwin32\egcs-2.90.27/libcrtdll.a
failed
attempt to open D:\CYGNUS\B19\H-I386~1\lib\gcc-lib/libcrtdll.a failed
attempt to open \mingw32\lib/libcrtdll.a succeeded
(\mingw32\lib/libcrtdll.a)ds18.o
(\mingw32\lib/libcrtdll.a)ds103.o
(\mingw32\lib/libcrtdll.a)ds45.o
(\mingw32\lib/libcrtdll.a)ds100.o
(\mingw32\lib/libcrtdll.a)ds132.o
(\mingw32\lib/libcrtdll.a)ds93.o
(\mingw32\lib/libcrtdll.a)ds259.o
(\mingw32\lib/libcrtdll.a)ds338.o
(\mingw32\lib/libcrtdll.a)dh.o
(\mingw32\lib/libcrtdll.a)dt.o
attempt to open
D:\CYGNUS\B19\H-I386~1\lib\gcc-lib\i386-cygwin32\egcs-2.90.27/libkernel32.a
failed
attempt to open D:\CYGNUS\B19\H-I386~1\lib\gcc-lib/libkernel32.a failed
attempt to open \mingw32\lib/libkernel32.a failed
attempt to open
/Cygnus/B19/H-i386-cygwin32/lib/gcc-lib/i386-cygwin32\egcs-2.90.27/libkernel32.a
failed
attempt to open
D:\CYGNUS\B19\H-I386~1\lib\gcc-lib\i386-cygwin32\egcs-2.90.27\../../../../i386-cygwin32\lib/libkernel32.a
succeeded
(D:\CYGNUS\B19\H-I386~1\lib\gcc-lib\i386-cygwin32\egcs-2.90.27\../../../../i386-cygwin32\lib/libkernel32.a)ds530.o
(D:\CYGNUS\B19\H-I386~1\lib\gcc-lib\i386-cygwin32\egcs-2.90.27\../../../../i386-cygwin32\lib/libkernel32.a)ds98.o
(D:\CYGNUS\B19\H-I386~1\lib\gcc-lib\i386-cygwin32\egcs-2.90.27\../../../../i386-cygwin32\lib/libkernel32.a)ds159.o
(D:\CYGNUS\B19\H-I386~1\lib\gcc-lib\i386-cygwin32\egcs-2.90.27\../../../../i386-cygwin32\lib/libkernel32.a)ds276.o
(D:\CYGNUS\B19\H-I386~1\lib\gcc-lib\i386-cygwin32\egcs-2.90.27\../../../../i386-cygwin32\lib/libkernel32.a)ds235.o
(D:\CYGNUS\B19\H-I386~1\lib\gcc-lib\i386-cygwin32\egcs-2.90.27\../../../../i386-cygwin32\lib/libkernel32.a)dh.o
(D:\CYGNUS\B19\H-I386~1\lib\gcc-lib\i386-cygwin32\egcs-2.90.27\../../../../i386-cygwin32\lib/libkernel32.a)dt.o
attempt to open
D:\CYGNUS\B19\H-I386~1\lib\gcc-lib\i386-cygwin32\egcs-2.90.27/libgcc.a
succeeded

Compilation finished at Wed Jun 03 00:50:33

********************
[hellowin.c]
********************

#include <windows.h>

int STDCALL
WinMain (HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmd, int nShow)
{
  MessageBox (NULL, "Test message", "Test", MB_OK);
  return 0;
}

-- 
 Matthew Moskewicz	|	mailto:[email-masked]
 24A Holder Hall - PU	|	http://www.Princeton.edu/~moskewcz	
 Princeton, NJ 08544    |	(609)258-9852
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".