ruby shoes "illegal instruction" macbook air but not on imac ( ./pango-querymodules?) - ruby

Everything going well, building ruby-shoes app on imac. Attempt to dev/run packaged app on my air get illegal instruction.
only happens with latest shoes version (federalas). seems to be ok on policeman
checked the architecture / file type - identical on both machines (e.g. x86_64)
seems to be ./pango-querymodules that causes the first illegal instruction
both machines OSX Yosemite (10.10.3)
attempted to install shoes from scratch and also tried to copy over from working imac version
has anyone seen this? I need to start digging into all files md5, libraries etc, but thought i'd ask the question before i embark
thanks
Output/Data
/Applications/Shoes.app/Contents/MacOS/shoes-launch myapp.rb
/Applications/Shoes.app/Contents/MacOS/shoes-launch: line 8: 57221 Illegal instruction: 4 PANGO_RC_FILE="$APPPATH/pangorc" ./pango-querymodules > pango.modules
/Applications/Shoes.app/Contents/MacOS/shoes-launch: line 9: 57503 Illegal instruction: 4 DYLD_LIBRARY_PATH="$APPPATH" PANGO_RC_FILE="$APPPATH/pangorc" SHOES_RUBY_ARCH="x86_64-darwin14.0" ./shoes-bin "$#"
File type of program with illegal instruction
$ file /Applications/Shoes.app/Contents/MacOS/pango-querymodules
/Applications/Shoes.app/Contents/MacOS/pango-querymodules: Mach-O 64-bit executable x86_64

Related

Issue with linker for Mac OS

I have recently started using ada for a lab in my systems programming class and I can say it is really interesting.
I tried most of it at the computers labs for testing and I decided to install the compiler and its linking tools in a MacBook.
Altough the installation is done and there seems to be no problem, when I tried to print the classic hello world program I am getting this message:
gprbuild greet.adb
using project file /Users/xyderos/opt/GNAT/2020/share/gpr/_default.gpr
Bind
[gprbind] greet.bexch
[Ada] greet.ali
Link
[link] greet.adb
ld: library not found for -lSystem
collect2: error: ld returned 1 exit status
gprbuild: link of greet.adb failed
gprbuild: failed command was: /users/name/opt/gnat/2020/bin/gcc greet.o b__greet.o - L/Users/name/ada/ -L/Users/name/ada// -L/users/name/opt/gnat/2020/lib/gcc/x86_64-apple-darwin17.7.0/8.4.1/adalib/ /users/name/opt/gnat/2020/lib/gcc/x86_64-apple-darwin17.7.0/8.4.1/adalib/libgnat.a -Wl,-rpath,#executable_path/ -Wl,-rpath,#executable_path/..//opt/gnat/2020/lib/gcc/x86_64-apple-darwin17.7.0/8.4.1/adalib -o greet
I am getting really confused about the lSystem library.
It seems that the library doesn't exist on Mac(maybe I need to install Xcode?).
Does anyone have a clue about that issue or is there a probably better way to install it via brew?
Thanks a lot in advance!
On my MacOS 10.14, the following worked for me, without having to download the massive blob that is Xcode, which I had neither the bandwidth nor the diskspace for. I don't know if this still works on MacOS 10.15 (not planning to upgrade).
Most of this info was from a blog post by Simon Wright: https://forward-in-code.blogspot.com/2019/06/macos-software-development-kit-changes.html
You only need the Xcode command line tools only (not Xcode): xcode-select --install
Now unpack the included headers: sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
And tell GNAT where to find them: mv ce2109-specs /usr/local/opt/GNAT/2019/lib/gcc/x86_64-apple-darwin17.7.0/8.3.1/specs
The ce2109-specs file is from the blog post above. This did the job for me and GNAT can now link working binaries on MacOS 10.14.
If you're on 10.15 and it doesn't work (because there's no more Xcode command line tools or they're missing the headers package), you will unfortunately have to install Xcode as per the GNAT Readme.

A binary I compiled on one version of OSX does not work on another. How to make a portable binary?

I compiled a binary on my OSX system (Sierra - 10.12.6) that i'm trying to share with a friend on Mavericks (10.9.2)
However when he tries to run the binary he gets strange errors:
"dyld: lazy symbol binding failed: Symbol not found: _clock_gettime"
referenced from foo/ruby (which was built for Mac OS X 10.12)
My question is how do i compile a binary so that it works on both my system and on his? In this particular case the binary is the Ruby executable, but I assume this applies to other binaries too.
If possible i would also appreciate an explanation for why this doesn't work and why I'm getting the error i am.

OS X 10.9.x (Mavericks) broken samba/windows shares - possible workarounds?

Since 10.9 Apple replaced samba in Lion for their SMBX it's constantly broken. Very broken.
While connecting to a samba share (2012 R2 Essentials) the connections often drops or hangs while this appears in the system.log:
smb2_rq_credit_decrement: Timed out waiting for credits 35
smb_iod_reconnect: Reconnected share <share_name> with server <server_name>
smb_fid_get_kernel_fid: No smb2 fid found for fid 550ff6b0613adf68
smb_iod_reconnect: Reconnected share <share_name> with server <server_name>
A few sources propose forcing using SMBv1 as a workaround like this:
echo "[default]" >> ~/Library/Preferences/nsmb.conf
echo "smb_neg=smb1_only" >> ~/Library/Preferences/nsmb.conf
Which actually makes it work (not hang or disconnect) it's just that a listing of a directory takes 15-30 sec no problem .. meaning it's almost completely useless.
This problem has bothered me for a LONG time now and I'm trying to think of a workaround.
One I can think of is compiling Samba (www.samba.org) but as Apple dropped them out of Mac OS X a while ago they don't really make much effort of making samba compatible with OS X .. which is understandable :)
After making some fixes to Samba 4.1.11 source the samba somehow compiles but does not seem to have a mount_smbfs or anything similar - just smbclient.
Does anyone have an idea whether it's possible to make mountning work with OS X (as it involves kernel and I don't know what exactly) ?
Any other propositions on how to fix this?
P.S.: I'm currently stuck at compilation of Samba 4.1.11 version of samba on OS X 10.9.4 with this (if anyone had an idea on how to fix that):
Undefined symbols for architecture x86_64:
"___unsafe_string_function_usage_here_size_t__", referenced from:
_send_announcement in nmbd_sendannounce_122.o
_send_lm_announcement in nmbd_sendannounce_122.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Waf: Leaving directory `<replaced_path_to_samba>/samba/bin'
Build failed: -> task failed (err #1):
{task: cc_link profile_76.o,asyncdns_122.o,nmbd_122.o,nmbd_become_dmb_122.o,nmbd_become_lmb_122.o,nmbd_browserdb_122.o,nmbd_browsesync_122.o,nmbd_elections_122.o,nmbd_incomingdgrams_122.o,nmbd_incomingrequests_122.o,nmbd_lmhosts_122.o,nmbd_logonnames_122.o,nmbd_mynames_122.o,nmbd_namelistdb_122.o,nmbd_namequery_122.o,nmbd_nameregister_122.o,nmbd_namerelease_122.o,nmbd_nodestatus_122.o,nmbd_packets_122.o,nmbd_processlogon_122.o,nmbd_responserecordsdb_122.o,nmbd_sendannounce_122.o,nmbd_serverlistdb_122.o,nmbd_subnetdb_122.o,nmbd_winsproxy_122.o,nmbd_winsserver_122.o,nmbd_workgroupdb_122.o,nmbd_synclists_122.o -> nmbd}
well, thankfully OS X 10.10 Yosemite fixes this and 10.9 does not seem very well supported, so I'm going to assume upgrade is the way to go.

otool -l shows (0x80000022) Unknown load command on OSX 10.5 when framework was built from OSX 10.6

I built a framework using OSX 10.6 and everything is fine, I have the Base SDK and Deployment SDK set to 10.5. I also am building only a i386 arch.
When I bring this framework to a OSX 10.5 and I run otool -l on it I get the following results:
"Load command 6
cmd ?(0x80000022) Unknown load command"
Does anybody know how to fix this?
Thanks in advance
Turns out the or'ed in bit (0x80000000) on the load command message:
"Load command 6 cmd ?(0x80000022) Unknown load command"
means that the command is required, and then I found out that my base SDK was not set correctly, and once I corrected that and the deployment target to 10.5, I got (0x00000022) instead which means its not required so it's weak linked and doesn't cause any problems.
So my problem was a mistake by me, but I added some information on how to read the failures so hopefully this is useful to someone else.

Static libraries in version-cross-compiled program

I have a unix command line app (with big nasty makefile) that I'm trying to run on a mac. I am compiling it on a 10.6 system, with all of the appropriate libraries of course. The deployment environment is a 10.5 system, with no extra libraries.
I compiled without -dynamic, and it appears to have static libraries, correctly. When I run it on the 10.6 system, it works. However, when I run it on the 10.5 system, I get:
dyld: unknown required load command 0x80000022
I got this same error when I compiled things for the 10.6 system using the 10.5 xcode, so it looks like a version mis-match type problem. However, I used gcc-4.0, and
$CFLAGS = -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5
so it SHOULD be set up for 10.5... any ideas?
thanks
Editing an ancient question:
I have the exact same problem on a different computer. This time I am at 10.5.8, fully update, the same executable works on 10.6 still.
Has anyone had any luck with this in the months since I asked this?
The reason for the dyld 0×80000022 error can be that, you are linking on OS X 10.6, and OS X 10.6 will use a load command (LC_DYLD_INFO_ONLY = 0×80000022) that OS X 10.5 does not understand.
To fix this, make sure you are using a deployment target by setting the environment variable just before your link command:
export MACOSX_DEPLOYMENT_TARGET=10.5
(or setenv MACOSX_DEPLOYMENT_TARGET=10.5)
You can always check if your executable uses the right load command like this:
otool -l executable
It will either show LC_DYLD_INFO_ONLY (without deployment target) commands or LC_DYLD_INFO (with deployment target).
I have been searching for the same issue, as I develop on 10.6 but must have a version that works on 10.5. In addition to the compiler flags above, you should add:
-no_compact_linkedit
It is described here:
http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man1/ld.1.html
where it says:
Normally when targeting Mac OS X 10.6, the linker will generate compact information in the __LINKEDIT segment. This option causes the linker to instead produce traditional relocation information.
I got there from a discussion on the xcode-users mailing list about "unknown required load command 0x80000022".
i was able to solve this by passing -mmacosx-version-min=10.5 to the linker, e.g. --extra-ldflags="-mmacosx-version-min=10.5" passed to configure for ffmpeg which i was building shared. more info: http://lists.apple.com/archives/xcode-users/2009/Oct/msg00530.html
Depending on how many libraries you use, it may be difficult to get all of them linked statically. What does "otool -L your_binary' tell you?
In order to get a self-contained package for an application of my own, I made a custom MacPorts install in a non-standard directory, so that I could dynlink with the libraries from that directory and only be constrained in asking people to install the whole thing in the same place on their computers. Not great, not the Mac spirit at all, but it's an Unix app and you need to be familiar with Unix to use it anyway.
Good luck
Pascal
It turns out that there is a dynamic library load function (0x22) that got added at 10.5.6. The system I was running on was 10.5.5. I upgraded to 10.5.8, and everything runs!
Ok, SECOND solution, and NOT very satisfying, is to find a 10.5.8 computer, install the developer packages and re-compile... same for powerPC... sad but it will work...

Resources