|
From: | Peter Teeson |
Subject: | Re: [Bug-apl] libapl load problem....UPDATE 2 |
Date: | Wed, 13 Jun 2018 15:26:24 -0400 |
Hi Jürgen: Well that trivial program confirms my hypothesis which is that I am the first person to try using libapl on macOS. I have been doing similar things to your program using both the command line (Terminal) and also within Xcode (Apple’s GUI Developer tool). From my experiments I had concluded that libapl.so, which is a bundle, will not work on macOS. We need a dylib. What I have not yet fully figured out is how to change things for libtool so as to fix things. Not sure if I have to change the compile args or just the linker ones. My understanding is that the .o files are PIC and it is the linker which builds them into an image that's relocatable. For dynamic libs the linker jus puts a reference in the exec file to the library image but does not include it’s content in the exec. The dynamic loader will take care of that and also resolving addresses at launch time. =================== Gandalf:~ pteeson$ cd /Volumes/Data/Development/apl-1053\ after\ Make/src Gandalf:src pteeson$ cat libapl_test.c #include "libapl.h" int main(int argc, char * argv[]) { init_libapl(argv[0], 0); return apl_exec("⎕←2 3 ⍴⍳6"); } Gandalf:src pteeson$ gcc -o libapl_test libapl_test.c -L .libs -lapl ld: can't link with bundle (MH_BUNDLE) only dylibs (MH_DYLIB) file '.libs/libapl.so' for architecture x86_64 clang: error: unable to execute command: Segmentation fault: 11 clang: error: linker command failed due to signal (use -v to see invocation) ========================== I also ran the command with the -v option and this is what was produced: I understand everything below. Just don’t know how to fix libtool for macOS This is the key line with the args to ld: "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.10.0 -o libapl_test -L.libs >>>>>>>>>>>>>>>>> Gandalf:src pteeson$ gcc -v -o libapl_test libapl_test.c -L .libs -lapl Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn) Target: x86_64-apple-darwin14.5.0 Thread model: posix "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.10.0 -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name libapl_test.c -mrelocation-model pic -pic-level 2 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 242.2 -v -dwarf-column-info -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.1.0 -fdebug-compilation-dir /Volumes/Data/Development/apl-1053 after Make/src -ferror-limit 19 -fmessage-length 139 -stack-protector 1 -mstackrealign -fblocks -fobjc-runtime=macosx-10.10.0 -fencode-extended-block-signature -fmax-type-align=16 -fdiagnostics-show-option -fcolor-diagnostics -o /var/folders/w1/081y692x5x30c39mcr8lxwkh0000gn/T/libapl_test-2b7dfd.o -x c libapl_test.c clang -cc1 version 6.1.0 based upon LLVM 3.6.0svn default target x86_64-apple-darwin14.5.0 #include "..." search starts here: #include <...> search starts here: /usr/local/include /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.1.0/include /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include /usr/include /System/Library/Frameworks (framework directory) /Library/Frameworks (framework directory) End of search list. "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.10.0 -o libapl_test -L.libs /var/folders/w1/081y692x5x30c39mcr8lxwkh0000gn/T/libapl_test-2b7dfd.o -lapl -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.1.0/lib/darwin/libclang_rt.osx.a ld: can't link with bundle (MH_BUNDLE) only dylibs (MH_DYLIB) file '.libs/libapl.so' for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
|
[Prev in Thread] | Current Thread | [Next in Thread] |