After talking to David Coakley about this problem, I decided to create
this patch that changes the output of 'openCC -v' so that we can fix the
problem without needing a change made to libtool.

The problem, described in my earlier email is that libtool is confused
by the -v output of openCC when building a shared library and so when it
parses that output to figure out the proper command to use when building
a shared library it gets it wrong.  (See
http://sourceforge.net/mailarchive/forum.php?thread_name=201012170045.oBH0j9L09032%40lucas.cup.hp.com&forum_name=open64-devel
 for details)

The change in this patch is to not echo out the call to gcc (or g++)
that is used for the link.  The -v option is still passed to the gcc
command so the collect2 or ld command that gcc or g++ generates is
shown, but not the actual gcc call itself.  If you use -show instead of
(or in addition to) -v then you will still see the gcc call.

With this fix I was able to correctly build the libpcrecpp.so in the
pcre-6.6 package and have all the tests pass.

Can someone approve this patch?

Steve Ellcey
s...@cup.hp.com
Index: osprey/driver/run.c
===================================================================
--- osprey/driver/run.c	(revision 3441)
+++ osprey/driver/run.c	(working copy)
@@ -87,6 +87,7 @@
 #include "lib_phase_dir.h"
 
 boolean show_flag = FALSE;
+boolean v_flag = FALSE;
 boolean show_but_not_run = FALSE;
 boolean execute_flag = TRUE;
 boolean time_flag = FALSE;
@@ -314,6 +315,18 @@ run_phase (phases_t phase, char *name, s
 		fprintf(stderr, "%s ", name);
 		print_string_list(stderr, args);
 	}
+
+	/* When using -v (and not -show), do not echo out the gcc call
+	   that does the link phase.  libtool uses the -v option and greps
+	   for lines with -L to determine the link method when building
+	   shared libraries.  Echoing both the gcc call and the collect2/ld
+	   call that gcc generates confuses libtool.  */
+
+	if (v_flag && !show_flag && phase != P_ld && phase != P_ldplus) {
+		fprintf(stderr, "%s ", name);
+		print_string_list(stderr, args);
+	}
+
 	if (!execute_flag) return;
 
 	if (time_flag) init_time();
@@ -672,7 +685,7 @@ run_phase (phases_t phase, char *name, s
 				   ) {
 					nomsg_error(RC_INTERNAL_ERROR);
 				}
-				else if (!show_flag || save_stderr) {
+				else if (!(show_flag || v_flag) || save_stderr) {
 					nomsg_error(RC_USER_ERROR);
 				} else {
 					error("%s returned non-zero status %d",
@@ -947,7 +960,7 @@ run_phase (phases_t phase, char *name, s
     }
     else if (user_err) {
       /* assume phase will print diagnostics */
-      if (!show_flag || save_stderr)
+      if (!(show_flag || v_flag) || save_stderr)
 	nomsg_error(RC_USER_ERROR);
       else
         error("%s returned non-zero status %d", name, status);
Index: osprey/driver/run.h
===================================================================
--- osprey/driver/run.h	(revision 3441)
+++ osprey/driver/run.h	(working copy)
@@ -47,6 +47,7 @@ extern int show_version;	/* show the com
 extern boolean show_copyright;	/* show the compiler copyright */
 extern boolean dump_version;	/* dump the compiler version */
 extern boolean show_flag;	/* show what driver does */
+extern boolean v_flag;		/* show what driver does, except link call */
 extern boolean execute_flag;	/* execute phases */
 extern boolean time_flag;	/* give time info */
 extern boolean run_m4;		/* run m4 on each ratfor file */
Index: osprey/driver/OPTIONS
===================================================================
--- osprey/driver/OPTIONS	(revision 3441)
+++ osprey/driver/OPTIONS	(working copy)
@@ -170,7 +170,7 @@
 -show-defaults	{show_defaults = TRUE; execute_flag = FALSE;} ALL	NONE	""
 	"Show the default compiler options being used"
 % gcc has -v show version as well as phases, so take that meaning
--v	{show_flag = TRUE; show_version++;} ALL	CPP,as,ld	self "-show"
+-v	{v_flag = TRUE; show_version++;} ALL	CPP,as,ld	self "-show"
 	"show phases and version as they are being invoked"
 -fullwarn toggle(&msglevel,2);		FTN  CPP	"-m2"
 	"give more warnings, especially about missing prototypes"
Index: osprey/driver/main.c
===================================================================
--- osprey/driver/main.c	(revision 3441)
+++ osprey/driver/main.c	(working copy)
@@ -388,7 +388,7 @@ main (int argc, char *argv[])
 	{
 		print_help_msg();
 	}
-	if ( ! show_version && ! execute_flag && ! show_flag && ! dump_version) {
+	if ( ! show_version && ! execute_flag && ! show_flag && ! v_flag && ! dump_version) {
 		do_exit(RC_OKAY);	/* just exit */
 	}
 	if (source_kind == S_NONE || read_stdin) {
------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel

Reply via email to