Compile Universal Binary For Mac

Apr 17, 2011 Building universal binary on Mac. So I'm hoping to have better luck here. How can I build a universal binary for my CUDA code? Nvcc requires you to specify either -m32 or -m64. I want it to build both. This should be simple, since nvcc is just wrapping gcc, which knows how to compile for multiple architectures.
Current OSes If you have access to the Mac pc App Shop, you will discover Xcode generally there as a free download. Old Macintosh OSes Very first you need to install a compiler.
These are instructions on how to build Code::Blocks under Apple Mac OS X. They have been tested under Mac OS X version 10.4 (PowerPC and Intel), and should work similarly on the newer Mac OS X 10.5 and 10.6 as well. I want to compile jpeg-8b in universal binary (ppc,i386). It should be supported in 10.4 and later OSs' I could do it in 10.5 and 10.6, But the binary is not compatible with 10.4 So i tried com. If you want truly universal libraries it might be needed that you compile the libraries yourself, especially as newer versions (e.g. Snow Leopard) only support 'universal' binaries and libraries with the i386 and x86_64 architectures while OpenTTD's universal binaries can also include ppc, ppc64 and ppc970.
You should do this by installing Xcode (Requires 0SX 10.3+) They should become on the CD / Dvd and blu-ray when you got your OS. You can also down load it from the Apple company Developer Link web web site (free of charge registration required), although it is certainly over 3gn in dimension.
This contains, amongst many other stuff, gcc (in thé UNIX Dev Support deal), which is the compiler that are usually utilized by most opensource projects, like OpenTTD. Take note By default, this will furthermore set up the i0S SDK, which yóu probably gained't need. You can unchéck it in thé final installation configurations or simply disagree with its license to conserve several gigabytes of disc space. Setting up required libraries In order to build OpenTTD from supply you require to possess installed some which it is dependent upon. Based upon your local set up you maybe also want to install a(nother) edition control system like svn ór mercurial in purchase to get the most recent trunk resource of OpenTTD. The minimal requirements for OpenTTD ón mac aré:.
(it's component of the xzUtils) and optionally you wish also:. For obtaining the openttd supply, you will néed:. OR:.
OR:. AIl of the over are usually installable using MacPorts. And are usually not needed on mac. Comes along with the Operating-system so you wear't need to install zlib.
On 0SX 10.6.1 it may furthermore be necessary to install:. The least difficult answer in order to get these libraries is definitely to have possibly, or install them for you. On the other hand, you may put together and install it from supply for yourself. As another option you may visit the webpages of those your local library and observe whether they offer ready-compiled binary versions.
At minimum libpng will so. Please refer to the for instructions on how to install Homebrew. Making use of MacPorts is certainly an open-source group initiative to design an easy-to-use system for putting together, installing, and updating either command-line, A11 or Aqua centered open-source software program on the Mac pc OS Times operating program. As you will install your local library in your system web directories, you'll want to do therefore as owner via the command sudo - which will need you to enter the boss password. Additional information regarding sudo can become discovered on. Setting up libraries with MacPorts Before installing any your local library, make sure you possess accessibility to the latest ports by upgrading the regional database: sudo slot selfupdate. Take note If you desire to compile universal binaries to distribute, include ' +universal' at the end of each line.
(Everything will need to become compiled very first, so have got patience.) Install libpng, liblzma' (provided by xz package deal)', pkgconfig (needed for lzma detection), lzo2 and libiconv (the required zlib will be set up as dependency immediately). Sudo port install libpng sudo slot install xz sudo interface install pkgconfig sudo port install lzo2 sudo interface install libiconv At least in purchase to put together a static binary (for redistribution), but furthermore for your convenience, you might would like these mainly because properly: sudo interface install fontconfig sudo port install freetype sudo port install icu Getting the resource Fór SVN: svn chéckout This will set up OpenTTD in a folder known as trunk area. For HG: hg duplicate This will install OpenTTD in á folder. (The name differs with every edition.) For GIT: git duplicate This will set up OpenTTD in a folder. Take note Some of these possess iconv as a reliance. That means you'll end up with two iconv variations on your hard disc: one supplied by apple in /usr/Iib and one installed by macports in /opt/regional/lib.
Those two are usually not suitable and define different symbols and are usually different variations. You can briefly disconnect macport't libiconv ('sudo port deactivate libiconv') as normally you might finish up in some situations with a linker failure (observe ).
But this might render your edition that relies on macport's i9000 version useless Some additional information on MacPorts It might become well worth to risk a look at the. If you require for one or another reason an old(er) library edition, a brief walk-through is certainly. Take note There are problems with some gcc variations which are usually supplied by macports. Use one of thé apple-supplied compiIers if faiIs with illegal compiler fights. You can change the compiler getting used by setting up gccselect package from macports, after that using slot select Enjoyment reality: if you have got set up yourself your local library and develop them for various other architectures than times8664 i386 ppc and ppc64 it might fail. Those four seem to become recognized, but macpórts might bitch, if others are usually discovered like ppc970.
Making use of fink fink is basically the same as macpórts, but it máy not be simply because well supported on newer OSX; this component of the paperwork is furthermore very outdated and provides not been recently examined to work in many years. Take note: fink is usually only used for setting up svn and libpng. Also though it's suggested, it's not really mandatory anymore. Fink will be a good device to install open-source software program with basic commands. You can get fink here. Warning If you installed iconv-dev making use of fink, create sure that you possess at least edition 1.11 or filenames/file accessibility (savegames, situations.) will not work properly Before setting up ánything with fink, you shouId revise fink (actually if you simply installed it). This is certainly because fink have some local files, where it looks up what edition of the software it should set up.
If a brand-new version is usually away, it'h ridiculous to install an currently outdated edition. You can revise fink with the command fink selfupdate Installing the svn customer with fink Like you set up the libs, you can right now install the svn client with the command: fink instaIl svn-client lf you have Mac Operating-system A Leopard, you already possess svn. In a fatal window type svn -edition to check out it. Setting up your local library with fink You need some your local library to link to when compiling. You can use fink to install them with the following commands in airport terminal: fink install libpng3 libpng3 can be needed for producing screenshots in png.
Not really really required today, but there are usually future programs, so you might as well get it right now. In each case, fink will tell that you that you require to set up a great deal of some other stuff too, just hit enter (answering yes) and fink wiIl download and instaIl all óf it. The documents informing about how to compile OpenTTD shows about zlib. Zlib is certainly needed by OSX itself, so you already have got it and there can be no want to set up it.
Setting up personally If you desire really universal your local library it might end up being needed that you compile the your local library yourself, specifically as newer variations (y.g. Snow Leopard) just support 'universal' binaries and libraries with the i actually386 and a8664 architectures while OpenTTD't universal binaries can furthermore include ppc, ppc64 and ppc970. There's no build script to obtain the necessary universal your local library, but some steps which can become adopted will obtain you presently there.
get the source of the library. make certain it compiles with your typical configurations w/o adjustment.
develop all different architectures. Caution The homebrew web pages contains guidance concerning how to deal with directories usually only writable by main (requiring the admin security password) and states as tó which of thése “could securely be deleted”. It cannot become suggested to stick to any of this advice if you are not 100% certain of what you perform. You may damaged your program without possibility to recuperate it. Getting the newest resource from the svn machine Today you require to make a 'working copy' of the source with your new svn customer. To perform this, use your terminal and create: svn checkout FoIdername Foldername will end up being the folder you place the resource into. If thé folder doesn'testosterone levels can be found, it will become created.
Take note you might have got to type rehash after you set up svn to be capable to perform this. You can furthermore select as specific revising to download by incorporating -ur##### after svn checkout. Producing the supply For those just seeking a operating duplicate for themselves, enter the sticking with into a terminal screen: cd /Downloads/directorycontainingdownloadedsources./configure create make package After the compiler is definitely done carrying out all it's i9000 stuff, you should discover yourself a working OpenTTD.app in the packages folder! For more detailed directions, and options, go through on. Applying a repair If you want to make use of a repair/diff document after that you have to use it before using configure. This will be performed in the same method as ón Linux so yóu should study this: Configure There is a configure software. This will be utilized to body out what your program is usually like and produce a makefile to compile a binary created for your program.
To operate it, just create./configure and it will body everything out on its very own. If you have a exclusive request for your compilation, after that you need to provide quarrels to configure. To discover a full list of obtainable settings, use the help system (./configure -assist) Illustration: if you want to create a stationary construct (the binary will consist of the required components of the libraries so they do not have to end up being installed on the pc enjoying the sport), you will possess to kind./configure -enable-static. This is suggested for Macintosh OS Back button builds. Several quarrels can become included like./configure -enabIe-static -enable-dédicated. If you don't have svn, and are attempting to put together a nightly, configure with./configure -modification=rXXXXX (where XXXXX is the revision amount).
Configuring on Mavericks (ánd Yosemite). There will be no liblzo2 in the bundle managers yet for Mavericks (as of 1 Nov 2013). To configure without this various library, make use of -without-liblzo2. Mac pc Operating-system 10.9 provides eliminated the method declarations associated to palettes and 8-little bit images from the CoreGraphics header data files. You may either #if 0 those pads out (in fuIlscreen.mm) or compile against the Mac pc OS 10.8 SDK.
Compile Universal Binary For Mach O
The edition of Clang that ships with Xcode 5.0.1 uses a custom made C library. To link OpenTTD, you must tell Clang to make use of the regular one. All of the over can end up being attained with this configuré command:./configure -enabIe-static -without-Iiblzo2 -without-osx-sysróot CFLAGS='-isysroot /Programs/Xcode.app/Items/Developer/Platforms/MacOSX.platform/Developer/SDKs/Mac0SX10.8.sdk' LDFLAGS='-stdlib=libstdc' Some users record linker failures with the configure command above.
Compile Universal Binary For Mac Os
The right after order may resolve those failures:./configuré -enable-static -withóut-liblzo2 -without-fréetype -without-osx-sysróot CFLAGS='-isysroot /Programs/Xcode.app/Contents/Developer/Platforms/MacOSX.system/Developer/SDKs/Mac0SX10.8.sdk' LDFLAGS='-stdlib=libstdc' Oct 2014 Upgrade - is applicable to both Mavéricks and Yosemite Apple released an Xcode upgrade for Mavericks in Oct 2014, which shows up to remove the 10.8 SDK. Sticking with this up-date, OpenTTD compiles for at minimum some customers with:./configure -withóut-freetype LDFLAGS='-stdIib=libstdc' This furthermore functions on Yosemite. lf you can supply an appropriate version of Freetype, thé -without-freetype banner might become unnecessary. Obtaining When configure provides made a makefile fór you, all yóu require to do to compile is to kind make. The binary can be then positioned in the 'rubbish bin' subdirectory. If needed, make can acknowledge arguments as well. Commonly used disputes will end up being (all of them will start by producing the video game if needed):.
make work: will start the video game. make bunch: this will make a package inside the pack directory (made if needed). This indicates that the video game will be executable from locater and not really only airport terminal.
make bundledmg: as above, but will produce a dmg. create assist: lists all 'goals' accessible (like make operate and create deal) Make also accepts standard create fights. The many interesting can be the -j choice. By defauIt GCC compiles oné document at a period and it can only make use of one Central processing unit/core to put together a individual file. If you desire to compile as quick as achievable, you can inform it to compile more documents at as soon as with the -m option. Example: create pack -j 4 will put together 4 documents at as soon as, making great use of a dualcore pc. Usually getting two files obtaining on each primary is usually the fastest ás one compile whiIe the additional one waits for read/write to the drive.
Notice: the makefile dependencies provides to be fixed up properly for this to work. While they are for OpenTTD, don't suppose this for various other tasks or awful things can happen, like odd compilation errors. If it comes to regular compiles, it might become worth to appear for substitute compilers.
Newer OSX provide also llvm-gcc binaries which provide a swiftness gain during compilation for the cost of a bit slower binaries.