Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to load the linux .so file in mac os x

My Linux .so file can be opened with the fopen() command in Ubuntu, but when I tried to open the file with the fopen() command in Mac OS X 10.6, it failed.

The error was the file type was not recognized. How can I make a Linux library or tool work on Mac OS X 10.6 without recompilation?

like image 921
user1377049 Avatar asked Aug 19 '12 10:08

user1377049


People also ask

How do I open an .so file on a Mac?

As a result, Mac OS X cannot run Linux binaries directly. The safest approach would be to install Linux in a virtual machine, e.g. VirtualBox. You would then have a full-blown Linux system to do anything that you want, including accessing files on the Mac OS X host via shared folders.

Does Linux stuff work on Mac?

Linux is incredibly versatile (it's used to run everything from smartphones to supercomputers), and you can install it on your MacBook Pro, iMac, or even your Mac mini. Apple adding Boot Camp to macOS made it easy for people to dual boot Windows, but installing Linux is another matter entirely.

What is file .so in Linux?

A file with the . SO file extension is a Shared Library file. They contain information that can be used by one or more programs to offload resources so that the application(s) calling the SO file doesn't have to actually provide the file.


1 Answers

Linux binaries are completely different to Mac OS X ones, even on the same architecture. For starters, Linux binaries use the ELF format, whilst Mac OS X ones are based on the Mach-O format. But even if the formats were the same, the operating system interface is not the same.

As a result, Mac OS X cannot run Linux binaries directly. The safest approach would be to install Linux in a virtual machine, e.g. VirtualBox. You would then have a full-blown Linux system to do anything that you want, including accessing files on the Mac OS X host via shared folders.

like image 175
thkala Avatar answered Oct 05 '22 10:10

thkala