Overview
Features
Download
Documentation
Community
Add-Ons & Services

Build a universal lib on OSX ?

Please post support and help requests here.

Build a universal lib on OSX ?

Postby BigTick » 25 Mar 2011, 13:00

Hi,

Is there any way to build a universal (Intel/ppc/32-bit/64-bit) OSX binary ? Or do we have to build all the individual libs and combine them with lipo ?

'Tick
BigTick
 
Posts: 35
Joined: 28 Apr 2010, 21:07

Re: Build a universal lib on OSX ?

Postby guenter » 30 Mar 2011, 21:00

Currently you have to build for the different archs manually and then combine the builds with lipo.
Of course it would be great to have some script for this...
guenter
 
Posts: 1112
Joined: 11 Jul 2006, 16:27
Location: Austria

Re: Build a universal lib on OSX ?

Postby farfromrefuge » 04 Apr 2011, 15:16

Actually you can directtly build libs that have all the architectures you
THis is the config i use

Code: Select all
#

# $Id: //poco/1.4/build/config/Darwin#1 $

#

# Darwin

#

# Build settings for Mac OS X 10.6 (GCC 4.2)

# The build settings defined in this file are compatible

# with XCode 3.2.5 C++ projects.

#

# NOTE: This build configuration will build 64-bit binaries.

# Use the Darwin32 build configuration to build 32-bit binaries.

#



#

# General Settings

#

LINKMODE = STATIC



ARCHFLAGS          ?= -arch ppc -arch i386

POCO_TARGET_OSARCH ?= universal2

POCO_HOST_OSARCH   := $(POCO_TARGET_OSARCH)





#

# Tools

#

CC      = gcc-4.2

CXX     = g++-4.2

LINK    = $(CXX) -bind_at_load

LIB     = libtool -static -o

RANLIB  = ranlib

SHLIB   = $(CXX) -dynamiclib -o $@

DYLIB   = $(CXX) -dynamic -bundle -Wl,-bind_at_load -o $@

SHLIBLN = $(POCO_BASE)/build/script/shlibln

STRIP   =

DEP     = $(POCO_BASE)/build/script/makedepend.gcc

SHELL   = sh

RM      = rm -rf

CP      = cp

MKDIR   = mkdir -p



#

# Extension for Shared Libraries

#

SHAREDLIBEXT     = .$(target_version).dylib

SHAREDLIBLINKEXT = .dylib



#

# Compiler and Linker Flags

#

CFLAGS          = $(ARCHFLAGS) -isysroot /Developer/SDKs/MacOSX10.5.sdk

CXXFLAGS        = $(ARCHFLAGS) -Wall -Wno-sign-compare -isysroot /Developer/SDKs/MacOSX10.5.sdk

LINKFLAGS       = $(ARCHFLAGS) -isysroot /Developer/SDKs/MacOSX10.5.sdk

SHLIBFLAGS      = $(ARCHFLAGS)

DYLIBFLAGS      = $(ARCHFLAGS)

STATICOPT_CC    = -isysroot /Developer/SDKs/MacOSX10.5.sdk

STATICOPT_CXX   = -isysroot /Developer/SDKs/MacOSX10.5.sdk

STATICOPT_LINK  = -isysroot /Developer/SDKs/MacOSX10.5.sdk

SHAREDOPT_CC    = -fPIC

SHAREDOPT_CXX   = -fPIC

SHAREDOPT_LINK  =  -isysroot /Developer/SDKs/MacOSX10.5.sdk

DEBUGOPT_CC     = -O0 -g -gdwarf-2 -D_DEBUG=$(DEBUGLEVEL)

DEBUGOPT_CXX    = -O0 -g -gdwarf-2 -D_DEBUG=$(DEBUGLEVEL) -mfix-and-continue -fvisibility-inlines-hidden -fasm-blocks

DEBUGOPT_LINK   = -isysroot /Developer/SDKs/MacOSX10.5.sdk

RELEASEOPT_CC   = -DNDEBUG -Os -isysroot /Developer/SDKs/MacOSX10.5.sdk

RELEASEOPT_CXX  = -DNDEBUG -Os -fvisibility-inlines-hidden -fasm-blocks -isysroot /Developer/SDKs/MacOSX10.5.sdk

RELEASEOPT_LINK = -isysroot /Developer/SDKs/MacOSX10.5.sdk



#

# System Specific Flags

#

SYSFLAGS = -DPOCO_HAVE_IPv6



#

# System Specific Libraries

#

SYSLIBS  = -ldl

 
farfromrefuge
 
Posts: 1
Joined: 04 Apr 2011, 14:38

Re: Build a universal lib on OSX ?

Postby guenter » 07 Apr 2011, 18:49

Great! I would have thought that this does not work, but apparently it does ;-)
guenter
 
Posts: 1112
Joined: 11 Jul 2006, 16:27
Location: Austria


Return to Support

Who is online

Users browsing this forum: No registered users and 1 guest