Building Arm libraries - build

I am new to ARM and building stuff. So question may be very simple. I have project which uses some libraries. This libraries built in Arm format. I want to change something in this libraries but their source code is x86 format. So I think that I have to build arm libraries from this format but I have no idea how to achieve this. Thanks for help.

What do you mean by "their source code is x86 format"?
As you want to build libraries for ARM you can use the same source code to build libraries either by setting up a cross compilation toolchain or building the source code onto the ARM system itself.
Although if there is any dependency of platform libraries, you need to make sure that those libraries are available in your cross compilation toolchain or onto the ARM system.

There is a lack of information in my post. Firstly sorry for that. Source code of the libraries are in different places from the my arm project. In arm project there isn't any source code. I didn't design this project. I want to change only few things. But to change these things I need to update source code of libraries. After some search I found source code totally different places. It has no effect on building process of arm projects. So I think that I can use this source code to create updated libraries. But MakeFiles of this source code designed for x86 architecture. I don't how build arm type libraries from this source code.

Related

Why does Qt have to be built from source for cross-compilation?

I need to build a Qt app for ARM. So many pages like this one show that I have to build Qt from source using a lengthy process. Why is this necessary? Can't I just change the target platform inside Qt Creator, which I find under Tools > Options > Build & Run > Compilers?
I am a bit surprise at this, because Eclipse CDT does not require such process. It seems to suggest that I must different Qt installations for each specific platform. This seems like a bad design. Could someone enlighten me on this?
For the sake of the explanation the difference should be pointed out between:
the LIBRARY, i.e. the code provided by Qt
and
the CODE that uses the library, i.e. the code written by you.
In order to spare the time of compiling the LIBRARY over and over again, as it does not change so frequently (amongst other reasons), it is compiled once and then the compiled binaries are linked in the CODE.
Tools > Options > Build & Run > Compilers allows you to add tools to compile the CODE for the target platform, provided you have the binaries compiled by someone, e.g. Qt, for the same platform.
If no one have done that and (most importantly) made the binaries available to you, then you have to do it by yourself, meaning that you have to build the LIBRARY from its sources.
To see if there are official precompiled binaries for your target platform, please check the offline installers page.

How to use llvm libraries

I am working in a project that consist of some C++ teams. Each team delivers libraries and our team is integrating these libraries into a front end application.
The application is cross platform, so it means that other the teams have to provide the same (static) libraries compiled for different platforms/CPU architecture/configuration. Eg. we have Visual Studio 2015/2013, 32bit/64bit, linux, Debug/Release etc.
It would be nice to reduce the number of these static library "manifests", so I was looking into the Clang/LLVM. The idea would be compile the static libraries into LLVM bitcode and use the llvm-ar tool to create an llvm static library. When we have to make the binaries for a specific platform we would use the llc (LLVM platform compiler) to create the native code static library and do the linking with the platform linker.
Questions:
is there a better way to do what I want to achieve?
the llc does not seem to support the compiling of a static library, only individual translation units (.bc -> .o). Of course I can extract each individual bitcode file, assemble it to native object file and use the platform librarian tool (lib/ar) to make the static library, but I wonder if there is a more streamlined solution.
the gold linker seems to make something I need, but seems to be restricted to ELF format. I have to support Windows/Linux and maybe IOS
LLVM IR generated from target-specific and platform-specific language (C/C++) won't be target neutral. Think about type sizes, alignments, ABI requirements, etc. Not the mention pure source code features like preprocessor. So, no, the approach you thought about won't work at all.
See LLVM bitcode cross-platform for some more information.

How to build self-contained executable with gcc? [duplicate]

I wrote a program, that uses a shared library installed on my system. This library is seldom installed on other systems. How do I compile my program so that the library doesn't need to be installed on other systems? I have the source code for the library available. What's the best way?
The other systems of course have the same architecture and OS.
Compile it as a static library and link that into the executable.
Though the OP had solved his problem by answering a different question, there are (at least) two ways to wedge a shared library into your binary in case
there is no source code available
there is no compiler (or build-chain) available
static link does not work or it's not obvious how do it
to preserve memory layout - static link will change it and may "wake-up" hidden bugs
for "permanent link" LD_PRELOAD library into executable
The first is statifier (open source but limited to x86 and x86_64 and only object code)
The second that I know of is magic ermine (by the same developer). It is closed source, but the developer is friendly to opensource projects and ermine has the advantage of supporting more platforms as well as the ability to include all necessary data files within its virtual file system.
http://statifier.sourceforge.net/ and http://www.magicermine.com/

The dependencies between opencv libraries

When we build the opencv library, either in a dynamic way or in a static way, we will produce several separated libraries. Take the 2.48 version for example, we will have
opencv_core248 opencv_imgproc248 zlib IlmImf comctl32 opencv_highgui248 libpng
and so on. So my question here is clearly there are some dependencies between these libraries, for example, if I want to invoke opencv_core248 and opencv_imgproc24 library in a project, I have link errors. Then, if I add zlib library, the compilation error will be solved.
Question: I want to ask a very general question: how can I know the dependencies between all the libraries insider opencv? Are there some documents I can follow? Thanks.
I don't think there is a document listing all the dependencies between the OpenCV libraries.
However I can suggest two methods to find out these dependencies:
Using Dependency Walker, a free tool allowing to analyze executables and DLLs. For instance, if you open opencv_calib3dXXX.DLL (where XXX represents your OpenCV version), you'll see that it requires opencv_coreXXX.dll, opencv_flannXXX.dll, opencv_imgprocXXX.dll and opencv_features2dXXX.dll and some system DLLs.
Using the project structure generated by CMake, a free tool for cross-platform compilation which is used for compliing OpenCV from sources. For instance, if I generate the project structure for VS2010 and open it, I can right-click on the project associated to opencv_calib3d and view the project dependencies.
I mentionned the tools I know and use for Windows, but equivalent tools must also exist for other platforms.

Running Qt program without IDE

How can i run a program which already has been built and compiled before on Qt IDE, so that i can take that program and run on any computer I want without recompiling it on that computer. I am a beginner so bare answering this question.:)
Thanks
There are a few parts to your problem.
1) You need to compile it for each architecture you want it to be used on.
2) Each architecture will have a set of Qt dynamic libraries associated with it too that need to be available.
3) Some architectures have an easy-to-deploy mechanism. EG, on a mac you can run "macdeployqt" to get the libraries into the application directory. For nokia phones (symbian, harmattan (N9), etc) QtCreator has a deploy step that will build a package for the phone and even include an icon.
4) For systems without such a feature, like linux and windows, you'll either need to distribute the binary and require the user to have Qt available or to package up a directory/zip containing the needed Qt libraries and distribute that.
It doesn't launch because it cannot find the dependencies. As you are on Windows, these libraries can be moved in the same directory as your application. To find which library is missing, use dependency walker
I am pretty sure these libraries are not found:
The Qt dynamic libraries (can be found on Qt bin directory, take the dll)
The C dynamic libraries used for compilation. If you are on creator and use default setting it will be mingw-xxx(can be found in the Qt installation directory, don t know exactly where)
Every Architect has a set of CPU Instructions.
so it's like when you hear a language that you don't understand. like when i speak Arabic To Someone who don't Understand The Language.
Every Architect Has a set of Processor Instructions, The Compiler only convert the code into instruction only understood by The Architecture that your CPU is.
That's Why Python and the most of High level languages Use Interpreter Instead of a Compiler.
But There are some cross compilers like MinGw that Support Cross compiling To Windows (.exe files)
Simply QT Have some libraries important to be in the working directory for your project.