Skip to content

Commit

Permalink
Use relative paths for locating libraries.
Browse files Browse the repository at this point in the history
Update the path lookup in jl_load.
  • Loading branch information
ViralBShah committed May 27, 2012
1 parent 036d055 commit f917c96
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Make.inc
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ endif
ifeq ($(OS), Linux)
INSTALL_NAME_CMD = true -ignore
SHLIB_EXT = so
RPATH = -Wl,-rpath,'$$ORIGIN/usr/lib'
RPATH = -Wl,-rpath,'$$ORIGIN/../lib'
RPATH_ORIGIN = -Wl,-rpath,'$$ORIGIN'
OSLIBS += -ldl -lrt -Wl,--export-dynamic -Wl,--version-script=$(JULIAHOME)/src/julia.expmap -Wl,--no-whole-archive $(LIBUNWIND)
WHOLE_ARCHIVE = -Wl,--whole-archive
Expand All @@ -180,7 +180,7 @@ endif
ifeq ($(OS), FreeBSD)
INSTALL_NAME_CMD = true -ignore
SHLIB_EXT = so
RPATH = -Wl,-rpath,'$$ORIGIN/usr/lib' -Wl,-z,origin
RPATH = -Wl,-rpath,'$$ORIGIN/../lib' -Wl,-z,origin
RPATH_ORIGIN = -Wl,-rpath,'$$ORIGIN' -Wl,-z,origin
WHOLE_ARCHIVE = -Wl,--whole-archive
NO_WHOLE_ARCHIVE = -Wl,--no-whole-archive
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ sys.ji: VERSION sys0.ji base/*.jl
$(QUIET_JULIA) cd base && ../julia `test -f ../sys.ji && echo stage1.jl || echo -J sys0.ji stage1.jl`

install: release
install -d $(DESTDIR)$(PREFIX)/julia/usr/lib
install -d $(DESTDIR)$(PREFIX)/julia/usr/lib/julia
install -d $(DESTDIR)$(PREFIX)/julia/usr/sbin
install -d $(DESTDIR)$(PREFIX)/julia/usr/etc
install -d $(DESTDIR)$(PREFIX)/julia/base
Expand Down
2 changes: 1 addition & 1 deletion src/builtins.c
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ char *jl_find_file_in_path(const char *fname)
int fid = open (fpath, O_RDONLY);
// try adding julia home
if (fid == -1 && julia_home && fname[0] != '/') {
if (-1 != asprintf(&fpath, "%s/%s", julia_home, fname))
if (-1 != asprintf(&fpath, "%s/../lib/julia/%s", julia_home, fname))
fid = open (fpath, O_RDONLY);
}
if (fid == -1) {
Expand Down
4 changes: 2 additions & 2 deletions src/dlload.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ uv_lib_t *jl_load_dynamic_library(char *fname)
handle->handle = NULL;
if (modname[0] != '/') {
if (julia_home) {
/* try julia_home/usr/lib */
/* try julia_home/../lib */
strncpy(path, julia_home, PATHBUF-1);
strncat(path, "/usr/lib/", PATHBUF-1-strlen(path));
strncat(path, "/../lib/", PATHBUF-1-strlen(path));
strncat(path, modname, PATHBUF-1-strlen(path));
strncat(path, ext, PATHBUF-1-strlen(path));
error = uv_dlopen(path, handle);
Expand Down
2 changes: 1 addition & 1 deletion src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ void julia_init(char *imageFile)
jl_current_module = jl_core_module;
jl_init_intrinsic_functions();
jl_init_primitives();
jl_load("src/boot.jl");
jl_load("../../../src/boot.jl");
jl_get_builtin_hooks();
jl_boot_file_loaded = 1;
jl_init_box_caches();
Expand Down

0 comments on commit f917c96

Please sign in to comment.