RE : [ROOT] Different behaviour (i.e. Crash) of TString on Linux andWindows

From: ANCIANT E. (eric.anciant@sodern.fr)
Date: Tue Mar 09 2004 - 10:23:31 MET


Hello ROOTERS :

In fact, Andreas and I definitions :
'/INCREMENTAL:NO -subsystem:console,4.0  /NODEFAULTLIB  /PDB:NONE /RELEASE'
comes from visual 'win32.mak' file
QUOTES :

# declarations common to all linker options
lflags  = /NODEFAULTLIB /INCREMENTAL:NO /PDB:NONE /RELEASE /NOLOGO

...

# for Windows applications that use the C Run-Time libraries
conlflags = $(lflags) -subsystem:console,$(APPVER)
guilflags = $(lflags) -subsystem:windows,$(APPVER)
dlllflags = $(lflags) -entry:_DllMainCRTStartup$(DLLENTRY) -dll


and conlflags is used in makefile.win32


So, to answer valeri first wondering, there is no makefile.win32 mismatch,
But obviously the Visual win32.mak are different.

SO I started to play around with a local copy of win32.mak :

TEST 1 : modifying
# lflags  = /NODEFAULTLIB /INCREMENTAL:NO /PDB:NONE /RELEASE /NOLOGO
lflags  = /INCREMENTAL:NO

P:\APS_Local\test>nmake -f makefile.win32 tstring.exe

Microsoft (R) Program Maintenance Utility   Version 6.00.8168.0
Copyright (C) Microsoft Corp 1988-1998. All rights reserved.

        cl -DWIN32  -D_WIN32 -D_MT -D_DLL -MD -EHsc  -nologo -G5 -GR -MD -DWIN32
  -DVISUAL_CPLUSPLUS -D_WINDOWS -Ip:\root_v3.10.02.win32gdk_Debug/include -O2 -c
 tstring.cxx
tstring.cxx
        link -opt:ref /INCREMENTAL:NO -subsystem:console,4.0 -nologo tstring.obj
 p:\root_v3.10.02.win32gdk_Debug/lib/libCore.lib  p:\root_v3.10.02.win32gdk_Debug/lib/libCint.lib p:\root_v3.10.02.win32gdk_Debug/lib/libHist.lib  p:\root_v3.10.02.win32gdk_Debug/lib/libGraf.lib p:\root_v3.10.02.win32gdk_Debug/lib/libGraf3d.lib  p:\root_v3.10.02.win32gdk_Debug/lib/libGpad.lib p:\root_v3.10.02.win32gdk_Debug/lib/libTree.lib  p:\root_v3.10.02.win32gdk_Debug/lib/libRint.lib p:\root_v3.10.02.win32gdk_Debug/lib/libPostscript.lib  p:\root_v3.10.02.win32gdk_Debug/lib/libMatrix.lib p:\root_v3.10.02.win32gdk_Debug/lib/libPhysics.lib msvcrt.lib oldnames.lib kernel32.lib  ws2_32.lib mswsock.lib advapi32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib MSVCPRT.LIB -out:tstring.exe
"tstring.exe done"

CRASHES

-----------------
TEST 2 : modifying
# lflags  = /NODEFAULTLIB /INCREMENTAL:NO /PDB:NONE /RELEASE /NOLOGO
lflags  = /INCREMENTAL:NO

# default to APPVER of 4.0 => changed to 5.0

!IFNDEF APPVER
#APPVER = 4.0
APPVER = 5.0
!ENDIF

P:\APS_Local\test>nmake -f makefile.win32 tstring.exe

Microsoft (R) Program Maintenance Utility   Version 6.00.8168.0
Copyright (C) Microsoft Corp 1988-1998. All rights reserved.

        cl -DWIN32  -D_WIN32 -D_MT -D_DLL -MD -EHsc  -nologo -G5 -GR -MD -DWIN32
  -DVISUAL_CPLUSPLUS -D_WINDOWS -Ip:\root_v3.10.02.win32gdk_Debug/include -O2 -c
 tstring.cxx
tstring.cxx
        link -opt:ref /INCREMENTAL:NO -subsystem:console,5.0 -nologo tstring.obj
 p:\root_v3.10.02.win32gdk_Debug/lib/libCore.lib p:\root_v3.10.02.win32gdk_Debug/lib/libCint.lib p:\root_v3.10.02.win32gdk_Debug/lib/libHist.lib  p:\root_v3.10.02.win32gdk_Debug/lib/libGraf.lib p:\root_v3.10.02.win32gdk_Debug/lib/libGraf3d.lib  p:\root_v3.10.02.win32gdk_Debug/lib/libGpad.lib p:\root_v3.10.02.win32gdk_Debug/lib/libTree.lib  p:\root_v3.10.02.win32gdk_Debug/lib/libRint.lib p:\root_v3.10.02.win32gdk_Debug/lib/libPostscript.lib  p:\root_v3.10.02.win32gdk_Debug/lib/libMatrix.lib p:\root_v3.10.02.win32gdk_Debug/lib/libPhysics.lib msvcrt.lib oldnames.lib kernel32.lib  ws2_32.lib mswsock.lib advapi32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib MSVCPRT.LIB -out:tstring.exe
"tstring.exe done"

CRASHES

I saw on Valeri mail another difference:

'msvcrt.lib oldnames.lib' are present in our log, and not Valeri's ones


so TEST3 :

# lflags  = /NODEFAULTLIB /INCREMENTAL:NO /PDB:NONE /RELEASE /NOLOGO
lflags  = /INCREMENTAL:NO

# default to APPVER of 4.0 => changed to 5.0

!IFNDEF APPVER
#APPVER = 4.0
APPVER = 5.0
!ENDIF# These CRT Libraries assume the use of Microsoft Visual C++.  If you are
# using another Compiler product, change the libc* variable to correspond
# to your import library names.

libc = libc.lib oldnames.lib
libcmt = libcmt.lib oldnames.lib
#libcdll = msvcrt.lib oldnames.lib


P:\APS_Local\test>nmake -f makefile.win32 tstring.exe

Microsoft (R) Program Maintenance Utility   Version 6.00.8168.0
Copyright (C) Microsoft Corp 1988-1998. All rights reserved.

        cl -DWIN32  -D_WIN32 -D_MT -D_DLL -MD -EHsc  -nologo -G5 -GR -MD -DWIN32
  -DVISUAL_CPLUSPLUS -D_WINDOWS -Ip:\root_v3.10.02.win32gdk_Debug/include -O2 -c tstring.cxx
tstring.cxx
        link -opt:ref /INCREMENTAL:NO -subsystem:console,5.0 -nologo tstring.obj
 p:\root_v3.10.02.win32gdk_Debug/lib/libCore.lib  p:\root_v3.10.02.win32gdk_Debug/lib/libCint.lib p:\root_v3.10.02.win32gdk_Debug/lib/libHist.lib  p:\root_v3.10.02.win32gdk_Debug/lib/libGraf.lib p:\root_v3.10.02.win32gdk_Debug/lib/libGraf3d.lib  p:\root_v3.10.02.win32gdk_Debug/lib/libGpad.lib p:\root_v3.10.02.win32gdk_Debug/lib/libTree.lib  p:\root_v3.10.02.win32gdk_Debug/lib/libRint.lib p:\root_v3.10.02.win32gdk_Debug/lib/libPostscript.lib  p:\root_v3.10.02.win32gdk_Debug/lib/libMatrix.lib p:\root_v3.10.02.win32gdk_Debug/lib/libPhysics.lib  kernel32.lib
  ws2_32.lib mswsock.lib advapi32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib MSVCPRT.LIB -out:tstring.exe
"tstring.exe done"


... CRASHES


Since, in the present situation I kinda like the /NODEFAULTLIB option, I Put it back:

TEST4 :

P:\APS_Local\test>nmake -f makefile.win32 tstring.exe

Microsoft (R) Program Maintenance Utility   Version 6.00.8168.0
Copyright (C) Microsoft Corp 1988-1998. All rights reserved.

        cl -DWIN32  -D_WIN32 -D_MT -D_DLL -MD -EHsc  -nologo -G5 -GR -MD -DWIN32
  -DVISUAL_CPLUSPLUS -D_WINDOWS -Ip:\root_v3.10.02.win32gdk_Debug/include -O2 -c
 tstring.cxx
tstring.cxx
        link -opt:ref /NODEFAULTLIB /INCREMENTAL:NO -subsystem:console,5.0 -nolo
go tstring.obj p:\root_v3.10.02.win32gdk_Debug/lib/libCore.lib  p:\root_v3.10.02
.win32gdk_Debug/lib/libCint.lib p:\root_v3.10.02.win32gdk_Debug/lib/libHist.lib
 p:\root_v3.10.02.win32gdk_Debug/lib/libGraf.lib p:\root_v3.10.02.win32gdk_Debug/lib/libGraf3d.lib  p:\root_v3.10.02.win32gdk_Debug/lib/libGpad.lib p:\root_v3.10.02.win32gdk_Debug/lib/libTree.lib  p:\root_v3.10.02.win32gdk_Debug/lib/libRint.lib p:\root_v3.10.02.win32gdk_Debug/lib/libPostscript.lib  p:\root_v3.10.02.win32gdk_Debug/lib/libMatrix.lib p:\root_v3.10.02.win32gdk_Debug/lib/libPhysics.lib
  kernel32.lib  ws2_32.lib mswsock.lib advapi32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib MSVCPRT.LIB -out:tstring.exe
tstring.obj : error LNK2001: unresolved external symbol _atexit
tstring.obj : error LNK2001: unresolved external symbol "const type_info::`vftable'" (??_7type_info@@6B@)
tstring.obj : error LNK2001: unresolved external symbol ___CxxFrameHandler
tstring.obj : error LNK2001: unresolved external symbol __except_list
LINK : error LNK2001: unresolved external symbol _mainCRTStartup
MSVCPRT.LIB(delop_s.obj) : error LNK2001: unresolved external symbol _free
tstring.exe : fatal error LNK1120: 6 unresolved externals
NMAKE : fatal error U1077: 'link' : return code '0x460'
Stop.


Interesting ... let's put back msvcrt.lib :

P:\APS_Local\test>nmake -f makefile.win32 tstring.exe

Microsoft (R) Program Maintenance Utility   Version 6.00.8168.0
Copyright (C) Microsoft Corp 1988-1998. All rights reserved.

        cl -DWIN32  -D_WIN32 -D_MT -D_DLL -MD -EHsc  -nologo -G5 -GR -MD -DWIN32
  -DVISUAL_CPLUSPLUS -D_WINDOWS -Ip:\root_v3.10.02.win32gdk_Debug/include -O2 -c
 tstring.cxx
tstring.cxx
        link -opt:ref /NODEFAULTLIB /INCREMENTAL:NO -subsystem:console,5.0 -nologo tstring.obj p:\root_v3.10.02.win32gdk_Debug/lib/libCore.lib  p:\root_v3.10.02.win32gdk_Debug/lib/libCint.lib p:\root_v3.10.02.win32gdk_Debug/lib/libHist.lib
 p:\root_v3.10.02.win32gdk_Debug/lib/libGraf.lib p:\root_v3.10.02.win32gdk_Debug/lib/libGraf3d.lib  p:\root_v3.10.02.win32gdk_Debug/lib/libGpad.lib p:\root_v3.10.02.win32gdk_Debug/lib/libTree.lib  p:\root_v3.10.02.win32gdk_Debug/lib/libRint.lib p:\root_v3.10.02.win32gdk_Debug/lib/libPostscript.lib  p:\root_v3.10.02.win32gdk_Debug/lib/libMatrix.lib p:\root_v3.10.02.win32gdk_Debug/lib/libPhysics.lib
 msvcrt.lib kernel32.lib  ws2_32.lib mswsock.lib advapi32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib MSVCPRT.LIB -out:tstring.exe
"tstring.exe done"

CRASHES

Putting back also oldnames.lib doesn't help (it is apparently useless anyway ..)

I am puzzled and clueless...

eric

-----Message d'origine-----
De : owner-roottalk@pcroot.cern.ch [mailto:owner-roottalk@pcroot.cern.ch] De la part de Valeri Fine
Envoyé : lundi 8 mars 2004 18:24
À : 'Andreas Zoglauer'
Cc : roottalk@pcroot.cern.ch
Objet : RE: [ROOT] Different behaviour (i.e. Crash) of TString on Linux andWindows

Hello Andreas,

  Thank you very much for your "zip".
  Your "tstring.exe" does crash on my machine, when the "tstring.exe" I
made myself locally does work properly.

But when I re-created the "tstring.exe" from YOUR "tstring.obj" with no
re-compilation I did get the working version of tstring.exe as well.

Now, compare my "link protol" made by runing "Makefile.win32 with yours
to realize my list of the system libraries Makefile.win32 links
"tstring.obj" against of doesn't match yours.

Yours:

/INCREMENTAL:NO -subsystem:console,4.0  /NODEFAULTLIB  /PDB:NONE
/RELEASE

Mine:

/INCREMENTAL:NO /-subsystem:console,5.0

 The difference above in your log made me suspect the Makefile.win32 you
built your 'exe' mismatched one I applied.

At this point I am wondering why? Eventually the list of the system
libraries is to be provided by " !include <win32.mak> "NMAKE statement.

Are you sure your "LIB" variable, and "INCLUDE", and "PATH" variable did
point one and the same version of Visial Studio at the compilation time.

Can you send me your version of Makefile.win32?

I could not check some things up because I found no VC++ 6 around, sorry
:-(

Thank you, Valeri


        link -opt:ref  /INCREMENTAL:NO /NOLOGO -subsystem:console,5.0
 -nologo tstring.obj

c:\cygwin\home\fine\work\ROOT\3.10.02\root/lib/libCore.lib  c:\cygwin\
home\fine\work\ROOT\3.10.02\root/lib/libCint.lib
c:\cygwin\home\fine\work\ROOT\3
.10.02\root/lib/libHist.lib
c:\cygwin\home\fine\work\ROOT\3.10.02\root/lib/libG
raf.lib c:\cygwin\home\fine\work\ROOT\3.10.02\root/lib/libGraf3d.lib
c:\cygwin\
home\fine\work\ROOT\3.10.02\root/lib/libGpad.lib
c:\cygwin\home\fine\work\ROOT\3
.10.02\root/lib/libTree.lib
c:\cygwin\home\fine\work\ROOT\3.10.02\root/lib/libR
int.lib c:\cygwin\home\fine\work\ROOT\3.10.02\root/lib/libPostscript.lib
c:\cyg
win\home\fine\work\ROOT\3.10.02\root/lib/libMatrix.lib
c:\cygwin\home\fine\work\
ROOT\3.10.02\root/lib/libPhysics.lib

kernel32.lib  ws2_32.lib mswsock.lib advapi32.lib user32.lib gdi32.lib
comdlg32.lib winspool.lib MSVCPRT.LIB -out:tstring.exe


----
Best regards
                   Valeri


> -----Original Message-----
> From: Andreas Zoglauer [mailto:zog@mpe.mpg.de]
> Sent: Monday, March 08, 2004 11:39 AM
> To: Valeri Fine
> Cc: roottalk@pcroot.cern.ch
> Subject: Re: [ROOT] Different behaviour (i.e. Crash) of TString on
Linux
> andWindows
>
> Valeri Fine wrote:
>
> >
> > Can you send (upload somewhere otherwise my E-mail server will not
get
> > it through) me "tstring.exe"/"tstring.obj" and log of the session of
> > your "nmake -f Makefile.win32" (Of course if you still keep it?)
>
> The winzipped files are here: http://www.mpe.mpg.de/MEGA/test/
>
> The compile output was:
>
> C:\Daten\Root\r040002\test>nmake -f Makefile.win32
>
> Microsoft (R) Program Maintenance Utility   Version 6.00.8168.0
> Copyright (C) Microsoft Corp 1988-1998. All rights reserved.
>
>          cl -DWIN32  -D_WIN32 -D_MT -D_DLL -MD -EHsc  -nologo -G5 -GR
> -MD -DWIN32
>    -DVISUAL_CPLUSPLUS -D_WINDOWS -IC:\Daten\Root\R040002/include -O2
-c
> tstring.c
> xx
> tstring.cxx
>          link -opt:ref /NODEFAULTLIB /INCREMENTAL:NO /PDB:NONE
/RELEASE
> /NOLOGO -
> subsystem:console,4.0 -nologo tstring.obj
> C:\Daten\Root\R040002/lib/libCore.lib
>   C:\Daten\Root\R040002/lib/libCint.lib
> C:\Daten\Root\R040002/lib/libHist.lib  C:
> \Daten\Root\R040002/lib/libGraf.lib
> C:\Daten\Root\R040002/lib/libGraf3d.lib  C:\
> Daten\Root\R040002/lib/libGpad.lib
C:\Daten\Root\R040002/lib/libTree.lib
>   C:\Dat
> en\Root\R040002/lib/libRint.lib
> C:\Daten\Root\R040002/lib/libPostscript.lib  C:\
> Daten\Root\R040002/lib/libMatrix.lib
> C:\Daten\Root\R040002/lib/libPhysics.lib ms
> vcrt.lib oldnames.lib kernel32.lib  ws2_32.lib mswsock.lib
advapi32.lib
> user32.l
> ib gdi32.lib comdlg32.lib winspool.lib MSVCPRT.LIB -out:tstring.exe
> "tstring.exe done"
>
>
> Ciao,
> Andreas



********
Ce message et eventuellement les pieces jointes sont exclusivement transmis a l'usage de leur destinataire. Leur contenu est strictement confidentiel. Si vous n etes pas le bon destinataire nous vous demandons de ne pas conserver, copier, utiliser ou divulguer cette communication. Merci de le detruire et de me notifier cette erreur.

INTERNET ne permettant pas d assurer l integrite de ce message, SODERN decline toute responsabilite au cas ou il aurait ete intercepte ou modifie.


This message and possibly attachments are transmit for the exclusive use of their address. Their content is strictly confidential. If you are not the intended recipient please do not keep, copy, use or disclose this communication to others. Also please delete it and notify the sender at once.

Because of the nature of INTERNET the sender is not in a position to ensure the integrity of this message, therefore SODERN disclaims any liability whatoever in the event of this message having been intercepted and/or altered.



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:06 MET