[ ant-contrib-Bugs-1313421 ] linker should pass "-arch xxx" argument directly to libtool

"SourceForge.net" <[email protected]> Thu, 06 Sep 2007 06:22:56 -0700
Newsgroups gmane.comp.java.ant-contrib.devel
Message-ID <[email protected]>
Bugs item #1313421, was opened at 2005-10-04 21:53
Message generated for change (Comment added) made by dhoffer
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=416920&aid=1313421&group_id=36177

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: cpptasks
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Curt Arnold (carnold)
Summary: linker should pass "-arch xxx" argument directly to libtool

Initial Comment:
For building fat (ppc and i386) libs on Mac OS X, it would be nice if linker 
worked with the following definition:

      <linker id="linker" name="gcc">
		<linkerarg value="-arch" />
		<linkerarg value="ppc" />
		<linkerarg value="-arch" />
		<linkerarg value="i386" />
      </linker>

however, the above declaration outputs "libtool -Wl,-arch ppc -Wl,-arch 
i386 ..." which fails (at least on Mac OS X). It should output "libtool -arch ppc 
-arch i386 ..." instead.

decorateLinkerOption in GccLinker.java should pass the "-arch xxx" to GCC 
without adding "-Wl" in this case. Ex:

    public String decorateLinkerOption(StringBuffer buf, String arg) {
        String decoratedArg = arg;
        if (arg.length() > 1 && arg.charAt(0) == '-') {
            switch (arg.charAt(1)) {
                //
                //   passed automatically by GCC
                //
                case 'g' :
                case 'f' :
                case 'F' :
                /* Darwin */
                case 'a' :
                case 'm' :
                case 'O' :
                case 'W' :
                case 'l' :
                case 'L' :
                case 'u' :
                case 'v' :
                    break;
                default :
                    boolean known = false;
                    for (int i = 0; i < linkerOptions.length; i++) {
                        if (linkerOptions[i].equals(arg)) {
                            known = true;
                            break;
                        }
                    }
                    if (!known) {
                        buf.setLength(0);
                        buf.append("-Wl,");
                        buf.append(arg);
                        decoratedArg = buf.toString();
                    }
                    break;
            }
        }
        return decoratedArg;
    }


----------------------------------------------------------------------

Comment By: David Hoffer (dhoffer)
Date: 2007-09-06 09:22

Message:
Logged In: YES 
user_id=872165
Originator: NO

What is the status of this?  I would like to use cpptasks to build OSX
universal binary.

----------------------------------------------------------------------

Comment By: Nobody/Anonymous (nobody)
Date: 2005-10-04 22:12

Message:
Logged In: NO 

I suppose a better solution would be to add "-arch" as one of the
recognized options to 
linkerOptions, ex:

    private static String[] linkerOptions = new String[]{"-arch",
"-bundle",
            "-dynamiclib", "-nostartfiles", "-nostdlib", "-prebind",
"-s",
            "-static", "-shared", "-symbolic", "-Xlinker",
            "--export-all-symbols", "-static-libgcc",};

Is it possible to extend the those options using build.xml as a
workaround?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=416920&aid=1313421&group_id=36177

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/