Mac Osx Set Library Path

The default layout for installed Haskell components follows the conventions of most unix-like systems. On Mac OS X, this layout isn't optimal, and a different layout is used. The layout presented here has several advantages:

  • Follows Apple's Guidelines for file system layout
  • Makes it easy for a user to locate all the Haskell components, especially user installed packages
  • Enables easy removal of a user installed package, whether they have installed it --user or --global.
  • Facilitate creation of unified, hyper-linked Haddock documentation, optionally with source

The right and wrong way to set Python 3 as default on a Mac There are several ways to get started with Python 3 on macOS, but one way is better than the others. 01 Dec 2020 Matthew Broberg (Red Hat) Feed Moshe Zadka (Correspondent) Feed. This post shows how to add an entry to the Mac OS X PATH variable - (1) for the current terminal session only, (2) permanently for the current user only and (3) permanently for all users on a Mac OS X system. Here, the Tomcat startup.sh executable is used as an example. To set DYLDLIBRARYPATH on MAC OS X 10.11 and newer, you must use the following syntax when running an application ('run.app'): DYLDLIBRARYPATH= '/my/path/to/mcr'./run.app This is because dynamic library environment variables are no longer copied to child processes, due to System Integrity Protection.

Haskell Platform 2011.2.0.0 (March 2011) and later uses this layout and sets up cabal to use it for built packages. On new installs, if you didn't already have a ~/.cabal/config file, then it is set up by default. Otherwise, the config file for this layout is placed in ~/.cabal/config.platform and you can manually move it over, or incorporate it into your existing config file.


Specify the java.library.path on the command line by using the -D option. Put the.jnilib in /Library/Java/Extensions/. Call System.load to load the shared library from an explicitly specified absolute path. I try set PATH library but it not work Help me pls thank you. MacBookPro, Mac OS X (10.6.2) Posted on Mar 24, 2010 1:45 AM.

Implementations

Haskell implementations are generally installed for use by all accounts on thesystem. They consist of large collections of executables, libraries, and otherfiles. These are packaged using Apple's framework, versioning, and bundlingtechniques and installed in:

For example, GHC 7.0.2 is installed in:

Executables intended for use from the command line, are be symlink'd into:

[Q: Would /usr/local/bin be more appropriate? ]

Packages that come with the implementation, are be located within the Frameworkbundle.

If the implementation has any GUI applications, these are installed in:

NB: These guidelines allow for multiple implementations and multipleversions to co-exist. (With the exception of multiple versions of GUI applicationswhich can only be done by distinct naming, and the symlinks in /usr/binwhich can achieved in the normal way: Append the version number to the executableand then symlink the 'bare' name to the most recent.

If implementations want to be able to be installed 'per user', then the abovepaths should be:

Not all software for Mac OS X offers a 'per user' option on installation, and whilenice, it is by no means universal.

User Installed Packages

User installed packages are placed under a 'prefix' that depends on if the userchoose to install for all users (--global) for just their own use (--user):

Package Component Layout

Cabal offers a large amount of flexibility in where the various pieces of a packageare installed. The GHC package system is rather agnostic about where these pieces are,and insulates the implementation from such differences. These combine to enable thechoice of package layout to be largely to serve the user.

For both --global and --user installs, this is the recommended package layout on Mac OS X:

This can be achieved with the following cabal configuration defaults:

N.B.:

Mac Osx Set Library Path Diagram

  • Cabal configuration files don't actually support ~. You must replace that with /Users/xxx where xxx is your account name.
  • All packages for a given compiler are under a single directory. When an old compiler is removed, all the packages compiled for it can be easily removed too.
  • All components for a package are under a single directory. This facilitates easy location and removal of a single package, for either a single compiler, or all installed versions.
  • If a package generates different doc for different compilers (it may have different APIs available), then this structure preserves each.
  • Executables are also per compilation, which is sometimes important (for Haddock, for example).

Executables

Mac Osx Set Library Pathology

Packages that build executables to be run from the command line present a difficultly. They are built into a per-package bin directory, and then should be symlink'd somewhere on the user's PATH. For global installs, the logical place is one of:

For user installs, since ~/bin is not on the PATH by default on Mac OS X and may not exist, binaries are symlink'd into:

Alas, cabal only supports one location for both kinds of build, and so it is set to be the later.


References

Retrieved from 'https://wiki.haskell.org/index.php?title=Mac_OS_X_Common_Installation_Paths&oldid=58634'

Application users often need to organize their applications within their file systems in a way that makes them more efficient to use. This capability is easy to provide for a single binary because the location of its dependent libraries is easy to determine: They may reside at a standard location in the file system or at a location relative to the binary itself. However, when dealing with a set of applications that share dependent libraries (for example, in an application suite), providing users the ability to relocate the suite directory is more difficult: Either the suite’s dependent libraries must be located outside the suite directory, or each of the suite’s executables must be linked taking into account its position within the suite. In OS X v10.5 and later the linker and dynamic loader offer a simple way of allowing multiple executables in an application suite directory to share dependent libraries while providing the suite’s users the option of relocating the suite directory. Using run-path dependent libraries you can create a directory structure containing executables and dependent libraries that users can relocate without breaking it.

A run-path dependent library is a dependent library whose complete install name is not known when the library is created (see How Dynamic Libraries Are Used). Instead, the library specifies that the dynamic loader must resolve the library’s install name when it loads the executable that depends on the library.

To use run-path dependent libraries, an executable provides a list of run-path search paths, which the dynamic loader traverses at load time to find the libraries.

This article describes how to create run-path dependent libraries and how to use them in executables.

Creating Run-Path Dependent Libraries

To create a run-path dependent library, you specify a run-path–relative pathname as the library’s install name. A run-path-relative pathname uses the @rpath macro to specify a path relative to a directory to be determined at runtime. A run-path–relative pathname uses the following format:

These are examples of run-path–relative pathnames:

  • @rpath/libMyLib.dylib

  • @rpath/MyFramework.framework/Versions/A/MyFramework

Osx

A run-path install name is an install name that uses a run-path–relative pathname. You specify a run-path install name while creating the dependent library using the gcc -install_name option. See the gcc man page for more information.

Using Run-Path Dependent Libraries

Macos set java.library.path

To use run-path dependent libraries (those using run-path install names) on an executable, you specify one or more run-path search paths with the ld -rpath option (each -rpath clause specifies one run-path location). When the dynamic loader (dyld) loads the executable, it looks for run-path dependent libraries in the run-path search paths in the order in which they were specified at link time.

This is an example of a list of run-path search paths:

Note: Run-path dependent libraries can also be used as regular dependent libraries by specifying absolute pathnames instead of run-path–relative pathnames in -rpath clauses and ensuring that the libraries reside at the specified locations.



Copyright © 2012 Apple Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2012-07-23