Incorrect rvm.lib library name on OS X

Description

The linker on OS X is a little funky, so when building the librvm shared library, its install path is fixed as being in the target directory:

> otool -D dist/prototype_x86_64-osx/librvm.dylib
dist/prototype_x86_64-osx/librvm.dylib:
/Users/james/socs/jikesrvm-hg/target/prototype_x86_64-osx/librvm.dylib

> otool -L dist/prototype_x86_64-osx/JikesRVM
dist/prototype_x86_64-osx/JikesRVM:
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)
/Users/james/socs/jikesrvm-hg/target/prototype_x86_64-osx/librvm.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 52.0.0)

Since we blow away the target/ folder every time we build, this means only the latest build in the dist/ folder will run on OS X (e.g. it's not possible to have working prototype and production builds side-by-side). The same is true of librvmdynlib being named incorrectly, but dlopen doesn't check target names so still loads correctly.

The attached patch fixes this by exporting DYLD_LIBRARY_PATH as well as LD_LIBRARY_PATH in the rvm script, which is sufficient for dyld to find the library. We could (and I did) also modify the build to name the library as the correct "relative" path (dyld relative paths are a hack, the correct relative path would be "@executable_path/librvm.dylib") but I don't see much point in committing that little bit of special casing so it's not in the patch.

Environment

None

Assignee

Erik Brangs

Reporter

James Bornholt

Labels

None

Components

Fix versions

Affects versions

Priority

Low
Configure