Search code examples
gccframeworksclangcompiler-options

Does GCC/Clang's -framework option work on Linux?


On OSX's development environment there is the concept of frameworks. A framework is a kind of bundle which contains headers, shared libraries and other useful stuff. A framework can be passed to the compiler, so that the compiler includes its headers on the search path and uses its shared libraries to link programs against them.

So, for example, if -framework FrameworkName is passed to gcc or clang on OSX, the compiler looks up the /System/Library/Frameworks directory to find the FrameworkName.framework dir. If it is found, the compiler includes its headers and links the program against its shared libraries.

So, does this super useful feature work on Linux? Do gcc or clang recognize the -framework option on Linux? When I type this option on Linux, the compiler seems not to recognize it, but maybe this is because I need to set the frameworks directory path before it. Is there any special trick to make it work on Linux? Or that is definitely impossible on this platform?


Solution

  • No, it won't work on Linux. Frameworks are a feature of the (OS X) Mach-O ABI. In theory, you could write a kernel module for Mach-O support, and supply linker / loader userspace tools. It would be a lot of work.