Building Relationships Mac OS

Posted on  by
Maintainer:Cameron Eagans <me@cweagans.net>

First, you should git clone into somewhere local. Second, using one of the building tools, e.g., CMake, ninja, make, etc, to generate clang configuration files. Then, write down your own code in clang/tools/ or clang-tools-extra/ and modify relating cMakeLists.txt to let the building tool know how to build your own tool.

This part of the documentation is written by Cameron Eagans, a co-maintainer of Universal Ctags and the maintainer ofthe OSX packaging of this project.

Build Prerequisites¶

  1. The history of macOS, Apple's current Mac operating system originally named Mac OS X until 2012 and then OS X until 2016, began with the company's project to replace its 'classic' Mac OS.That system, up to and including its final release Mac OS 9, was a direct descendant of the operating system Apple had used in its Macintosh computers since their introduction in 1984.
  2. Downloaded the iso image and proceeded to make a Mac OS X bootable USB on windows. To create a bootable media to install Mac OS X leopard on my old macbook A1181. I used imageusb and installed. I was very happy to find this 10.5.4 version which worked perfectly. Many thanks to all.
  3. This document illustrates how to build OS X Bundle (FlightGear.app) with cvs-head on Mac OS 10.4.x/10.5.x with Xcode 3.0 or later. Requirements System Requirements. Mac OS 10.5.x (Leopard) or higher; Xcode 3.0 or higher as of Oct-18-2008; PPC / Intel Mac Faster machine (G5 or Intel) is recommended as FlightGear-cvs with OSG is heavier than 0.9.

Building ctags on OSX should be no different than building on GNU/Linux. The same toolchains are used, and the Mac OSpackaging scripts use autotools and make (as you’d expect).

You may need to install the xcode command line tools. You can install the entire xcode distribution from the App Store,or for a lighter install, you can simply run xcode-select--install to only install the compilers and such. Seehttps://stackoverflow.com/a/9329325 for more information. Once your build toolchain is installed, proceed to the nextsection.

At this point, if you’d like to build from an IDE, you’ll have to figure it out. Building ctags is a pretty straightforwardprocess that matches many other projects and most decent IDEs should be able to handle it.

Building Manually (i.e. for development)¶

You can simply run the build instructions in README.md.

Building with Homebrew¶

Homebrew (https://brew.sh/) is the preferred method for installing Universal Ctags for end users. Currently, the processfor installing with Homebrew looks like this:

Building

Eventually, we hope to move the Universal-ctags formula to the main Homebrew repository, but since we don’t have anytagged releases at this point, it’s a head-only formula and wouldn’t be accepted. When we have a tagged release, we’llsubmit a PR to Homebrew.

If you’d like to help with the Homebrew formula, you can find the repository here:https://github.com/universal-ctags/homebrew-universal-ctags

Differences between OSX and GNU/Linux¶

There other things where building ctags on OSX differs from building on GNU/Linux.

  • Filenames on HFS+ (the Mac OS filesystem) are case-preserving, but not case-sensitive in 99% of configurations. If auser manually formats their disk with a case sensitive version of HFS+, then the filesystem will behave like normalGNU/Linux systems. Depending on users doing this is not a good thing.

Contributing¶

This documentation is very much a work in progress. If you’d like to contribute, submit a PR and mention @cweagans forreview.

The Cyrus SASL v2 distribution now supports Mac OS X, includingapplications written to Apple’s Carbon and Cocoa interfaces, as wellas the standard Unix-like API. It includes the followingcomponents:

  • A port of the Unix SASL library, which lives in /usr/local/lib/libsasl2.dylib(or similar) and with plugins in /usr/lib/sasl (which should be a symlink to /usr/local/lib/sasl).
  • A framework which lives in/Library/Frameworks/SASL2.framework, and allows the use of the-framework option to Apple’s ld, or linking with theframework in Project Builder. This framework is in fact a wrapper for asymlink to /usr/local/lib/libsasl2.dylib with the necessaryinformation to recognize it as a framework. This is what we expect manyCocoa and Carbon Mach-O applications will want to use, and the frameworkis required for CFBundle to work, which is used by the CFM glue library.
  • A CFM glue library (/Library/CFMSupport/SASL2GlueCFM) whichcan be linked in by Carbon CFM applications, that uses CFBundle to bindthe framework and thus load the Unix-level library. It automatically loadsthe important functions at sasl_client_init orsasl_server_init time; it also automatically makes sure memoryallocation works if you’re using the metrowerks malloc; if you’re not,sasl_set_alloc works as usual.
  • A Carbon port of the existing CFM library for Mac OS 9. Note thatthis could probably be modified fairly easily to work on OS X, butthere’s not much point. The CFM glue layer to the Unix librarysupports many more functions, including the entire server API; also,the Unix implementation is mostly independent of Kerberosimplementation, while the Mac OS 9 Carbon port specifically requiresMIT Kerberos for Macintosh 3.5 or later in order to get Kerberossupport. The Mac OS 9 code implements only the client API, but this ismostly what is wanted from SASL on OS 9 anyway.

Building Relationships Across Organizations

If you are building a Carbon CFM application and intend it to run onboth OS 9 and OS X, you should link against the OS 9 Carbon SASLlibrary, since it exports fewer APIs (client side only, specifically)than the OS X CFM glue. Your application should work seamlessly withboth libraries if you do this, despite the different implementationsunderneath.

If you need a Carbon CFM application to support server-side SASLfunctionality, you need to link against the SASL2GlueCFMlibrary, but be aware that your application will not run on OS 9.

Compiling and Using the Unix library¶

New Mac Os 11

The Unix library is mostly ready to build on Mac OS X, but it does dependon the dlcompat package in order to load its plugins.dlcompat-20010505 is a relatively simple version known to workwith SASL; it is provided with the distribution in a tarball. You shouldmake and makeinstall the dlcompat library(which probably goes into /usr/local/lib/libdl.dylib) beforeattempting to ./configure the SASL distribution itself. SASL willthen pretend it’s a real Unix libdl, and link against it.

Since there are, at this point, newer and far more complex versions ofdlcompat, you may prefer to use those instead if other software requirestheir functionality. The dlcompat homepage is located on the OpenDarwinsite. Many users may want to install the /sw tree from the Fink project to get this, aswell as possibly newer autotools and other software.

Mac Os Catalina

As of version 2.1.16, SASL uses and requires a recent version of GNUautotools (autoconf, automake, and libtool) to build its configuration scripts.If you are building from GIT, you will need to have the autotools installedon your system. The version included with all releases of the developer toolsfor OS X 10.2.x is too old for this; if you aren’t using OS X 10.3 or later,you should upgrade to more recent patchlevels of these tools. The easiest wayto do this is to install the Fink environment and then apt-getinstallautoconf2.5automake1.7libtool14.

Recent versions of SASL ship with Kerberos v4 disabled by default.If you need Kerberos v4 for some reason, and you are using MIT Kerberosfor Macintosh 4.0 or later, you should ./configure withthe added options '--enable-krb4=/usr--without-openssl--disable-digest' so that it finds thecorrect location for the header files, and does not use OpenSSL orbuild anything that depends on it (such as the digest-md5 plugin),since OpenSSL provides its own DES routines which do not work withKerberos v4.

Warning

Please read the “Known Problems” section at the end ofthis document for more information on this issue.

Mac Os Download

You must be root to make install, since /usr/local is onlymodifiable by root. You need not enable the root account usingNetInfo; the recommended (but underdocumented) method is to usesudo-s from the Terminal window when you are logged into anadministrator’s account, and enter the password for that account. Whenbuilding on Mac OS X, makeinstall will automatically add theframework to /Library/Frameworks.

This does not build the CFM glue library. Building the CFM gluelibrary requires Metrowerks CodeWarrior Pro 6 or later (tested with6), and the files necessary to build it are in themac/osx_cfm_glue folder.

Changes to the Unix library to make it work on OS X¶

This is provided for reference purposes only. The build system willautomatically take care of all of these issues when building on Darwinor Mac OS X.

  • The random code supports the preferred way to generate randomnumbers in Darwin. (In SASL v2, it does this on all unix-likeplatforms that lack jrand48). Note that Mac OS X “Jaguar”, version10.2,now has the standard jrand48 function, and that SASL will use thisinsteadof the previous workaround.
  • Symbols which are dlopened have an underscore prefixed. (Thisbehavior is detected by configure in SASL v2.)
  • Plugins are linked with the -module option to libtool,which causes the -bundle option to besupplied to Apple’s ld. (This is done on all platforms inSASL v2.)
  • The MD5 symbols are renamed to avoid library conflicts. Thisallows proper compilations against Heimdal and MIT’s unix kerberosdistribution, and prevents crashes when linked against MIT Kerberosfor Macintosh (which also duplicates the symbols, but in a differentway). Note that the MD5 symbols have local names on all platforms withSASL v2; this was only different in SASL v1.
  • MIT Kerberos for Macintosh 4.0 and later are fully supported. Thiswas accomplished by using krb_get_err_text if available andchecking for additional names for the krb4 libraries.

Changes to the Mac OS 9 projects to support Carbon¶

Warning

Please read these notes before you attempt to build SASL for OS 9 Carbon!

  • Important! You must make sure that all files have theircorrect HFS filetype before starting to build this code! Inparticular, all source and text files must be of type 'TEXT',which is not the default if you use the Mac OS X GIT client to checkout the projects. If you run into this problem, you may want to use autility such as FileTyper to recursively change the type on allfiles. CodeWarrior is less picky about the projects’ filetypes, butsetting them to filetype 'MMPr', creator code 'CWIE'may be helpful in opening the projects from the Finder. Users on Mac OSX familiar with the Unix findcommand should be able to rig /Developer/Tools/SetFileto do this job as well.
  • Many of the important projects (for libdes, libsasl,build_plugins, and the sample client sc_shlb)have Carbon versions.
  • Plugins are loaded from a Carbon subfolder of the SASLv2 folder in the Extensions folder. Plugins directlyin the SASLv2 folder are considered to be for the Classiclibraries.
  • Note that when using the build_plugins project, you mustgenerate the plugin init files using the makeinit.sh script inthe plugins directory. The easiest way to do this is to run thescript from a Unix shell, such as Mac OS X. You must then fix thefiletypes of the generated source files (see above).
  • There is a new folder in CommonKClient called mac_kclient3which contains code compatible with MIT’s new KClient3.0API. This folder must be in your CodeWarrior access paths, theold mac_kclient folder must not, and it must precede theproject’s main folder.
  • The kerberos4 plugin uses this new code. The kerberos4 pluginalsostatically links the Carbon libdes, and no other part ofCarbon SASL uses libdes directly. Your application should**not* link against* libdes.shlbunder Carbon!(It causes problems due to DES symbols also existing in the MITKerberos library, which loads first.)
  • To build the projects, you should have the MIT Kerberos forMacintosh 3.5 installation disk images mounted, since the access pathsinclude the absolute paths to the library directories from thatimage. It’s easier than you having to find the paths yourself, andsmaller than having to distribute the libraries with SASL.

Known Problems¶

  • The Kerberos v4 headers bundled with Mac OS X (and Kerberos forMacintosh) are not compatible with OS X’s OpenSSL headers. (Kerberos v4support is disabled by default.) If you actually need krb4 support, theeasiest solution is to build without using OpenSSL’slibcrypto. To do this, specify the --without-openssloption to configure. As of version 2.1.18, this automaticallydisables using libcrypto for DES as well. You will probablyalso need to specify --disable-digest since the digestmd5 plugindoes not build against Kerberos v4’s DES headers or library. Note thatthis disables several features (DIGEST-MD5, NTLM, OTP, PASSDSS, SCRAM, SRP)which require OpenSSL. If both Kerberos v4 and functionality that requiresOpenSSL are needed, it is possible to build the Kerberos v4 plugin againstthe correct K4 DES libraries, and everything else against OpenSSL;however, we do not support that configuration.
  • Versions of Cyrus SASL prior to 2.1.14 with support for CarbonCFM applications on Mac OS X have a known bug involving the CFM gluecode (in mac/osx_cfm_glue). If sasl_done is calledto unload the SASL library, and then one of the initializationfunctions (such as sasl_client_init) is called toreinitialize it from the same process, the application will crash. Afix for one obvious cause of this problem is included in 2.1.14;however, as of this writing, it has not been tested. It is possiblethat other bugs in Cyrus SASL, or deficiencies in Apple’s libraries,will make this fix insufficient to resolve this issue.