Gnustep with Cmake - objective-c

I am currently trying to use objective-c with cmake and GNUStep and managed to enable objective c in cmake using mingw compiler but i wanted to know how to use gnustep with cmake so i could program in objective c on windows or linux so how could i do this is there any ideas or cmake script?
My mainly goal is compiling objc code from cmake directly without using gnumake files or the shell
I tried linking gnustep from it's folder which installed but it didn't work and i searched for any cmake script to link gnustep directly from it's installed folder in c drive and also nothing came up
I am using vs code on windows along side with mingw gcc compiler

Related

As a library author using CMake, should I be cognizant of pkg-config?

Suppose that:
I'm writing a C or C++ library.
I intend my library to be usable on multiple Unix-like platforms (and perhaps also on Windows).
I use CMake for build configuration.
I have some dependencies on other libraries.
Given this - should I be cognizant of the pkg-config mechanism? Versed in its use? Or - should I just ignore it? I'm asking both about its use when configuring my library's build, but also about whether to make sure the installation commands generate and install a .pc file for my library?

Compile Tensorflow programs with custom compiler

I'm trying to compile a very simple Tensorflow program (which only prints the Tensorflow version) with my company's c compiler but the libtensorflow.so I downloaded from Tensorflow's offical website is incompatible with our c compiler.
My company's c compiler is pretty much just a standard gcc but gcc can compile the program and our custom compiler cannot.
My colleague told me I have two options: (1) replace Bazel's compiler with our compiler and use Bazel to compile the program or (2) Compile the program with Bazel first then compile the program using our compiler and include the pb.h files generated by Bazel (because those bazel files can only be generated by Bazel).
I'm not sure how to do (!) but I tried (2). The problem with (2) is I got erros saying the protoc was generated by an older version and I'm not sure how to change to the right version.
Some additional information: (1) The OS is Linux, (2) I do not have the privilege to use sudo commands, (3) I cannot access system directories (e.g. /usr/local)
Is there any hope I can make this work? You may ask why not just build the program with Bazel. It's because our company's program needs to be run by our company's simulator and the simulator only accepts program generated by our company's compiler.
Your only option is to build tensorflow with Bazel, and tell Bazel to use your C/C++ compiler. The easiest way is to set the CC and CXX environment variables to point to your compiler's executable. If it is really a drop-in replacement of GCC, then it should work and after building you should get a tensorflow binary compiled with your custom compiler.
If special flags are needed then you should make a custom toolchain in Bazel to tell it how to use your compiler, it is a bit complex but not much. Instructions for that are at https://github.com/bazelbuild/bazel/wiki/Building-with-a-custom-toolchain

Why Can't I Compile Objective-C/C++ (.mm) Files with MacPorts gcc-mp-4.6?

I have a C++11 codebase I compile with gcc 4.6 from MacPorts on OS X Lion. I also need to compile and link some OS-specific Objective C/C++ files to make the final executable. I would like to use the same compiler version to compile the whole project, but I cannot get the MacPorts version 4.6 of gcc to recognize Objective-C files; it always attempts to interpret them as C++ code and ignores the .mm file extension. (Compiling these files does work with the Xcode version of gcc, just not the MacPorts one. However that gcc is version 4.2 and I want to compile everything with gcc 4.6 or later.)
Forget IDE's or build tools: I get the same result from a commandline invocation of the compiler. That is, I record a commandline that works for compiling .mm files with the Apple gcc, verify yes it does work from the commandline, then run the identical command with nothing changed but the compiler used and it doesn't work. What am I missing?
It appears maybe the specific problem I'm having might be due to an Apple specific language extension, as the specific error I get is the same as this quote from a blog post:
After adding this, I was good for about 30 seconds until I get to the
portion of my project where some COCOA Objective-C UI stuff was being
compiled.
/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSTask.h:75:24:
error: expected unqualified-id before '^' token
/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSTask.h:75:24:
error: expected ')' before '^' token
Uh oh. I know what this is. This is the Apple "blocks" language
extension. It appears that blocks are used in a bunch of the system
header files. I don't think there is going to be a way to get around
this using MacPorts gcc. The FSF gcc just doesn’t know about blocks.
Fortunately for me, I didn't have anything in the Objective C/C++ code
that needed to be compiled with gcc 4.6 so I just had this target
compile using clang.

Compiling Objective-C files into object files (.o)

I have been tasked to create object .o files for an iOS project in Xcode 4. I have tried the following command which works on NSObject classes
gcc -c implemtationfile.m
but if I try to run the command on a class inherited from UIViewController for example I get a ton of errors starting with
UIKit/UIKit.h: No such file or directory
Secondly, since there are multiple files in the project, is it possible to create one .o file for all source files?
Not surprised you've got errors.
You are trying to compile iOS code from OSX. If you invoke GCC from the terminal, you'll get the Mac OS X compiler.
Even if it can produce .o files, those object files are Mach-O object files, meaning they are compiled as object-files against the Mac OS X compiler tool-chain.
No iOS here. Your object files will have the Intel (x86) or PPC architecture. iPhone is ARM, so you're wasted.
You should be able to proceed ARM object files using the right GCC compiler tool-chain.
Something like:
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-gcc-4.0.1
I haven't tested, but that's clear that you need to use the iPhone ARM version of GCC. Just invoking GCC will invoke the Mac OS X version (in /usr/bin/).
A compiler like GCC needs to be compiled for a host and a target architecture.
The host architecture is the architecture in which you will invoke the compiler.
The target one is the architecture for which you'll build binaries, or object files.
So try to compile your code with the correct version of GCC, which suits the iPhone target architecture.
Also note that, if compiling against a framework, you should use the -framework GCC argument.

Troubling Compiling wxWidgets with MinGW

I am having trouble compiling wxwidgets with mingw on Windows 7 x64. It compiles for 30+ min, then runs out of memory. My computer has 6 GB of memory, so I don't know what is wrong.
Someone mentioned something about a 64 bit version of MinGW. Would this help, and if so, how would I use this?
I am able to compile just fine with Visual Studio.
Also, if I wish to use it with CodeBlocks, how do I add wxWidgets to CodeBlocks (I.e. link to it)?
Actually, I somehow solved my own problem a few days ago, but forgot to note this up here.
I deleted the wxWidgets folder, reinstalled it, then compiled it according to the directions in a zip file here: http://dev.arqendra.net/#cbnb.
After you have installed wxWidgets, fire up msys, cd to the wxwidgets folder, then run
mingw32-make -f makefile.gcc BUILD=debug UNICODE=1
(Assuming mingw32-make is in your path).
Wait a while (maybe 20 minutes, depending on your computer's processing power).
Repeat this for release i.e.:
mingw32-make -f makefile.gcc BUILD=release UNICODE=1
Next, you have to deal with a quirk by copying \wxWidgets\include\wx\msw\setup.h to \wxWidgets\include\wx.
You can apply other options to your liking.
Also, to "add" wxWidgets to a project in C::B, you can just set up a wxWidgets project, saving you the trouble of adding the right directories (and .a libraries).
I used MinGW 4.5, installed using the "MinGW GCC 4.5.0 Installer" from their site. To compile wxWidgets using MinGW, I used:
cd %WXDIR%\build\msw
mingw32-make -f makefile.gcc BUILD=debug RUNTIME_LIBS=static
In codeblocks there is a dialog for setting the path for MinGW. You set the path for wxWidgets in the new app wizard. I really recommend you set the same MinGW version you used to compile wxWidgets.
This is probably due to this gcc bug: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43601#c9 you may try installing another version of gcc.