CC: | "'smueller [...] cpan.org'" <smueller [...] cpan.org> |
Subject: | PAR-packer compilation on Windows XP32 box. |
Date: | Wed, 14 Apr 2010 10:27:43 +0200 |
To: | "'bug-PAR-Packer [...] rt.cpan.org'" <bug-PAR-Packer [...] rt.cpan.org> |
From: | Male Jean-Michel <Jean-Michel.Male [...] sbmoffshore.com> |
Bonjour,
When first compiling, I had those messages :
1) WARNING :
c:\temp\par-packer-1.003\myldr\env.c(68) : warning C4996: 'strnicmp' was declared deprecated
C:\Program Files\Microsoft Visual Studio 8\VC\INCLUDE\string.h(215) : see declaration of 'strnicmp'
Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strnicmp. See online help for details.'
This warning appears VERY frequently, and for all those functions : strdup, strtok, sprintf, strncpy ...
To have this (harmless) warning go away, just add -D_CRT_SECURE_NO_DEPRECATE in the compiler options.
2) COMPILATION ERROR :
main.c(115) : error C2143: syntax error : missing ';' before 'type'
main.c(116) : error C2065: 'argno' : undeclared identifier
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 8\VC\BIN\cl.EXE"' : return code '0x2'
Stop.
This error is due to the declaration
int argno = 0;
coming after conditionally compilated non-declaration code
The error disappears if the declaration is moved just immediately after the beginning of main definition, as :
int main ( int argc, char **argv, char **env )
{
int exitstatus;
int i;
int argno = 0;
3) LINK ERROR :
link main.obj my_par_pl.obj win32.obj -release -nologo -nodefaultlib -debug -opt:ref,icf -libpath:"C:\Perl\lib\CORE" -machine:x86 C:\Perl\lib\CORE\perl510.lib "C:\Program Files\Microsoft Visual Studio 8\VC\LIB\oldnames.lib" "C:\Program Files\Microsoft Visual Studio 8\VC\LIB\kernel32.lib" "C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\user32.lib" "C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\gdi32.lib" "C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\winspool.lib" "C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\comdlg32.lib" "C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\advapi32.lib" "C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\shell32.lib" "C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\ole32.lib" "C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\oleaut32.lib" "C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\netapi32.lib" "C:\Program Files\Microsoft Visual Studio 8\VC\LIB\uuid.lib" "C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\ws2_32.lib" "C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\mpr.lib" "C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\winmm.lib" "C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\version.lib" "C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\odbc32.lib" "C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\odbccp32.lib" "C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib\comctl32.lib" "C:\Program Files\Microsoft Visual Studio 8\VC\LIB\msvcrt.lib" -out:par.exe
main.obj : error LNK2019: unresolved external symbol _strcasecmp referenced in function _par_mktmpdir
par.exe : fatal error LNK1120: 1 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 8\VC\BIN\link.EXE"' : return code '0x460'
Stop.
Apparently strcasecmp in unknown to Microsoft Visual C V8. Sounds strange, but real.
The solution is to modify the file mktmpdir.c in myldr folder as follows :
Add the following block just after the first line in mktmpdir.c :
#ifdef _MSC_VER
#define snprintf _snprintf
#if _MSC_VER < 1500
#define vsnprintf _vsnprintf
#else
#define ssize_t SSIZE_T
#define uint32_t UINT32
#endif
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#else
#ifdef __MINGW32__
#define WINSOCK_VERSION MAKEWORD(2,0)
#else
#define strncasecmp strnicmp
#define strcasecmp stricmp
#endif /* __MINGW32__ */
#endif /* _MSC_VER */
This block has been taken verbatim from libxml2, and in particular, I have absolutely no
ideas if it is necessary nor working for MINGW32. It should work for Visual Studio 2008.
my compiler version :
Show quoted text
>>cl
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.42 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
my version of Perl :
Show quoted text>> perl -version
This is perl, v5.10.1 built for MSWin32-x86-multi-thread
(with 2 registered patches, see perl -V for more detail)
Copyright 1987-2009, Larry Wall
Binary build 1007 [291969] provided by ActiveState http://www.ActiveState.com
Built Jan 26 2010 23:15:11
Hope that helps.
Best regards,
Jean Michel Malé
Scientific Software Support Eng
Main: +377 9205 1500
Direct: +377 9205 1575
Jean-Michel.Male@sbmoffshore.com<mailto:Jean-Michel.Male@sbmoffshore.com>
Website: www.sbmoffshore.com<http://www.sbmoffshore.com/>
[cid:878154907@14042010-2D3F]
Recipients in 'Cc...' of this e-mail may not read it immediately and shall not be held accountable for not acting on enclosed information.
This message and any attachments are solely for the intended recipient and may contain confidential or privileged information.
The Internet can not guarantee the integrity of this message. SBM shall (will) not therefore be liable for the message if modified.
If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited.
If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you.