On 08.01.2019 21:57, Rick McGuire wrote: > If you are splitting things up into separate bin and lib directories, then > rexx.img needs to be > co-located with librexxapi in order for the image file to be located without > it being on the path > or the current directory.
After generating ooRexx for MacOS from the trunk version of CMakeList.txt and the "make install" step, here is the resulting directory structure of "~/Applications/ooRexx5.0.0" and the files placed in them: share: total 0 drwxr-xr-x 42 rony staff 1344 Jan 9 13:55 ooRexx drwxr-xr-x 3 rony staff 96 Jan 9 13:55 man drwxr-xr-x 6 rony staff 192 Jan 9 13:55 .. drwxr-xr-x 4 rony staff 128 Jan 9 13:55 . ... cut (Rexx samples are in "ooRexx", man page files in "man/man1") ... *lib*: total 5688 lrwxr-xr-x 1 rony staff 24 Jan 9 13:55 librxunixsys.dylib -> librxunixsys.5.0.0.dylib -rwxr-xr-x 1 rony staff 52392 Jan 9 13:55 librxunixsys.5.0.0.dylib lrwxr-xr-x 1 rony staff 21 Jan 9 13:55 librxsock.dylib -> librxsock.5.0.0.dylib -rwxr-xr-x 1 rony staff 52996 Jan 9 13:55 librxsock.5.0.0.dylib lrwxr-xr-x 1 rony staff 23 Jan 9 13:55 librxregexp.dylib -> librxregexp.5.0.0.dylib -rwxr-xr-x 1 rony staff 35116 Jan 9 13:55 librxregexp.5.0.0.dylib lrwxr-xr-x 1 rony staff 21 Jan 9 13:55 librxmath.dylib -> librxmath.5.0.0.dylib -rwxr-xr-x 1 rony staff 29556 Jan 9 13:55 librxmath.5.0.0.dylib lrwxr-xr-x 1 rony staff 23 Jan 9 13:55 librexxutil.dylib -> librexxutil.5.0.0.dylib -rwxr-xr-x 1 rony staff 80884 Jan 9 13:55 librexxutil.5.0.0.dylib lrwxr-xr-x 1 rony staff 22 Jan 9 13:55 librexxapi.dylib -> librexxapi.5.0.0.dylib -rwxr-xr-x 1 rony staff 146528 Jan 9 13:55 librexxapi.5.0.0.dylib lrwxr-xr-x 1 rony staff 19 Jan 9 13:55 librexx.dylib -> librexx.5.0.0.dylib -rwxr-xr-x 1 rony staff 2317664 Jan 9 13:55 librexx.5.0.0.dylib lrwxr-xr-x 1 rony staff 25 Jan 9 13:55 liborxncurses.dylib -> liborxncurses.5.0.0.dylib -rwxr-xr-x 1 rony staff 156248 Jan 9 13:55 liborxncurses.5.0.0.dylib lrwxr-xr-x 1 rony staff 22 Jan 9 13:55 libhostemu.dylib -> libhostemu.5.0.0.dylib -rwxr-xr-x 1 rony staff 26640 Jan 9 13:55 libhostemu.5.0.0.dylib drwxr-xr-x 6 rony staff 192 Jan 9 13:55 .. drwxr-xr-x 20 rony staff 640 Jan 9 13:55 . include: total 584 -rw-r--r-- 1 rony staff 3436 Dec 14 2017 rexxplatformdefs.h -rw-r--r-- 1 rony staff 4701 Sep 30 2014 rexxplatformapis.h -rw-r--r-- 1 rony staff 3743 Dec 11 17:21 rexxapitypes.h -rw-r--r-- 1 rony staff 15376 Dec 23 15:13 rexxapidefs.h -rw-r--r-- 1 rony staff 40135 Dec 23 15:13 rexx.h -rw-r--r-- 1 rony staff 55634 Dec 21 15:25 oorexxerrors.h -rw-r--r-- 1 rony staff 167334 Dec 30 12:59 oorexxapi.h drwxr-xr-x 6 rony staff 192 Jan 9 13:55 .. drwxr-xr-x 9 rony staff 288 Jan 9 13:55 . *bin*: total 4896 -rw-r--r-- 1 rony staff 18460 Jan 9 13:52 streamsocket.cls -rw-r--r-- 1 rony staff 31703 Jan 9 13:52 socket.cls -rw-r--r-- 1 rony staff 18662 Jan 9 13:52 smtp.cls -rwxr-xr-x 1 rony staff 13692 Jan 9 13:55 rxsubcom -rw-r--r-- 1 rony staff 3525 Jan 9 13:52 rxregexp.cls -rwxr-xr-x 1 rony staff 18580 Jan 9 13:55 rxqueue -rw-r--r-- 1 rony staff 65447 Jan 9 13:52 rxftp.cls -rwxr-xr-x 1 rony staff 104264 Jan 9 13:55 rxapi -rwxr-xr-x 1 rony staff 14965 Jan 9 13:52 rexxtry.rex -rwxr-xr-x 1 rony staff 13676 Jan 9 13:55 rexxc -r-xr-xr-x 1 rony staff 1936904 Jan 9 13:54 rexx.img -r-xr-xr-x 1 rony staff 44667 Jan 9 13:54 rexx.cat -rwxr-xr-x 1 rony staff 17700 Jan 9 13:55 rexx -rw-r--r-- 1 rony staff 31791 Jan 9 13:52 ncurses.cls -rw-r--r-- 1 rony staff 11444 Jan 9 13:52 mime.cls -rwxr-xr-x 1 rony staff 14236 Jan 9 13:55 libwpipe3.dylib -rwxr-xr-x 1 rony staff 13408 Jan 9 13:55 libwpipe2.dylib -rwxr-xr-x 1 rony staff 13932 Jan 9 13:55 libwpipe1.dylib -rw-r--r-- 1 rony staff 13955 Jan 9 13:52 json.cls -rw-r--r-- 1 rony staff 24957 Jan 9 13:52 csvStream.cls -rwxr-xr-x 1 rony staff 17608 Jan 9 13:55 callrexx2 -rwxr-xr-x 1 rony staff 21540 Jan 9 13:55 callrexx1 drwxr-xr-x 6 rony staff 192 Jan 9 13:55 .. drwxr-xr-x 24 rony staff 768 Jan 9 13:55 . It seems to be the standard on Unix, that applications/tools place their binaries/commands in a "bin" directory and its libraries into a sibling "lib" directory. So, if one has the location of the "lib" directory, with "../bin" one could find the companion "bin" directory. As one can see the "bin" directory on Unix includes the following binaries: "rexx", "rexx.img", "rexx.cat", "rexxc", "rxsubcom", and "rxapi". (In addition the C++ ooRexx samples "callrexx?" with "libwpipe?.dylib"get installed there too, which I think should not be the case.) So ooRexx would need to look for "rexx.img", "rexx.cat", "rxsubcom" and "rxapi" in the "bin" directory, which relative to the "lib" directory can always be found with the relative path "../bin". Enclosed please find an experiment with "CMakeList.txt" changed to use RPATH and "common/platform/unix/SysProcess.cpp" to become able to locate "rexx.img" and the other binaries in "bin", if moving the ooRexx directory away from its installation directory (currently being "~/Applications" on MacOS)! With the enclosed patch applied it becomes possible to run ooRexx without the "bin" directory being on the PATH altogether! It got successfully tested even with using "address with": wu114215:oha rony$ *./macos64/bin/rexx -e "out=.array~new; address '' 'ls -al' with output using (out); say out"* total 0 drwxr-xr-x 4 rony staff 128 Jan 9 13:58 . drwxr-xr-x 89 rony staff 2848 Jan 9 18:46 .. drwxr-xr-x 6 rony staff 192 Jan 9 13:57 macos64 drwxr-xr-x 6 rony staff 192 Jan 9 13:58 old wu114215:oha rony$ --- The only thing that the enclosed patch cannot handle is finding "rexx.cat", such that Rexx error messages (e.g. for 'say 1/0') will instead cause a "REX0025E: Cannot open REXX message catalog rexx.cat" message: wu114215:oha rony$ *./macos64/bin/rexx -e "parse version v; say v"* REXX-ooRexx_5.0.0(MT)_64-bit 6.05 9 Jan 2019 wu114215:oha rony$ wu114215:oha rony$ *./macos64/bin/rexx -e "say 'current directory:' directory()"* current directory: /Users/rony/oha wu114215:oha rony$ wu114215:oha rony$ *./macos64/bin/rexx -e "say 1/0"* 1 *-* say 1/0 REX0042E: Cannot open REXX message catalog rexx.cat. Not in NLSPATH or /Users/rony/Applications/ooRexx5.0.0/bin. 42 Cannot open REXX message catalog rexx.cat. Not in NLSPATH or /Users/rony/Applications/ooRexx5.0.0/bin. INSTORE Cannot open REXX message catalog rexx.cat. Not in NLSPATH or /Users/rony/Applications/ooRexx5.0.0/bin. 1: Cannot open REXX message catalog rexx.cat. Not in NLSPATH or /Users/rony/Applications/ooRexx5.0.0/bin. REX0413E: Cannot open REXX message catalog rexx.cat. Not in NLSPATH or /Users/rony/Applications/ooRexx5.0.0/bin. 42.3: Cannot open REXX message catalog rexx.cat. Not in NLSPATH or /Users/rony/Applications/ooRexx5.0.0/bin. "/Users/rony/Applications/ooRexx5.0.0" is the directory "make install" created and used. ---rony > > > On Tue, Jan 8, 2019 at 1:21 PM Rony G. Flatscher <rony.flatsc...@wu.ac.at > <mailto:rony.flatsc...@wu.ac.at>> wrote: > > On 08.01.2019 19:15, Rony G. Flatscher wrote: >> >> While testing the standalone version on Linux, everything works out fine >> if issuing "rexx". >> > Should have also mentioned: if putting the directory where rexx resides > on to the path > everything works as well. > > ---rony > > >> However, if invoking "rexx" with a fully qualified path like: >> >> ~/some/path/to-standalone/bin/rexx -e "parse version v; say v" >> >> an error "Logic error: no startup image" is raised and ooRexx gets >> aborted with a core dump. >> The libraries seem to be found. >> >> This is with r11665. >> >> ---rony >>
Index: CMakeLists.txt =================================================================== --- CMakeLists.txt (revision 11665) +++ CMakeLists.txt (working copy) @@ -52,8 +52,8 @@ include(CheckFunctionExists) include(CheckSymbolExists) include(CheckCSourceCompiles) -set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) -set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) +set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib) +set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib) set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) set (CMAKE_PDB_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) set (CMAKE_SAMPLES_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/samples) @@ -250,6 +250,24 @@ set (INSTALL_LIB_DIR ${CMAKE_INSTALL_PREFIX}/lib) endif () endif () + + # do not skip the full RPATH for the build tree + SET( CMAKE_SKIP_BUILD_RPATH FALSE) + # when building, don't use the install RPATH + # only later on when installing + SET( CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) + if( APPLE ) + SET( CMAKE_INSTALL_RPATH "@executable_path/../lib") + else() + SET( CMAKE_INSTALL_RPATH "$ORIGIN/../lib") + endif() + # add the automatically determined parts of the RPATH + # which point to directories outside the build tree to the install RPATH + SET( CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + message(STATUS "CMAKE_INSTALL_PREFIX is ${CMAKE_INSTALL_PREFIX}") message(STATUS "INSTALL_LIB_DIR is ${INSTALL_LIB_DIR}") @@ -260,6 +278,7 @@ set (INSTALL_SAMPLES_DIR ${CMAKE_INSTALL_PREFIX}/share/${CMAKE_PROJECT_NAME}) set (INSTALL_MAN_DIR ${CMAKE_INSTALL_PREFIX}/share/man) endif () + # Set compiler and linker flags common to all build environments include_directories(${PROJECT_BINARY_DIR}) if (WIN32) Index: common/platform/unix/SysProcess.cpp =================================================================== --- common/platform/unix/SysProcess.cpp (revision 11665) +++ common/platform/unix/SysProcess.cpp (working copy) @@ -115,8 +115,22 @@ char *moduleName = strdup(dlInfo.dli_fname); size_t nameLength = strlen(moduleName); + // scan backwards to find the last directory delimiter + for (; nameLength > 0; nameLength--) + { + // is this the directory delimiter? + if (moduleName[nameLength - 1] == '/') + { + // terminate the string after the first encountered backslash and quit + moduleName[nameLength] = '\0'; + break; + } + } + // printf( "at line %d, name '%s', length(%d)\n",__LINE__, moduleName,nameLength); + // scan backwards again to find the last directory delimiter + nameLength--; for (; nameLength > 0; nameLength--) { // is this the directory delimiter? @@ -127,7 +141,13 @@ break; } } + // printf( "at line %d, name '%s', length(%d)\n",__LINE__, moduleName,nameLength); + // we know that the space is there, bin just replaces lib/lib64 + moduleName = strcat( moduleName, "bin/") ; + nameLength = strlen(moduleName); + // printf( "at line %d, name '%s', length(%d)\n",__LINE__, moduleName,nameLength); + // belt-and-braces, make sure we found a directory if (nameLength == 0) {
_______________________________________________ Oorexx-devel mailing list Oorexx-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/oorexx-devel