I would like to know how to build gdal for C++ with MinGW、MSYS2.And using the gdal in vs code - gdal

Recently,I am going to try to build GDAL with MinGW.And it must have the precondition that you should build the proj and SQLite first.But I do not know how to add these libraries in the gdal building process.So the MSYS2 shows me the information that it cant find PROJ and SQLite.So I want to know how to add these information to make sure the building process complete.By the way, the GDAL I tried to build is 3.2.3.
I have already use the command ./configure xxx and make.And the make command tell me that it can not find the proj and SQLite.I used to build the GDAL with MSVC in VS.At that moment, I modified the "nmake.opt" to add the information of proj and SQLite.Is this method also useful in the MinGW building process?

Related

Compiling project that depend on LLVM using CMake on Windows

I'm a *nix user, installing LLVM is easy for me, just download the precompiled file, set LLVM_DIR, and you're done. But I'm having a lot of problems with Windows ...
I downloaded LLVM-<version>-win64.exe from the GitHub release, but I can't find LLVMConfig.cmake file. Then I tried to compile LLVM from the source following this documentation.
When I started compiling my own project, I got this error:
'C:/<...>/Debug/libLLVMSupport.lib', needed by '<...>.exe', missing and no known rule to make it
I guess maybe I'm missing some compile options. but I can't find the documentation for LLVM_ENABLE_PROJECTS or BUILD_SHARED_LIBS, not even a list of component names.
I tried to add -DBUILD_SHARED_LIBS=ON but CMake told me BUILD_SHARED_LIBS option is not supported on Windows.

FlatBuffers with Autotools

FlatBuffers build is based on cmake, I don't have(and cant install) cmake on target system where I want to build it
FlatBuffers don't seem have support for autotools, have anyone tried to use autotools(./configure, make, make install) to build FlatBuffers?
Assuming you can build flatc on your development system (or you can generate code somewhere that is not your target system), actually building on the target system involves the generated header, and the headers in include/flatbuffers, i.e. it is header-only and as such doesn't need any build system to build it. Just point the build of your actual project to where these headers are (-I).

Integrating application Yocto arm bitbake

I'm trying to have my recipe be compiled and linked against the arm libraries. I'm using cmake. I can't seem to figure out the right work flow, after having read trough multiple documents on the yocto site and reference materials. My approach right now is:
Set the source
Build my target minal image, without the layer that I want to use
Try to build my specific recipe: bitbake Test
I have downloaded the arm toolchain from the Yocto site, and prepared it in my sources/poky. Here I can see the systroots and all the libraries that I would need. My recipe bb file is the following:
# This file was derived from the 'Hello World!' example recipe in the
# Yocto Project Development Manual.
#
SUMMARY = "Project"
SECTION = "examples"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
SRC_URI = "file://."
S = "${WORKDIR}/project/src"
inherit pkgconfig cmake externalsrc
And my CMake file contains, among more:
link_directories(/media/traffic/Yocto/QorIQ-SDK-V2.0-20160527-yocto/sources/poky/sysroots/aarch64-poky-linux/usr/lib)
I'm able to compile a hello world project fine, but as soon as external libraries take a role, it goes wrong.
cannot find /usr/lib/libpthread_nonshared.a
/media/traffic/Yocto/QorIQ-SDK-V2.0-20160527-yocto/build_ls2084abluebox/tmp/sysroots/x86_64-linux/usr/bin/aarch64-fsl-linux/../../libexec/aarch64-fsl-linux/gcc/aarch64-fsl-linux/4.9.3/ld: cannot find /usr/lib/libpthread_nonshared.a
It seems to look in the wrong folder. Are the steps that I'm taking correctly? Or am i missing something?
Elmar
Which poky version are you using? I got exactly the same issue recently with another package. There are 2 issues here:
It cannot find the pThread library. I added a FindThreads.cmake in the tree and imported it. But then the linker could not make it. I went to the conclusion, cmake itself had an issue with this library and ended changing the poky commit to have a different version of CMake. Note that you can also keep the new poky versions and have the custom CMake in your layer.
CMake 3.7 and 3.8.2 were not working properly but the 3.7.1 was for me (hash c9a512b6408d4cc11c1b36f7bc1b9b1c31056ce1). To find out which commit, you can execute
git log --pretty=oneline | grep cmake:

linking failed when building my own project using LLVM

I'm learning to build a llvm project, this is the reference: http://llvm.org/docs/Projects.html. I use the "llvm/projects/sample" directory as the primary project skeleton, and it works. Then I want to build tools from "llvm/examples" to my project, such as Fibonacci, it can't work. I do it this way: first copy the "llvm/examples/Fabonacci" directory to "MyProj/tools" ("MyProj" is top level of my project) and change Makefile to contain Fabonacci target, then configure & make. but the Fabonacci tool seems can't be built. It depends on some libs when linking. So what can I do if I want to build the source code from "llvm/projects/example" in my project?
You need to provide LLVM libraries to linker when building your own project. This means adding some flags, library directories and libraries themselves to link command. Build script probably needs some editing.
llvm-config tool can be used for providing necessary options to compiler/linker. Check documentation and examples.

LLVM based project lib dependencies for CMake on windows

This has been asked here before but I couldn't find a solution which works for me.
Sample CMakeLists.txt file for LLVM project - This was the original question.
However, there are a couple of issues I am facing when making a project with LLVM.
Platform: Windows 7
Compiler: MingW
1) Firstly, I am using the svn version of llvm which is currently at 3.1. Currently, Binaries for MingW are not present for llvm 3.0 too so I decided to go with the latest itself and build it with mingw. So although the build works fine, I cannot seem to find the llvm-config perl script in the bin folder. I tried searching the entire dir yet I can only find an llvm-config folder and a dependencies file.
2) I tried building llvm for Visual studio 2010 yet that didn't work with cmake so I had to use MingW.
3) Now, this is sequence in which I add libs to CMake -
LLVMXCoreInfo
LLVMMipsAsmPrinter
LLVMMipsCodeGen
LLVMMipsInfo
LLVMMBlazeAsmPrinter
LLVMMBlazeCodeGen
LLVMMBlazeInfo
LLVMLinker
LLVMipo
LLVMInterpreter
LLVMInstrumentation
LLVMJIT
LLVMExecutionEngine
LLVMMC
LLVMBitWriter
LLVMX86Disassembler
LLVMX86AsmParser
LLVMX86AsmPrinter
LLVMX86CodeGen
LLVMX86Info
LLVMAsmParser
LLVMARMAsmParser
LLVMMCParser
LLVMARMAsmPrinter
LLVMARMCodeGen
LLVMARMInfo
LLVMArchive
LLVMBitReader
LLVMSelectionDAG
LLVMAsmPrinter
LLVMCodeGen
LLVMScalarOpts
LLVMInstCombine
LLVMTransformUtils
LLVMipa
LLVMAnalysis
LLVMTarget
LLVMMC
LLVMCore
LLVMSupport
imagehlp
psapi
m
4) However, adding InitializeNativeTarget(), starts giving me linking errors which I think come because of the dependencies not being in right order.
5) I want to use the llvm_map_components_to_libraries(REQ_LLVM_LIBRARIES jit native) and hence I added this to my CMakeLists.txt
INCLUDE(cmake/LLVM-Config.cmake)
However, this doesn't work. CMake Error at cmake/LLVM-Config.cmake:141 (message):
Library `jit' not found in list of llvm libraries.
Now, the question is really too long but I basically wanted to ask what is the best way to do this in CMake. Could someone post the entire thing (for windows).
Also, is there a way to build it for VS 2010. I tried the instructions on CLang site but those gave me this error in CMake.
" string sub-command REGEX, mode MATCH needs at least 5 arguments total to command."
I really need some help figuring out how to get dependencies to work in llvm and for it to build with VS. I would really appreciate some help.