[m-rev.] diff: fix MC++ compilation rule

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Nov 20 20:16:55 AEDT 2002


On 16-Nov-2002, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> On 05-Nov-2002, Peter Ross <pro at missioncriticalit.com> wrote:
> > Fix a bug in my previous change to fix a bug in fjh's previous change.
> > Revert back to using '/out:', and instead add the flag '/link' so that '/out:'
> > is passed to the linker instead to avoid problems compiling the library.
> 
> That's not going to work, I'm pretty sure.  See MS_CL_LIBS in
> library/Mmakefile.  You'll end up passing "/link /out:... /link ..."
> when building the library in the il grade, and then the linker will complain
> that "/link" is not a valid option.
> 
> What was wrong with the original approach of using `/o' (or was it `-o'?)?

Pete, 

This is a release-critical bug (it will break the build on Windows,
if the MS .NET CLR is installed) so it needs to be fixed ASAP.  Also,
your two attempted fixes have been committed only on the main branch,
rather than on the both the main and release branches.

Do you have any objection to me (a) resyncronizing the main and release
branch versions of scripts/Mmake.rules and (b) committing a change which
goes back to using "/o"?

----------

Estimated hours taken: 1
Branches: main, release

scripts/Mmake.rules:
compiler/compile_target_code.m:
	Be consistent about using `-' rather than `/' for options to cl.
	Use `-o ' rather than `-link -out:'.
	Ensure that `-o' comes before $(MS_CL_LIBS).
	Resynchronize the release branch with the main branch.

*****************************
Diff against the main branch:
*****************************

cvs diff -u Mmake.rules ../compiler/compile_target_code.m
Index: Mmake.rules
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/Mmake.rules,v
retrieving revision 1.138
diff -u -d -u -r1.138 Mmake.rules
--- Mmake.rules	6 Nov 2002 04:24:22 -0000	1.138
+++ Mmake.rules	20 Nov 2002 09:06:26 -0000
@@ -267,11 +267,15 @@
 # processing user code that is in a .cpp file, and we'd like to avoid going via
 # IL to generate a DLL if we are in a non-IL grade.
 ifeq ($(findstring il,$(GRADE)),il)        
+
+# Note that we use `-' rather than `/' as the option character for options
+# to $(MS_CL), to avoid confusion with Unix-style path names.
+# `cl' supports both variants.
 $(os_subdir)%.dll : %.cpp
 	$(MS_CL) -CLR$(MS_CL_NOASM) $(ALL_MS_CLFLAGS) \
 		-I`$(FIX_PATH_FOR_CL) $(MERC_C_INCL_DIR)` \
 		-AI`$(FIX_PATH_FOR_CL) $(MERC_DLL_DIR)` $< \
-		/LD $(MS_CL_LIBS) -out:$@
+		-LD -o $@ $(MS_CL_LIBS)
 	rm -f $*.obj
 
 $(os_subdir)%.dll : %.cs
@@ -380,7 +384,7 @@
 	$(MS_CL) -CLR$(MS_CL_NOASM) $(ALL_MS_CLFLAGS) \
 		-I`$(FIX_PATH_FOR_CL) $(MERC_C_INCL_DIR)` \
 		-AI`$(FIX_PATH_FOR_CL) $(MERC_DLL_DIR)` $< \
-		-link -noentry mscoree.lib -dll $(MS_CL_LIBS) -out:$@
+		-LD -o $@ $(MS_CL_LIBS)
 	rm -f $*.obj
 
 .cs.dll:
Index: ../compiler/compile_target_code.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/compile_target_code.m,v
retrieving revision 1.25.2.2
diff -u -d -u -r1.25.2.2 compile_target_code.m
--- ../compiler/compile_target_code.m	15 Nov 2002 13:22:12 -0000	1.25.2.2
+++ ../compiler/compile_target_code.m	20 Nov 2002 09:11:48 -0000
@@ -230,7 +230,7 @@
 
 	{ string__append_list([MCPP, " -CLR ", DebugOpt, InclOpts,
 		DLLDirOpts, MCPPFlags, " ", MCPPFileName,
-		" /LD /link -out:", DLLFileName],
+		" -LD -o ", DLLFileName],
 		Command) },
 	invoke_system_command(ErrorStream, verbose_commands,
 		Command, Succeeded).

********************************
Diff against the release branch:
********************************

cvs diff -u Mmake.rules ../compiler/compile_target_code.m
Index: Mmake.rules
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/Mmake.rules,v
retrieving revision 1.138
diff -u -d -u -r1.138 Mmake.rules
--- Mmake.rules	6 Nov 2002 04:24:22 -0000	1.138
+++ Mmake.rules	20 Nov 2002 09:06:26 -0000
@@ -267,11 +267,15 @@
 # processing user code that is in a .cpp file, and we'd like to avoid going via
 # IL to generate a DLL if we are in a non-IL grade.
 ifeq ($(findstring il,$(GRADE)),il)        
+
+# Note that we use `-' rather than `/' as the option character for options
+# to $(MS_CL), to avoid confusion with Unix-style path names.
+# `cl' supports both variants.
 $(os_subdir)%.dll : %.cpp
 	$(MS_CL) -CLR$(MS_CL_NOASM) $(ALL_MS_CLFLAGS) \
 		-I`$(FIX_PATH_FOR_CL) $(MERC_C_INCL_DIR)` \
 		-AI`$(FIX_PATH_FOR_CL) $(MERC_DLL_DIR)` $< \
-		/LD $(MS_CL_LIBS) -out:$@
+		-LD -o $@ $(MS_CL_LIBS)
 	rm -f $*.obj
 
 $(os_subdir)%.dll : %.cs
@@ -380,7 +384,7 @@
 	$(MS_CL) -CLR$(MS_CL_NOASM) $(ALL_MS_CLFLAGS) \
 		-I`$(FIX_PATH_FOR_CL) $(MERC_C_INCL_DIR)` \
 		-AI`$(FIX_PATH_FOR_CL) $(MERC_DLL_DIR)` $< \
-		-link -noentry mscoree.lib -dll $(MS_CL_LIBS) -out:$@
+		-LD -o $@ $(MS_CL_LIBS)
 	rm -f $*.obj
 
 .cs.dll:
Index: ../compiler/compile_target_code.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/compile_target_code.m,v
retrieving revision 1.25.2.2
diff -u -d -u -r1.25.2.2 compile_target_code.m
--- ../compiler/compile_target_code.m	15 Nov 2002 13:22:12 -0000	1.25.2.2
+++ ../compiler/compile_target_code.m	20 Nov 2002 09:11:48 -0000
@@ -230,7 +230,7 @@
 
 	{ string__append_list([MCPP, " -CLR ", DebugOpt, InclOpts,
 		DLLDirOpts, MCPPFlags, " ", MCPPFileName,
-		" /LD /link -out:", DLLFileName],
+		" -LD -o ", DLLFileName],
 		Command) },
 	invoke_system_command(ErrorStream, verbose_commands,
 		Command, Succeeded).

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list