How can you add a macos framework as a dependency of a C++ library in Bazel - c++

I'm working on getting a Qt application building using Bazel on macos in preparation to getting it running cross platform on Mac and Windows.
I started with the linux example of this from github (https://github.com/bbreslauer/qt-bazel-example) and that mostly worked except that the Bazel couldn't link the frameworks from Qt as "cc_library"s. Unfortunately, after changing these to "objc_framework"s both the cc_library and qt_cc_library rules complain that objc_framework types are unexpected:
"objc_framework rule '#qt//:qt_widgets' is misplaced here (expected cc_library, objc_library, cc_proto_library or cc_import)"
From reading around, I understand that you can have a library depend on a framework (and you'd have to in order to build anything using frameworks) so the question is how can I tell Bazel to do it?
Note: I am using the latest bazelbuild/apple_rules extensions in my workspace setup.

Related

c++ ABI compatibility between gcc-4.4 and gcc-4.8

I've got a RedHat6 build platform which has gcc-4.4.7 installed and I've built a bunch of shared and static libraries on that platform.
Now I want to build an app on the above platform which links against the above libraries along with a third party library which has been built on RedHat7 using gcc-4.8.5.
My app will be deployed on RedHat7 platforms.
My questions are:
Will I be able to build my app successfully on the RH6 platform?
Will my app run when deployed on the RH7 platform?
According to my understanding of this, it seems that both versions of the toolchain have compatible ABIs, so I feel that the answer to both my questions is probably 'yes'.
A toy example I built to test it worked as expected, but I'd like to get the opinion of an experienced Linux developer.

Building GSL (GNU Scientific Library) in Windows for use with VS2015

I am trying to build GSL as a library(DLL,lib) to use with my application. I have tested both GSL ports(gladman) to VS and CMake route and I do not want to go that path due to various reasons.
Currently I am using nuget version and I am not too happy about it as some functions are missing. I want to build it myself to be absolutely sure about what I am getting. The objective is to build four set of dll and libs---win32, win32d, win64 and win64d.
I know that from a MinGW library I can build lib file(for VS2015) and thereafter dll using Microsoft LIB tool if I have DEF file available.
My open source experience is very limited. Till now I have successfully built gsl for MinGW using ./config, make, make install. But I am not finding any DEF file generated and I do not know how to utilize this build to generate required DEF and dll to be used with Microsoft Visual Studio 2015.
Thank you
Building and linking has always been a pain for me as well. For mac, I use Homebrew, which downloads frameworks and libraries through a simple one-line-command in the terminal. I would then simply add the library into my program by adding the directory of the libs necessary. In XCode, there was an "add framework/library"-button where I added the directories, but I'm sure there's an analogue in VS.
However, you seem to be using Windows (so Homebrew will not work). I searched the web for Windows versions of Homebrew, and it seems that Scoop is pretty similar. You might want to check that out.
Hope this helped, despite me using different tools :)

How to execute an arbitrary prebuilt binary on iOS Simulator?

I have a prebuilt binary which was not built with xcode, therefore I don't have any .app or xctest or any other Xcode related build artifacts.
I'd like to run it however on the iOS Simulator. How can I do that?
I've already checked this and this. Didn't help.
Some more background to understand the question:
I am building one of the Boost C++ libraries for iOS and I want to execute it's own unit tests. Boost has a completely different build system (Bjam) and I customised it to use the proper iOS toolchain and clang link/compiler flags.
I can't create an Xcode project for the whole Boost library, I already have a binary file (the unit test), which I just want to execute on the iOS Simulator.
(I could do the same task with Android really easily.)
Thanks,
Gabor
After doing more research I've found the answer.
The answer in short is this: It is not possible to do that.
But I can have nasty and awful workarounds.
Here is what I did for a workaround in case of the boost log tests:
I've already had an Xcode project which was capable of executing some tests on iOS Simulator. So I hacked into the Xcode project all the source files of the boost log tests. This way recompiling them. Still, I don't know what could be the solution if the source files would not be available.

Tesseract + OpenCV + linux

I have developed an OCR application on Windows using OpenCV and Tesseract. Now all I want to do is to write same application over Linux (Ubuntu 12.10) in C++. And I don't have any experience in Linux development. I don't know where to start. All I want is developing environment in which I would able to link these two libraries OpenCV and Tesseract.
Please suggest me. I have tried searching Google but failed. Maybe I am not searching with good keywords. As I am totally new in Linux
First make sure that you compiled OpenCV on your system, as OpenCV's linux bundle hasn't got pre-compiled libs (unlike Windows bundle). Follow this tutorial.
For a starting point, build up Eclipse as IDE and follow this tutorial. It shouldn't be so hard to adopt if you already used Visual Studio (MSVC Windows compiler).
Later on, it would be wise to learn about gcc (official linux compiler for your c++ code) and its syntax, and maybe together with CMake. Because learning the terminal and g++ syntax suddenly accelerates the development process. Linux has got many opportunities for a developer, such as pkg-config, which links all the libs and headers automatically (well, almost). You can also go for learning CMake for cross platform development and let it use "gcc" by default; example here.
Also note that, using cygwin, you can actually compile & build linux binaries on a Windows platform. For the opposite; check MinGW.
Good luck.
EDIT: other cross platform solutions
VisualGDB
Qt

Qt Program deploy to multi platform, how?

Am new in Qt Programming and i would like to develop a program which i want to run in Windows, Linux(ubuntu), and Mac.
I heard that Qt support mutli-platform application development,
but my Question is that,
would any Qt library need to run these appilication in Ubuntu after i deployed or compiled?
If you deploy on Ubuntu, and therefore use a .deb package, then your job is easy since you just have to require qt as a dependency and apt will automatically install it as needed.
Windows and Mac however do not have any "good" software management layer, so you have no choice but include the required Qt DLLs with your binary or compile a static one. On Windows you just have to make sure the DLLs are in the same directory as your program. Mac however requires some relinking to be done. This is a big pain, but fortunately Qt comes with a tool named macdeployqt which does this for you.
So according to my experience, Linux is the easiest platform to deploy to, followed by Windows, and Mac is a good last.
The link to the Qt deployment doc given above is a good starting point. If you need an example, I have written a couple of scripts to build the Windows binaries of a program of mine. You can have a look at these to get started.
Windows installer:
http://gitorious.org/tagaini-jisho/tagaini-jisho/blobs/master/pack/win32-cross/buildwin32releases.sh
http://gitorious.org/tagaini-jisho/tagaini-jisho/blobs/master/pack/win32-cross/tagainijisho.nsi
Talking for the Linux side here, if you distribute your application as packages (deb, rpm) then you can use the package dependencies rules. If you define these rules correctly, then the package manager will install the Qt libraries you need when installing your application.