Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set install name to full install path by default on macOS, closes #4. #5

Merged
merged 1 commit into from
May 17, 2023

Conversation

biergaizi
Copy link
Contributor

@biergaizi biergaizi commented May 15, 2023

On macOS, running a build of openEMS installed to a custom location will fail. The RPATH for the custom location is not set correctly, only system directories are searched, as a result, fparser cannot be found (Bug #4).

$ ~/opt/bin/openEMS
dyld[90539]: Library not loaded: libfparser.4.dylib

Curiously, only fparser is affected, other libraries such as CSXCAD is not.

After some investigation, I found the root cause is that the "install name" of libfparser does not contain a full path, but CSXCAD's "install name" is an absolute path. Thus, CSXCAD can be found correctly using the absolute install path, but libfparser cannot. After CSXCAD and openEMS are built, this incomplete install name will propagate upwards, so all binaries will have a wrong search path for libfparser.

$ otool -D ~/opt/lib/libCSXCAD.dylib
/Users/gentoo/opt/lib/libCSXCAD.dylib:
/Users/gentoo/opt/lib/libCSXCAD.0.dylib

$ otool -D ~/opt/lib/libfparser.4.5.1.dylib
/Users/gentoo/opt/lib/libfparser.4.5.1.dylib:
libfparser.4.dylib

This commits set the install name of fparser to its full install path by default on macOS, so it behaves consistently to libCSXCAD.

…iebig#4.

On macOS, running a build of openEMS installed to a custom location
will fail. The RPATH for the custom location is not set correctly,
only system directories are searched, as a result, fparser cannot be
found.

    $ ~/opt/bin/openEMS
    dyld[90539]: Library not loaded: libfparser.4.dylib

Curiously, only fparser is affected, other libraries such as CSXCAD is
not.

After some investigation, I found the root cause is that the "install
name" of `libfparser` does not contain a full path, but CSXCAD's "install
name" is an absolute path. Thus, CSXCAD can be found correctly using the
absolute install path, but `libfparser` cannot. After CSXCAD and openEMS
are built, this incomplete install name will propagate upwards, so all
binaries will have a wrong search path for `libfparser`.

    $ otool -D ~/opt/lib/libCSXCAD.dylib
    /Users/gentoo/opt/lib/libCSXCAD.dylib:
    /Users/gentoo/opt/lib/libCSXCAD.0.dylib

    $ otool -D ~/opt/lib/libfparser.4.5.1.dylib
    /Users/gentoo/opt/lib/libfparser.4.5.1.dylib:
    libfparser.4.dylib

This commits set the install name of fparser to its full install path
by default on macOS, so it behaves consistently to libCSXCAD.

Signed-off-by: Yifeng Li <tomli@tomli.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants