7
votes

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?

3
There's some old mailing list chatter when this was first added; it's still OSX-specific until people could come to some kind of agreement on what frameworks actually mean under Linux.Joe

3 Answers

4
votes

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.

3
votes

I use it on FreeBSD so yes framework should work on Linux. A framework is just a self contain folder for header, resources and lib file. The lib can have ELF format and you do not need mach-o support.

So it depend on what you want to do.

  • If you wish to use Cocoa framework then you most probably will not have it on linux. But if you are looking for object in the Foundation framework you can have it by installing GNUStep.

  • If you wish to build your own Framework that is possible too. In GNUStep you will find some helper makefile for that.

-1
votes

This quote shows how to compile OpenCL code on different platforms, for a program called user_buffer:

"On OSX, you would compile the program by running the following command on your terminal:

gcc -std=c99 -Wall -DUNIX -g -DDEBUG -DAPPLE -arch i386 -o user_buffer user_buffer.c \
-framework OpenCL

On the Ubuntu Linux 12.04 with Intel OpenCL SDK, the command will be as follows:

gcc -std=c99 -Wall -DUNIX -g -DDEBUG -m64 -o user_buffer user_buffer.c -I . -I /usr/include \
-L/usr/lib64/OpenCL/vendors/intel -lintelocl -ltbb -ltbbmalloc -lcl_logger -ltask_executor

On the Ubuntu Linux 12.04 with AMD APP SDK v2.8, the command will be as follows:

gcc -std=c99 -Wall -DUNIX -g -DDEBUG –m64 -o user_buffer user_buffer.c \
-I. –I/opt/AMDAPP/include –L/opt/AMDAPP/lib/x86_64 –lOpenCL

From https://www.academia.edu/22200475OpenCL_Parallel_Programming_Development_Cookbook

For the Nvidia OpenCL SDK on Linux, for a program called 'vectoradd':

g++ -I ~/NVIDIA_GPU_Computing_SDK/OpenCL/common/inc/ -lOpenCL vectoradd.cpp –o vectoradd

From the Nvidia OpenCL Getting Started Guide, available from https://uloz.to/!nY4NzLAG/nvidia-opencl-examples-cuda-4-2-9-sdk-zip