bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

MSVC runtime lib issue


From: Gisle Vanem
Subject: MSVC runtime lib issue
Date: Fri, 29 Nov 2013 14:01:46 +0100

I've compiled the lastest Git-repo with MSVC using the make_msvc_net2003.vcproj
project. This is a bit outdated (was converted to make_msvc_net2003.vcxproj by
my Visual Studio 2010. I also had to insert guile.c in again).

This project file doesn't specify any runtime lib to link with. Hence the default is to use LIBCMT.LIB as if '-MT' was used. I would like to build using '-MD' (or '-MDd') which pulls in msvcrt[d].dll (most MSVC software seems to be using this CRT these days). But then the linker fails at pulling in 'tmpfile' in 'w32/compat/posixfcn.c':

 MSVCRT.lib(MSVCR100.dll) : error LNK2005: _tmpfile already defined in 
posixfcn.obj

Presumably because 'tmpfile' is needed elsewhere in MSVCRT.lib. So can you 
please
rename 'tmpfile' to 'gmake_tmpfile' like so:

--- Git-latest/makeint.h    2013-11-27 22:18:35 +0000
+++ makeint.h       2013-11-29 12:46:04 +0000
@@ -350,6 +350,8 @@
# include <malloc.h>
# define pipe(_p)        _pipe((_p), 512, O_BINARY)
# define kill(_pid,_sig) w32_kill((_pid),(_sig))
+# define tmpfile()       gmake_tmpfile()
+
/* MSVC doesn't have ftruncate.  */
# ifdef _MSC_VER
#  define ftruncate(_fd,_len) _chsize(_fd,_len)
@@ -362,6 +364,7 @@
void sync_Path_environment (void);
int w32_kill (pid_t pid, int sig);
int find_and_set_default_shell (const char *token);
+FILE *gmake_tmpfile (void);

/* indicates whether or not we have Bourne shell */
extern int no_default_sh_exe;
@@ -580,7 +583,9 @@
extern const gmk_floc *reading_file;
extern const gmk_floc **expanding_var;

+#ifndef WINDOWS32
extern char **environ;
+#endif

extern unsigned short stopchar_map[];
-------------

--- Git-latest/w32/compat/posixfcn.c        2013-10-07 17:04:09 +0000
+++ w32/compat/posixfcn.c   2013-11-29 12:46:15 +0000
@@ -262,7 +262,7 @@
   not be writable by our user.  Most of the code borrowed from
   create_batch_file, see job.c.  */
FILE *
-tmpfile (void)
+gmake_tmpfile (void)
{
  char temp_path[MAXPATHLEN];
  unsigned path_size = GetTempPath (sizeof temp_path, temp_path);

------

Using '-MD' also caused an issue with 'environ'. Hence that had to go too:

 g:\mingw32\src\gnu\gnu-make\makeint.h(587) : warning C4273: '_environ' : 
inconsistent dll linkage
         g:\vc_2010\VC\include\stdlib.h(299) : see previous definition of 
'_environ'

I've tested my patch against MingW too with no problems.

--gv



reply via email to

[Prev in Thread] Current Thread [Next in Thread]