# Software program programmer changing from Linux to OS X, what are the gotchas?

I have actually made use of Ubuntu/Fedora/Red Hat/Suse yet have not made use of OS X in all. If I need to start making use of OS X consistently, what are things I should keep an eye out for?

Devices I make use of are GNU device chain, C++/ Boost, and so on

0
2019-05-04 09:57:07
Source Share

Here is an excellent resource of picked dev write-ups, the Cocoa Literature List :

(This might be specifically valuable if eventually you intend to take advantage of Mac OS X details rewards.)

0
2019-12-05 00:40:51
Source

HUGE GOTCHA - - Mac OS filesystem is NOT instance delicate.

You might create an instance delicate disk photo on Mac OS X which can be placed as a regular disk drive quantity.

# cf. http://codesnippets.joyent.com/posts/show/8617
IMAGE="${HOME}/Desktop/Case Sensitive Test.dmg" VOLNAME="Case Sensitive Test" hdiutil create "${IMAGE}" -size 10m -fs HFSX -volname "${VOLNAME}" -layout NONE hdiutil attach "${IMAGE}"

cd "/Volumes/${VOLNAME}" touch foo.txt Foo.txt open . ls -l [Ff]oo.txt stat -f "inode: %i -- name: %N" [Ff]oo.txt cd ~ hdiutil detach "/Volumes/${VOLNAME}"

0
2019-12-05 00:34:26
Source

HUGE GOTCHA-- Mac OS filesystem is NOT instance delicate.

0
2019-05-08 02:50:23
Source

Although Fink and also MacPorts are the typical methods of obtaining unix plans on OS X, I would certainly advise looking into a more recent device called brew that has actually functioned far better for me and also messed much less with my system, and also is a lot easier to make use of. It primarily simply downloads tarballs and also installs to/ usr/local, yet it automates the entire procedure really perfectly.

0
2019-05-08 02:40:23
Source

I made the very same action years earlier. Below are things I've faced :

• Your ordinary desktop computer Linux has a richer userland than that of OS X.

You'll possibly miss out on various devices than I did, so no feeling obtaining details concerning referrals for substitutes.

Rather, simply install Fink, MacPorts, or Homebrew first point. These systems give a plan monitoring system regular of Linux or the BSDs. Each has its very own taste and also plan set, so the appropriate selection will certainly be based upon your preferences and also demands.

You might locate that no person plan system will certainly have every program you require. Some programs have yet to be ported to OS X, so they will not show up in any kind of plan system. However, these systems do substantially expand what ships with OS X, and also will certainly reduce your change from Linux.

• OS X command line compilers currently construct 64-bit executables by default.

In Leopard and also earlier, the compilers constructed 32-bit executables by default rather. This can create troubles in numerous means : possibly you have old 32-bit collections you can not restore yet need to link to, possibly you're still running your system in 32-bit setting, and so on

. One means to compel a 32-bit construct is to bypass gcc defaults in construct systems with gcc-4.0, that being the old 32-bits-by-default Leopard compiler. (gcc is a symlink to the 64-bits-by-default gcc-4.2 on Snow Leopard. ) With autoconf based construct systems, this functions :

$./configure CC=gcc-4.0 CXX=g++-4.0  (You just require the CXX little bit if the program has C++ parts. ) An additional means is to pass -m32 to the compiler and also linker : $ ./configure CFLAGS=-m32 CXXFLAGS=-m32 LDFLAGS=-m32


It's even more keying, yet it allows you get 32-bit constructs out of the more recent GCC.

• Dynamic affiliation is significantly various.

If you're the type to write your ld regulates by hand, it's time to damage that behavior. You need to rather be connecting programs and also collections via the compiler, or making use of an intermediary like libtool. These care for the niggly platform-specific link system distinctions, so you can conserve the mind power for finding out programs you can not abstract away with mobile devices.

As an example, you'll require to upgrade your muscular tissue memory so you type otool -L someprogram as opposed to ldd someprogram to identify what collections someprogram is connected to.

An additional distinction in vibrant affiliation that will certainly turn your mind in the beginning is that on OS X, the install area for a collection is videotaped in the collection itself , and also the linker duplicates that right into the executable at link time. This suggests that if you link to a collection that obtained mounted in /usr/local/lib yet you intend to deliver it to your customers in the very same directory site as the executable, you require to claim something similar to this as component of your install procedure :

$cp /usr/local/lib/libfoo.dylib .$ install_name_tool -id @loader_path/libfoo.dylib libfoo.dylib
$make LDFLAGS=-L. relink  Currently, a lot of the above is most likely to differ for your construct system, so simply take it as an instance, as opposed to a dish. What this does is makes an exclusive duplicate of a collection we link to, transforms its common collection identifier from an outright course to a family member one definition "in the very same directory site as the executable", after that compels a restore of the executable versus this changed duplicate of the collection. install_name_tool is the core command below. If rather you intended to install the collection in a ../lib directory site about the executable, the -id argument would certainly require to be @loader_path/../lib/libfoo.dylib rather. Joe Di Pol created a good article on this, with a whole lot even more information. • Dynamic affiliation + 3rd party plans can create frustrations beforehand. You are most likely to face vibrant affiliation concerns beforehand, as quickly as you start attempting to make use of collections from third-party plans that do not install the collections right into typical areas. MacPorts does this, as an example, mounting collections right into /opt/local/lib, as opposed to /usr/lib or /usr/local/lib. When you face this, an excellent solution for the trouble is to add lines like the complying with to your .bash_profile : # Tell the dynamic linker (dyld) where to find MacPorts package libs export DYLD_LIBRARY_PATH=/opt/local/lib:$DYLD_LIBRARY_PATH

export C_INCLUDE_PATH=/opt/local/include:$C_INCLUDE_PATH export CPLUS_INCLUDE_PATH=/opt/local/include:$CPLUS_INCLUDE_PATH

• OS X takes care of the CPU compatibility concern in different ways than Linux.

On a 64-bit Linux where you need to additionally sustain 32-bit for whatever factor, you wind up with 2 duplicates of points like collections that require to be in both layouts, with the 64-bit variations off in a lib64 directory site alongside the typical lib directory site.

OS X addresses this trouble in different ways, with the Universal binary principle, which allows you place numerous binaries right into a file. You can presently have executables that sustain approximately 4 CPU kinds : 32- and also 64-bit PowerPC, plus 32- and also 64-bit Intel.

It's very easy to construct Universal binaries with Xcode, yet a little a discomfort with command line devices. This obtains you a Universal Intel-only construct with Autoconf-based construct systems :

\$ ./configure --disable-dependency-tracking CFLAGS='-arch i386 -arch x86_64' \
LDFLAGS='-arch i386 -arch x86_64'


Add -arch ppc -arch ppc64 to the CFLAGS and also LDFLAGS if you require PowerPC assistance.

If you do not disable dependence monitoring, you wind up constructing just for one system, given that the visibility of newly-built .o apply for the first system encourages make(1) that it does not require to construct for the 2nd system, also. Every little thing needs to be constructed two times in the above instance; 4 times for a fully-Universal binary, if you still require PowerPC assistance.

(Extra details in Apple Technical Note TN2137. )

• The programmer devices aren't mounted on OS X by default.

Prior to Lion, one of the most trusted area to get the appropriate dev devices for your system got on the OS discs. They're an optional install.

The wonderful feature of mounting the dev devices from the OS discs is that you recognize the devices will certainly collaborate with the OS. Apple being Apple, you need to have a current variation of the OS to run the most up to date compilers, and also they have not constantly made downloads of old devices readily available, so the OS discs are usually the most convenient means to locate the right devices for an offered dev or examination box.

With Lion, they're attempting to do away with install media, so unless you acquire the pricey USB key variation, you'll need to download Xcode from the App Store.

I advise you maintain the very least a couple of variations of any kind of Xcode DMGs you download and install. When Lion's follower appears a year or 3 therefore, you could locate on your own without a means to install a coeval variation of Xcode on a Lion examination VM. Strategy in advance in instance the schedule troubles and also absence of OS media make old variations of Xcode or else inaccessible.

0
2019-05-08 00:01:26
Source