From 31b6bd20925883e58f6bdb04bf42cdc6a5788f67 Mon Sep 17 00:00:00 2001 From: Mark Donszelmann Date: Tue, 24 Jul 2007 06:27:56 +0000 Subject: Fixed a problem linking staticall with libstdc++ on MacOSX; NARPLUGIN-129 --- src/net/sf/antcontrib/cpptasks/CCTask.java | 10 +++++++--- src/net/sf/antcontrib/cpptasks/gcc/GppLinker.java | 15 ++++++++++----- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/net/sf/antcontrib/cpptasks/CCTask.java b/src/net/sf/antcontrib/cpptasks/CCTask.java index b385393..a7945b6 100644 --- a/src/net/sf/antcontrib/cpptasks/CCTask.java +++ b/src/net/sf/antcontrib/cpptasks/CCTask.java @@ -742,16 +742,20 @@ public class CCTask extends Task { // BEGINFREEHEP int noOfCores = Runtime.getRuntime().availableProcessors(); + log("Found "+noOfCores+" processors available"); if (maxCores > 0) { noOfCores = Math.min(maxCores, noOfCores); + log("Limited processors to "+noOfCores); } int noOfFiles = targetsForConfig.size(); - if (noOfFiles < noOfCores) - noOfCores = targetsForConfig.size(); + if (noOfFiles < noOfCores) { + noOfCores = noOfFiles; + log("Limited used processors to "+noOfCores); + } Set[] sourceFiles = new HashSet[noOfCores]; for (int j = 0; j < sourceFiles.length; j++) { - sourceFiles[j] = new HashSet(targetsForConfig.size() + sourceFiles[j] = new HashSet(noOfFiles / sourceFiles.length); } Enumeration targetsEnum = targetsForConfig.elements(); diff --git a/src/net/sf/antcontrib/cpptasks/gcc/GppLinker.java b/src/net/sf/antcontrib/cpptasks/gcc/GppLinker.java index 9a70451..c57845e 100644 --- a/src/net/sf/antcontrib/cpptasks/gcc/GppLinker.java +++ b/src/net/sf/antcontrib/cpptasks/gcc/GppLinker.java @@ -77,16 +77,21 @@ public class GppLinker extends AbstractLdLinker { } } // BEGINFREEHEP link or not with libstdc++ +// for MacOS X see: http://developer.apple.com/documentation/DeveloperTools/Conceptual/CppRuntimeEnv/Articles/LibCPPDeployment.html runtimeLibrary = null; gccLibrary = null; if (linkType.linkCPP()) { if (linkType.isStaticRuntime()) { - String[] cmdin = new String[]{"g++", "-print-file-name=libstdc++.a"}; - String[] cmdout = CaptureStreamHandler.run(cmdin); - if (cmdout.length > 0) { - runtimeLibrary = cmdout[0]; + if (isDarwin()) { + runtimeLibrary = "-lstdc++-static"; } else { - runtimeLibrary = null; + String[] cmdin = new String[]{"g++", "-print-file-name=libstdc++.a"}; + String[] cmdout = CaptureStreamHandler.run(cmdin); + if (cmdout.length > 0) { + runtimeLibrary = cmdout[0]; + } else { + runtimeLibrary = null; + } } gccLibrary = "-static-libgcc"; } else { -- cgit v1.2.3