Dear Rony,

Your links brought me (almost) to the end, here is the content of  
Makefile.macOS:

# A pretty simple make file that should work on macOS

# this needs to follow after file for which link resolution is needed
OOREXX_LFLAGS = -I../../../../include -L../../../../lib -lrexx -lrexxapi

# What we want to build.
all: runRexxProgram stackOverflow

runRexxProgram: runRexxProgram.cpp
        gcc runRexxProgram.cpp ${OOREXX_LFLAGS} -o runRexxProgram

stackOverflow: stackOverflow.cpp
        gcc stackOverflow.cpp  $(OOREXX_LFLAGS) -o stackOverflow

clean:
        rm -f stackOverflow runRexxProgram

I can compile and link but the error message I get when I try to run the 
program seems to imply I am missing something more

POs-QuadCore-Mac-Pro:native.api po$ make -f Makefile.macOS clean
rm -f stackOverflow runRexxProgram
POs-QuadCore-Mac-Pro:native.api po$ make -f Makefile.macOS all
gcc runRexxProgram.cpp -I../../../../include -L../../../../lib -lrexx -lrexxapi 
-o runRexxProgram
gcc stackOverflow.cpp  -I../../../../include -L../../../../lib -lrexx -lrexxapi 
-o stackOverflow
POs-QuadCore-Mac-Pro:native.api po$ runRexxProgram HelloWorld.rex
-bash: runRexxProgram: command not found
POs-QuadCore-Mac-Pro:native.api po$ ./runRexxProgram HelloWorld.rex
dyld: Library not loaded: @rpath/librexx.4.dylib
  Referenced from: 
/Applications/ooRexx5/share/ooRexx/samples/native.api/./runRexxProgram
  Reason: image not found
Abort trap: 6
POs-QuadCore-Mac-Pro:native.api po$ 

I have checked and librexx.4.dylib is in the /lib folder. Are there some 
switches missing in the CMake call? This is what I have locally

cmake -G "Unix Makefiles" -DBUILD_DMG=1 -DCMAKE_BUILD_TYPE=RELEASE 
-DCMAKE_INSTALL_PREFIX=~/Applications/ooRexx5 ../oorexxSVN

Any hints welcome

Hälsningar/Regards/Grüsse,
P.O. Jonsson
oor...@jonases.se



> Am 16.10.2021 um 15:35 schrieb Rony G. Flatscher <rony.flatsc...@wu.ac.at>:
> 
> Hi P.O.,
> 
> just a few thoughts (am about to leave the office):
> 
> the compiler needs to be able to resolve the include files, cf. 
> <https://www.rapidtables.com/code/linux/gcc/gcc-i.html> 
> <https://www.rapidtables.com/code/linux/gcc/gcc-i.html>, on Linux they are 
> found (while ooRexx is installed),
> the compiler needs to be able to locate the dylibs (librexx.dylib and 
> librexxapi.dylib), usually one could use "-L...path..." to point to the 
> ooRexx library directory, cf. 
> <https://www.rapidtables.com/code/linux/gcc/gcc-l.html> 
> <https://www.rapidtables.com/code/linux/gcc/gcc-l.html>
> So, if the compiler does not find the include and dylib files in the 
> directories it looks for, you would have to supply the locations either with 
> supplying the directories with the appropriate switches in the appropriate 
> gcc switches or via the environment variables the compiler may consult.
> 
> Good luck! :) 
> ---rony
> 
> On 16.10.2021 15:22, P.O. Jonsson wrote:
>> Dear Rony,
>> 
>> I wanted to try this out on macOS (High Sierra) but got into problems 
>> straight away
>> 
>> POs-QuadCore-Mac-Pro:native.api po$ make -f Makefile.macOS clean
>> rm -f stackOverflow runRexxProgram
>> POs-QuadCore-Mac-Pro:native.api po$ make -f Makefile.macOS all
>> gcc runRexxProgram.cpp -lrexx -lrexxapi   -o runRexxProgram
>> runRexxProgram.cpp:51:10: fatal error: 'oorexxapi.h' file not found
>> #include "oorexxapi.h"
>>          ^~~~~~~~~~~~~
>> 1 error generated.
>> make: *** [runRexxProgram] Error 1
>> POs-QuadCore-Mac-Pro:native.api po$ 
>> 
>> I could do away with that problem by copying the header files into the 
>> sample directory (a hack, I know). But I got another error instead
>> 
>> POs-QuadCore-Mac-Pro:native.api po$ make -f Makefile.macOS clean
>> rm -f stackOverflow runRexxProgram
>> POs-QuadCore-Mac-Pro:native.api po$ make -f Makefile.macOS all
>> gcc runRexxProgram.cpp -lrexx -lrexxapi   -o runRexxProgram
>> ld: library not found for -lrexx
>> clang: error: linker command failed with exit code 1 (use -v to see 
>> invocation)
>> make: *** [runRexxProgram] Error 1
>> 
>> So I added the -v to get more information
>> 
>> POs-QuadCore-Mac-Pro:native.api po$ make -f Makefile.macOS clean
>> rm -f stackOverflow runRexxProgram
>> POs-QuadCore-Mac-Pro:native.api po$ make -f Makefile.macOS runRexxProgram
>> gcc -v runRexxProgram.cpp -lrexx -lrexxapi   -o runRexxProgram
>> Apple LLVM version 10.0.0 (clang-1000.10.44.4)
>> Target: x86_64-apple-darwin17.7.0
>> Thread model: posix
>> InstalledDir: /Library/Developer/CommandLineTools/usr/bin
>>  "/Library/Developer/CommandLineTools/usr/bin/clang" -cc1 -triple 
>> x86_64-apple-macosx10.13.0 -Wdeprecated-objc-isa-usage 
>> -Werror=deprecated-objc-isa-usage -emit-obj -mrelax-all -disable-free 
>> -disable-llvm-verifier -discard-value-names -main-file-name 
>> runRexxProgram.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix 
>> -mdisable-fp-elim -fno-strict-return -masm-verbose -munwind-tables 
>> -target-cpu penryn -dwarf-column-info -debugger-tuning=lldb 
>> -target-linker-version 409.12 -v -resource-dir 
>> /Library/Developer/CommandLineTools/usr/lib/clang/10.0.0 -stdlib=libc++ 
>> -fdeprecated-macro -fdebug-compilation-dir 
>> /Applications/ooRexx5/share/ooRexx/samples/native.api -ferror-limit 19 
>> -fmessage-length 80 -stack-protector 1 -fblocks 
>> -fencode-extended-block-signature -fobjc-runtime=macosx-10.13.0 
>> -fcxx-exceptions -fexceptions -fmax-type-align=16 -fdiagnostics-show-option 
>> -fcolor-diagnostics -o 
>> /var/folders/6r/ytvfjqwx7td5_cvdj6_m9vcr0000gn/T/runRexxProgram-f8319d.o -x 
>> c++ runRexxProgram.cpp
>> clang -cc1 version 10.0.0 (clang-1000.10.44.4) default target 
>> x86_64-apple-darwin17.7.0
>> ignoring nonexistent directory "/usr/include/c++/v1"
>> #include "..." search starts here:
>> #include <...> search starts here:
>>  /Library/Developer/CommandLineTools/usr/include/c++/v1
>>  /usr/local/include
>>  /Library/Developer/CommandLineTools/usr/lib/clang/10.0.0/include
>>  /Library/Developer/CommandLineTools/usr/include
>>  /usr/include
>>  /System/Library/Frameworks (framework directory)
>>  /Library/Frameworks (framework directory)
>> End of search list.
>>  "/Library/Developer/CommandLineTools/usr/bin/ld" -demangle -lto_library 
>> /Library/Developer/CommandLineTools/usr/lib/libLTO.dylib -no_deduplicate 
>> -dynamic -arch x86_64 -macosx_version_min 10.13.0 -o runRexxProgram 
>> /var/folders/6r/ytvfjqwx7td5_cvdj6_m9vcr0000gn/T/runRexxProgram-f8319d.o 
>> -lrexx -lrexxapi -lSystem 
>> /Library/Developer/CommandLineTools/usr/lib/clang/10.0.0/lib/darwin/libclang_rt.osx.a
>> ld: library not found for -lrexx
>> clang: error: linker command failed with exit code 1 (use -v to see 
>> invocation)
>> make: *** [runRexxProgram] Error 1
>> 
>> Any idea what I need to do to get this working on a Mac?
>> 
>> Hälsningar/Regards/Grüsse,
>> P.O. Jonsson
>> oor...@jonases.se <mailto:oor...@jonases.se>
>> 
>> 
>> 
>>> Am 16.10.2021 um 14:55 schrieb Rony G. Flatscher <rony.flatsc...@wu.ac.at 
>>> <mailto:rony.flatsc...@wu.ac.at>>:
>>> 
>>> Here a minimal working Makefile.linux:
>>> 
>>> # A pretty simple make file that should work on most Unix-like platforms 
>>> that have gcc.
>>> 
>>> OOREXX_LFLAGS = -lrexx -lrexxapi  # needs to follow after file for which 
>>> link resoultion is needed
>>> 
>>> # What we want to build.
>>> all: runRexxProgram stackOverflow
>>> 
>>> runRexxProgram: runRexxProgram.cpp
>>>         gcc runRexxProgram.cpp ${OOREXX_LFLAGS} -o runRexxProgram
>>> 
>>> stackOverflow: stackOverflow.cpp
>>>         gcc stackOverflow.cpp  $(OOREXX_LFLAGS) -o stackOverflow
>>> 
>>> clean:
>>>         rm -f stackOverflow runRexxProgram
>>> If there are no objections (Makefiles are sometimes religious), I would 
>>> replace the non-working version with the above one.
>>> 
>>> ---rony
>>> 
>>> On 15.10.2021 16:17, Rony G. Flatscher wrote:
>>>> After having time to look closer, it turns out that the Makefile.linux has 
>>>> been faulty! Here a version that works (a little bit simplified and 
>>>> removed a superfluous definition, the link switches now trail the file to 
>>>> be created):
>>>> 
>>>> OOREXX_LFLAGS = -L. -ldl -lrexx -lrexxapi
>>>> OOREXX_CFLAGS = -fPIC
>>>> 
>>>> 
>>>> # What we want to build.
>>>> all: runRexxProgram stackOverflow
>>>> 
>>>> runRexxProgram.o: runRexxProgram.cpp
>>>>    gcc -c $(OOREXX_CFLAGS) -o runRexxProgram.o runRexxProgram.cpp
>>>> 
>>>> runRexxProgram: runRexxProgram.o
>>>>    gcc runRexxProgram.o -o runRexxProgram $(OOREXX_LFLAGS) 
>>>> 
>>>> stackOverflow.o: stackOverflow.cpp
>>>>    gcc -c $(OOREXX_CFLAGS) -o stackOverflow.o stackOverflow.cpp
>>>> 
>>>> stackOverflow: stackOverflow.o
>>>>    gcc stackOverflow.o -o stackOverflow $(OOREXX_LFLAGS) 
>>>> 
>>>> clean:
>>>>    rm -f *.so *.o stackOverflow runRexxProgram
>>>> Will commit the changes to this Makefile tomorrow.
>>>> 
>>>> ---rony
>>>> 
>>>> On 14.10.2021 15:31, Rony G. Flatscher wrote:
>>>>> While testing the Makefile.linux for native.api on Ubuntu I encounter the 
>>>>> following problem (oorexx got installed to /usr/local):
>>>>> 
>>>>> rony@rony-linux:~/work/oorexx-build/orx1/usr/local/share/ooRexx/samples/native.api$
>>>>>  
>>>>> <mailto:rony@rony-linux:~/work/oorexx-build/orx1/usr/local/share/ooRexx/samples/native.api$>
>>>>>  make -f Makefile.linux clean
>>>>> rm -f *.so *.o stackOverflow runRexxProgram
>>>>> 
>>>>> rony@rony-linux:~/work/oorexx-build/orx1/usr/local/share/ooRexx/samples/native.api$
>>>>>  
>>>>> <mailto:rony@rony-linux:~/work/oorexx-build/orx1/usr/local/share/ooRexx/samples/native.api$>
>>>>>  make -f Makefile.linux runRexxProgram
>>>>> gcc -c -fPIC -o runRexxProgram.o runRexxProgram.cpp
>>>>> gcc -L. -ldl -lrexx -lrexxapi runRexxProgram.o -o runRexxProgram
>>>>> /usr/bin/ld: runRexxProgram.o: in function `main':
>>>>> runRexxProgram.cpp:(.text+0x9a): undefined reference to 
>>>>> `RexxCreateInterpreter'
>>>>> collect2: error: ld returned 1 exit status
>>>>> make: *** [Makefile.linux:54: runRexxProgram] Error 1
>>>>> 
>>>>> rony@rony-linux:~/work/oorexx-build/orx1/usr/local/share/ooRexx/samples/native.api$
>>>>>  
>>>>> <mailto:rony@rony-linux:~/work/oorexx-build/orx1/usr/local/share/ooRexx/samples/native.api$>
>>>>>  nm runRexxProgram.o 
>>>>>                  U exit
>>>>>                  U _GLOBAL_OFFSET_TABLE_
>>>>> 0000000000000000 T main
>>>>>                  U printf
>>>>>                  U puts
>>>>>                  U RexxCreateInterpreter
>>>>>                  U __stack_chk_fail
>>>>>                  U strcmp
>>>>> 0000000000000000 W _Z16conditionSubCodeP13RexxCondition
>>>>> 00000000000003c9 T _Z17checkForConditionP18RexxThreadContext_b
>>>>> 0000000000000243 T 
>>>>> _Z20standardConditionMsgP18RexxThreadContext_P20_RexxDirectoryObjectP13RexxCondition
>>>>> 00000000000001c7 T _Z23printInterpreterVersionP13RexxInstance_
>>>>> 0000000000000000 W _ZN13RexxInstance_13LanguageLevelEv
>>>>> 0000000000000000 W _ZN13RexxInstance_18InterpreterVersionEv
>>>>> 0000000000000000 W _ZN13RexxInstance_9TerminateEv
>>>>> 0000000000000000 W _ZN18RexxThreadContext_10ArrayItemsEP16_RexxArrayObject
>>>>> 0000000000000000 W _ZN18RexxThreadContext_10ArrayOfOneEP14_RexxObjectPtr
>>>>> 0000000000000000 W 
>>>>> _ZN18RexxThreadContext_11CallProgramEPKcP16_RexxArrayObject
>>>>> 0000000000000000 W 
>>>>> _ZN18RexxThreadContext_12SendMessage0EP14_RexxObjectPtrPKc
>>>>> 0000000000000000 W _ZN18RexxThreadContext_14CheckConditionEv
>>>>> 0000000000000000 W _ZN18RexxThreadContext_14ClearConditionEv
>>>>> 0000000000000000 W _ZN18RexxThreadContext_16GetConditionInfoEv
>>>>> 0000000000000000 W 
>>>>> _ZN18RexxThreadContext_19DecodeConditionInfoEP20_RexxDirectoryObjectP13RexxCondition
>>>>> 0000000000000000 W 
>>>>> _ZN18RexxThreadContext_19ObjectToStringValueEP14_RexxObjectPtr
>>>>> 0000000000000000 W _ZN18RexxThreadContext_6StringEPKc
>>>>> 0000000000000000 W _ZN18RexxThreadContext_7ArrayAtEP16_RexxArrayObjectm
>>>>> 0000000000000000 W _ZN18RexxThreadContext_7CStringEP14_RexxObjectPtr
>>>>> The version that CMake creates works.
>>>>> 
>>>>> ---rony
> 
> _______________________________________________
> Oorexx-devel mailing list
> Oorexx-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/oorexx-devel

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

Reply via email to