How to view OpenCV Build Information - opencv

I've already installed OpenCV from the sourceforge.net.
How can I get information about what settings were used to build it?

getBuildInformation() returns a string with
cmake output including version control system revision, compiler version, compiler flags, enabled modules and third party libraries, etc. Output format depends on target architecture.

Related

How to get bitcode llvm after linking?

I am trying to get LLVM IR for a file which is linked with some static libararies.
I tried to link using llvm-link . It just copy the .bc files in one file ( not like native linking).
clang -L$(T_LIB_PATH) -lpthread -emit-llvm gives an error: emit-llvm can not be used with linking. When passing -c option, it gives warning that the linking options were not used.
My main goal is to get .bc file with all resolved symbols and references. How can I achieve that with clang version 3.4.?
You may have a look at wllvm. It is a wrapper on the compiler, which enable to build a project and extract the LLVM bitcode of the whole program.
You need to use wllvm and wllvm++ for C and C++, respectively (after setting some environment variables).
Some symbols come from source code via LLVM IR. IR is short for intermediate representation. Those symbols are easy to handle, just stop in the middle of the build process.
Some others come from a library and probably were generated by some other compiler, one that never makes any IR, and in any case the compiler was run by some other people at some other location. You can't go back in time and make those people build IR for you, even if their compiler has the right options. All you can do is obtain the source code for the libraries and build your entire application from source.

GraalVM native-image compile Java libraries into iOS framework/libraries

GraalVM native-image allow us to convert Java libraries into local executable. It also allow to compile to shared library as mentioned https://www.graalvm.org/docs/Native-Image/user/README
An native image can be built as a standalone executable, which is the
default, or as a shared library by passing --shared to native-image.
For an image to be useful, it needs to have at least one entry point
method.
The closest thread I found is this one https://github.com/oracle/graal/issues/373, but still can't find any guide to do so for iOS, is that possible? Any guide I can follow?

Enable Bitcode Output in Cargo Build for iOS Targets?

I'm building an iOS framework that uses some Rust libraries. Right now, the libraries are compiled to a static library. In order for me to enable bitcode (this is needed for Apple app thinning), the Rust libraries need to be built with bitcode enabled. I believe this would require the llvm flag: -fembed-bitcode. Is there any way to do this in Cargo?
You can tell cargo to pass any argument you wish to the Rust compiler by setting the RUSTFLAGS environment variable. The Rustc compiler has a flag -C llvm-args=val that you can use to pass additional arguments to llvm.
Thus, in your situation you would call:
RUSTFLAGS="-C llvm-args=\"-fembed-bitcode\"" cargo build
I suspect that this matter of creating a binary that is compatible with Apple's bitcode format for iOS will require direct modifications to the Rust compiler. Here's a recent link I found discussing the issue. The author of that repo would be a good resource to contact on iOS issues.
There are going to be multiple technical problems but the most fundamental is generating bitcode that is the same format as iOS expects. That problem can potentially be solved on a temporary basis by building a custom rustc using the same LLVM that Apple is using in clang.

How can I use OpenCV on iOS with my own JPEG/PNG libraries?

I'm using OpenCV in an iOS project but I'm having problems because the framework includes libpng and libjpeg, which my project also includes. This is causing duplicate symbols during link.
I'd like to point OpenCV at my own copies of libjpeg/png but I can't find any way to make that work. I tried setting the build variables BUILD_PNG and BUILD_JPEG to NO but that didn't have any effect and setting WITH_JPEG and WITH_PNG to NO caused the APIs to fail at runtime when I tried writing images due to the missing support.
I also considered just pointing my project at the OpenCV Framework's libjpeg/png headers but those aren't exposed through the framework. I could pull the source for the version in the framework and build against those headers so that the linkage would match, but yuck.
What is the right way to use OpenCV on iOS in a project which also uses libpng and libjpeg?
I propose that you simply use OpenCV's versions of those libraries. That will require you to remove your own versions, and ensure you get copies of the correctly-versioned libpng and libjpeg headers.
I have just done this myself successfully for libpng - I need to get the headers for version 1.5.12. Note that for this version, you need the file pnglibconf.h which you can find in the libpng download as scripts/pnglibconf.h.prebuilt
My app was using libpng 1.2.34, and required very minor changes to work with 1.5.12.
I have also now done the same for libjpeg - I needed to get the headers for version 9 (libjpeg9). Again, you need a file jconfig.h, and the easiest way is simply to rename the bundled jconfig.txt.

Is it possible to compile potrace for iOS?

Looking at the cross-platform nature of potrace http://potrace.sourceforge.net/, is it possible to compile this for iOS? If so, how?
Yes, it is possible to compile potrace for iOS.
As a matter of fact, most open source libraries using standard (GNU) configure tools that compile on MacOS X will easily compile on iOS, because they are likely free of platform-specific code (e.g. linuxisms) and standard configure tools allow cross-compilation.
You can compile these libraries in the shell by pointing configure to the proper toolchain and SDKs. Paths changed with Mavericks and Xcode 5, but fortunately automated scripts exist for more popular libraries such as expat.
The proposed solution is based on the x2on/expat-ios project on GitHub. Their script fixes expat's config.sub which doesn't know about arm64 target. Do does potrace 1.11's config.sub. However, a simpler approach consists in downloading a more recent version of config.sub. Unlike expat, potrace doesn't seem to need any patch to compile for iOS.
Full script build-potrace.sh is available here:
https://gist.github.com/pguyot/dce18af64a71b93c0204
Please note that potrace is licensed under the GPLv2. You might want to check Is it legal to publish iOS apps under the GNU GPLv3 open-source license? question.

Resources