#66584 closed defect (fixed)

lua50, lua52, lua @ 5.3.5_0: tests fail due to missing liblua.dylib

Reported by: harens (Haren S) Owned by: MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc:
Port: lua50, lua52, lua

Description

As part of the src-makefile patch, the lua binary is linked to liblua.dylib.

+$(LUA_DYLIB): $(BASE_O)
+       @echo "Building dynamic library (dylib)"
+       $(CC) -o $@ $(MYLDFLAGS) -dynamiclib -install_name @PREFIX@/lib/lua-@BRANCH@/liblua-@BRANCH@.dylib \
+               -compatibility_version @BRANCH@ -current_version @VERSION@ $^
+
 $(LUA_T): $(LUA_O) $(LUA_A)
-       $(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
+       $(CC) -o $@ -L. $(MYLDFLAGS) $(MYCFLAGS) $(LIBS) -llua-@BRANCH@ lua.c
 
 $(LUAC_T): $(LUAC_O) $(LUA_A)
-       $(CC) -o $@ $(LDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)
+       $(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(LUA_DYLIB) $(LIBS)

The tests, which run the lua binary, then fail since it expects liblua.dylib to be in ${prefix}/lib. It is instead in ${worksrcpath}/src.

--->  Testing lua
Executing:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_github.com_macports_macports-ports_lang_lua/lua/work/lua-5.3.5" && /usr/bin/make test
src/lua -v
dyld[12412]: Library not loaded: /opt/local/lib/liblua.dylib
  Referenced from: /opt/local/var/macports/build/_opt_local_var_macports_sources_github.com_macports_macports-ports_lang_lua/lua/work/lua-5.3.5/src/lua
  Reason: tried: '/opt/local/lib/liblua.dylib' (no such file), '/usr/local/lib/liblua.dylib' (no such file), '/usr/lib/liblua.dylib' (no such file)
make: *** [test] Abort trap: 6

I tried setting test.env DYLD_LIBRARY_PATH=${worksrcpath}/src, which didn't seem to work. lua51 builds the dynamic library, but either rightly or wrongly doesn't link to it, and so its tests pass.

Attachments (3)

lua5.3.log (53.1 KB) - added by harens (Haren S) 16 months ago.
lua5.2.log (52.9 KB) - added by harens (Haren S) 16 months ago.
lua5.0.log (61.1 KB) - added by harens (Haren S) 16 months ago.
Different errors but the missing library is still the problem

Download all attachments as: .zip

Change History (7)

Changed 16 months ago by harens (Haren S)

Attachment: lua5.3.log added

Changed 16 months ago by harens (Haren S)

Attachment: lua5.2.log added

Changed 16 months ago by harens (Haren S)

Attachment: lua5.0.log added

Different errors but the missing library is still the problem

comment:1 Changed 16 months ago by kencu (Ken)

the lua port does try to set things up for testing:

https://github.com/macports/macports-ports/blob/e4c2977140da3d850df8125acb5a9e1c3c969150/lang/lua/Portfile#L59

but newer macosx versions with SIP no longer follow/obey DYLD_LIBRARY_PATH, as it is a security hole, eg

https://developer.apple.com/forums/thread/703757

practically, you either have to use rpaths, which meson and cmake do automatically, or install the library to it’s final location then run the tests.

comment:2 Changed 16 months ago by kencu (Ken)

or build with certain library paths and then rewrite the library paths everywhere during the install phase to their final locations, which is part of what meson and cmake can do automatically as well.

comment:3 Changed 15 months ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

Owner: set to MarcusCalhoun-Lopez
Status: newassigned

comment:4 Changed 15 months ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

Resolution: fixed
Status: assignedclosed

In 2eff2f2cae835e1dd9294db577e08a06ff23506b/macports-ports (master):

lua: allow tests to find dynamic library

Fixes #66584

Note: See TracTickets for help on using tickets.