Hi Jean Louis,

On 18.03.2021 19:10, Jean Louis Faucher wrote:
> 2 URLs that could help
>
> https://stackoverflow.com/questions/45464584/macosx-which-dynamic-libraries-linked-by-binary
> <https://stackoverflow.com/questions/45464584/macosx-which-dynamic-libraries-linked-by-binary>
> try
> DYLD_PRINT_LIBRARIES=1 DYLD_PRINT_LIBRARIES_POST_LAUNCH=1 DYLD_PRINT_RPATHS=1 
> rexxj.sh ...

This did not have any effect, googling around a little bit one source says: for 
security reasons
bash does not pass on environment variables that start with DYLD_ ... however, 
if one would copy
bash to another location und use that one it would work again, PITA.

> https://blog.krzyzanowskim.com/2018/12/05/rpath-what/
> <https://blog.krzyzanowskim.com/2018/12/05/rpath-what/>

Thank you, very interesting as well, however at the end it states also:

    Controling linker with environment variables

    The behaviour of dyld may be controlled by environment variables, however 
If System Integrity
    Protection is enabled, environment variables are ignored when executing 
binaries protected by
    System Integrity Protection - that is most of the time.

    PS. it's different on Linux because different loader is used.

> From here, I could be wrong, but I understand that @rpath instructs the 
> dynamic linker to search a
> list of LC_RPATH in order, and substitute @rpath by the value of LC_RPATH to 
> locate the dynamic
> library.
>
> To display the LC_RPATH of rexx:
> otool -l rexx | grep LC_RPATH -A2
>
> The value is @executable_path/../lib
> so @rpath/librexx.4.dylib
> becomes 
> @executable_path/../lib//librexx.4.dylib
>
> rexxj.sh is launching java, not rexx.
> I assume that java and rexx are not in the same folder, so maybe it’s the 
> reason why this library
> is not found ?

On my system (even after having upgraded to "Big Sur") everything works using 
the same BSF4ooRexx
installation package as the student. (One problem I have is, that I cannot 
duplicate the behavior on
my machine but could witness it via a shared screen session watchin the 
student's Mac.)

In this use case Java loads libBSF4ooRexx.dylib which is linked against ooRexx. 
(MacOS has become
really quite pesky it turned out that the already installed otool was gone, 
probably because of some
updates by Apple and needed to reinstall the commandline tools to get the tool 
access to xcrun. Also
during the upgrade to "Big Sur" Apple forced my system - without my consent! - 
to change the login
shell from bash to zsh, which has consequences also for the BSF4ooRexx 
installation that I need to
tackle as well! :( )

Thanks to your otool sample/idea I could find and print the DYLIB related 
information from
libBSF4ooRexx.dylib:

    otool -l libBSF4ooRexx.dylib | grep DYLIB -A2

    which yields:

             cmd LC_ID_DYLIB
          cmdsize 64
             name ./tmp/libBSF4ooRexx.dylib-64-x86_64 (offset 24)
    --
              cmd LC_LOAD_DYLIB
          cmdsize 48
             name @rpath/librexx.4.dylib (offset 24)
    --
              cmd LC_LOAD_DYLIB
          cmdsize 56
             name @rpath/librexxapi.4.dylib (offset 24)
    --
              cmd LC_LOAD_DYLIB
          cmdsize 88
             name /System/Library/Frameworks/JavaVM.framework/Versions/A/JavaVM 
(offset 24)
    --
              cmd LC_LOAD_DYLIB
          cmdsize 48
             name /usr/lib/libc++.1.dylib (offset 24)
    --
              cmd LC_LOAD_DYLIB
          cmdsize 56
             name /usr/lib/libSystem.B.dylib (offset 24)

Will have to look into linking against librexx.4.dylib and librexxapi.4.dylib 
which currently is
defined as:

    ... cut ...

    CFLAGS = -fPIC
    BSF_ORX_TARGET_64  = $(BLD_PATH)/libBSF4ooRexx.dylib-64-x86_64
    ... cut ...

    LFLAGS = -shared
    ORX_LIBPATH_64 = /Library/Frameworks/ooRexx.framework/Libraries/
    ORX_LIBS_64 = $(ORX_LIBPATH_64)/librexx.dylib 
$(ORX_LIBPATH_64)/librexxapi.dylib
    ... cut ...

    g++ -c $(CFLAGS) $(INC_PATH) $(INC_PATH_ALL) -m64 -arch x86_64 -DUSE_OREXX 
-DUNIX -DBSF4REXX_64_BIT -o$(BSF_OBJ_ORX_64) BSF4ooRexx.cc
    g++ -dynamiclib $(LFLAGS) -o $(BSF_ORX_TARGET_64) $(BSF_OBJ_ORX_64) 
$(ORX_LIBS_64) -framework JavaVM -arch x86_64
    ... cut ...

The reason for "/Library/Frameworks/ooRexx.framework/Libraries/" is the 
BSF4ooRexx "full" package
includes ooRexx which gets placed there. (AFAICT I have done nothing that 
qualifies @rpath to be
used instead of that explicit path?)

As the ooRexx files get linked from /usr/local/bin and /usr/local/lib at 
installation time, I should
probably link against "/usr/local/lib" instead on MacOSX. Is there anything I 
should consider in
addition?

TIA,

---rony


>
>> On 18 Mar 2021, at 17:47, Rony G. Flatscher <rony.flatsc...@wu.ac.at
>> <mailto:rony.flatsc...@wu.ac.at>> wrote:
>>
>> Got a strange error on a student's MacBook (Mojave) which I am not able to 
>> recreate at all nor
>> have I received a comparable error report so far:
>>
>>     T-MacBook-Air:~ t.f$ rexxj.sh 
>> /Applications/ooRexx.app/Contents/utilities/ooRexxTry.rxj && exit 
>>     [BSFManager.loadScriptingEngine()] unable to load language: rexx: 
>> java.lang.UnsatisfiedLinkError: 
>> /Library/Frameworks/BSF4ooRexx.framework/Versions/A/Libraries/libBSF4ooRexx.dylib:
>>  
>> dlopen(/Library/Frameworks/BSF4ooRexx.framework/Versions/A/Libraries/libBSF4ooRexx.dylib,
>>  1): Library not loaded: @rpath/librexx.4.dylib
>>       Referenced from: 
>> /Library/Frameworks/BSF4ooRexx.framework/Versions/A/Libraries/libBSF4ooRexx.dylib
>>       Reason: image not found
>>     at java.base/java.lang.ClassLoader$NativeLibrary.load0(Native Method)
>>     at 
>> java.base/java.lang.ClassLoader$NativeLibrary.load(ClassLoader.java:2442)
>>     at 
>> java.base/java.lang.ClassLoader$NativeLibrary.loadLibrary(ClassLoader.java:2498)
>>     at java.base/java.lang.ClassLoader.loadLibrary0(ClassLoader.java:2694)
>>     at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2659)
>>     at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:830)
>>     at java.base/java.lang.System.loadLibrary(System.java:1873)
>>     at org.rexxla.bsf.engines.rexx.RexxAndJava.<clinit>(RexxAndJava.java:871)
>>     at org.rexxla.bsf.engines.rexx.RexxEngine.initialize(RexxEngine.java:291)
>>     at org.apache.bsf.BSFManager$8.run(BSFManager.java:854)
>>     at java.base/java.security.AccessController.doPrivileged(Native Method)
>>     at org.apache.bsf.BSFManager.loadScriptingEngine(BSFManager.java:852)
>>     at org.rexxla.bsf.RexxDispatcher.main(RexxDispatcher.java:117)
>>     Teresas-MacBook-Air:~ t.f$ 
>>
>> All the ooRexx libraries (e.g. librexx.3.dylib, librexx.4.dylib, 
>> librexx.dylib) are in
>> /usr/local/lib linking to: /Library/Frameworks/ooRexx.framework/Libraries/ 
>> (librexx.3.dylib,
>> librexx.4.dylib are links to librexx.dylib).
>>
>> Running ooRexx programs from anywhere on the system works.
>>
>> Anyone with an idea, an advice what to look for, what to do in this case?
>>
>> ---rony
>>
>> P.S.: This BSF4ooRexx (which includes oorexx) got used:
>> <https://sourceforge.net/projects/bsf4oorexx/files/beta/20200928/b4r_641_500_64Bit_macosx-20210205-r12147.zip/download>
>>

_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to