Trying to build the example code in ada-util. So i'm running
gnatmake json.adb inside the ada-util/samples/ directory.
However I get the following error:
gnatmake json.adb
gcc -c json.adb
json.adb:21:06: file "util.ads" not found
json.adb:23:06: file "util.ads" not found
json.adb:23:06: "Json (body)" depends on "Mapping (spec)"
json.adb:23:06: "Mapping (spec)" depends on "Util (spec)"
json.adb:24:06: file "util.ads" not found
json.adb:25:06: file "util.ads" not found
json.adb:26:06: file "util.ads" not found
gnatmake: "json.adb" compilation error
So there's clearly something wrong with my path because I've installed ada-util and I can confirm that util.ads is in the install directory. Now, clearly there's something going wrong here as this isn't the first PATH issue I've had with Ada recently. Where is it supposed to be installed? As currently it's under /opt/GNAT/2020/include/utilada_core.static/util.ads where the GNAT install lives.
Questions:
Where should it be if not here?
Do I have to tell gnatmake where it is and if so how - couldn't see in the docs
If so, why do I have to tell gnatmake where it is given I followed the install instructions -- is that a bug in the install process or is something else going on?
Looks for me, like the library is in proper place.
As you guess properly, you have to tell it where the library is located. As far I see, in the root directory of the project, there is the file samples.gpr. Thus, if you want to build samples, you have to execute in the root directory of the project:
gnatmake -P samples.gpr
Or, if you are in samples directory (like in your example):
gnatmake -P ../samples.gpr
This should build all samples.
By default, gnatmake can't find needed libraries, same as GCC can't find extra libraries for C/C++ projects. It is generally done by GNAT Project files (these one with .gpr extension, easy way) or via compilation flags (hard way) or Makefiles. The Ada compilation process is similar to the C/C++. It also needs a lot of flags, settings and sometimes, for a bigger project not working out of the box. :)
Related
I need to compile the rtree extension for SQLite from source code. The readme includes these instructions:
The easiest way to compile and use the RTREE extension is to build
and use it as a dynamically loadable SQLite extension. To do this
using gcc on *nix:
gcc -shared rtree.c -o libSqliteRtree.so
You may need to add "-I" flags so that gcc can find sqlite3ext.h
and sqlite3.h. The resulting shared lib, libSqliteRtree.so, may be
loaded into sqlite in the same way as any other dynamicly loadable
extension.
Problem I'm having is that I'm on Windows, not Linux, and so need to use MSVC. I tried:
cl rtree.c -link -out:libSqliteRtree.so
This gave cannot open include file errors until I found the various .h files it was complaining about and moved them into the same directory. Now, however, it's gotten to:
/out:rtree.exe
-out:libSqliteRtree.so
rtree.obj
Creating library libSqliteRtree.lib and object libSqliteRtree.exp
LINK : fatal error LNK1561: entry point must be defined
I admit I have pretty much zero clue what I'm doing in a compiler, and I'm not sure where to go from here to resolve its problem. Am I "translating" the compiler flags correctly from GCC to MSVC? What else can I tweak to try to get the SQLite extension out of the source code? Should I beg a favor from a developer on ateam with a Linux server and ask them to do it for me?
Thanks to Shawn for commenting to look at the SQLite Run-Time Loadable Extensions documentation, which had more information in it:
To compile on Windows using MSVC, a command similar to the following will usually work:
cl YourCode.c -link -dll -out:YourCode.dll
So for my situation: cl rtree.c -link -dll -out:libSqliteRtree.dll worked.
I know this question has already been asked, but I encounter an issue that I haven't seen elsewhere.
I am trying to build automatically a QT program on Jenkins through a JenkinsFile.
So I want to build this program in command line.
On Qt Creator, everything works fine, my makefile is generated and the program compiles.
But when I manually type the exact commands that are executed in Qt on a terminal (cmd and cygwin), the compilation fails.
The errors are usually ld: cannot find -lXXXXXX
My guess is that it is an environment problem so I tried to add some lib paths in the $PATH, $LIBRARY_PATH, and $LD_LIBRARY_PATH variables but it doesn't resolve the problem. The error just becomes Undefined reference to ___XXXXXX
I would appreciate some help on this issue !
Thanks.
EDIT
The building (slave) machine is a windows 7. Here is a screenshot of the compilation stage in Qt (which works fine). The commands I try to type in a terminal are exactly the same as the blue lines on the screenshot. (sorry some lines are written in French)
From the error message ld: cannot find -lXXXXXX and the environment variables, I would suppose that you are compiling in Linux/Unix. Now, if you are compiling with g++, the environment variables $PATH, $LIBRARY_PATH, and $LD_LIBRARY_PATH won't have any effect on finding libraries. What you may try is an -L argument to the compiler telling it where the library is located, I mean:
g++ -L /path/to/libXXXXX.so -l XXXXX -o result source.cpp
My environment is below.
・Operating System and version:windows 10 64bit
・Compiler:C:\msys64\mingw64\bin\g++.exe
・PCL Version:1.9.1
pcl_config.h not found as below error occurred when compiled under above env..
Certainly this header file is not included.
Let me know how to solve it.
PS C:\pcl\pcl\examples\common> g++ -o minmax -I ../../io/include -I ../../common/include .\example_get_max_min_coordinates.cpp
In file included from ../../common/include/pcl/PCLHeader.h:10,
from ../../common/include/pcl/point_cloud.h:47,
from ../../io/include/pcl/io/pcd_io.h:42,
from .\example_get_max_min_coordinates.cpp:2:
../../common/include/pcl/pcl_macros.h:64:10: fatal error: pcl/pcl_config.h: No such file or directory
#include
^~~~~~~~~~~~~~~~~~
compilation terminated.
Short answer
pcl_config.h is generated via pcl_config.h.in by the cmake tool. So it seems that compilation did not finish correctly.
Longer answer
Please make sure you have compiled the relevant modules of PCL (at least pcl-core) before proceeding
You might prefer a pre-built installation from releases or distributed by a package/source manager of your choice
PCL makes heavy use of other libraries and it is best to supply the dependencies (as mentioned below) via CMake or manually via the -I and -l options. If you provide the location of pcl_config.h, the compiler will complain about Eigen next.
The build instructions are available here. TL;DR: After satisfying the dependencies (cmake, c++ compiler, boost, eigen, flann, vtk and other depending on use-case), run the following commands
cd $PCL_SOURCE_DIR
mkdir -p build; cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j8
Feel free to use any build generator (like Ninja) or change build type to Debug or RelWithDebInfo as per your needs.
I'm using gcc (GCC) 4.5.4 20120510 for GNAT GPL 2012 (20120509)
and qtada from qtada-gpl-3.2.0-20120708-3871-qt4.8.2-2.exe installer.
I'm trying to compile example from "..\GNAT\2012\examples\qtada\sql\cached_table", but it say "table_editors-moc.ads not found",
The error came from statement :
with Table_Editors.MOC; pragma Warnings (Off, Table_Editors.MOC);
-- Child package MOC must be included in the executable.
Where can i found the "Child package MOC" that contains "table_editors-moc.ads" and another moc file??
I don't know Qt or QtAda, but a quick search indicates that Qt uses a Meta Object Compiler (MOC) to auto-generate source code from macros. Could it be that your Table_Editor.MOC is supposed to be generated?
I'm surprised that QtAda has installed its examples at \GNAT\2012\examples; judging by the way GNAT is set up on this Mac, I'd have expected \GNAT\2012\share\examples.
However .. I suspect that QtAda's file system layout is complicated enough that you'll need to use a "GNAT Project file" to do the build. I hope there's a .gpr file in the same directory as your example code (if not, I can't help); if so, and assuming it's called cached_table.gpr, then in a command window say
gnatmake -p -P cached_table.gpr
or (following the documentation for QtAda 3.1)
gprbuild -p -P cached_table.gpr
I am trying to cross compile Qt with WebKit for an embedded arm device (freescale processor). I have a arm-none-linux-gnueabi toolchain.
Qt actually compiled, but I have run into problems when trying to compile the demos, in particular the WebKit ones, which is really what I am after.
The first problem I was having was that libjscore was not found, which was an error due to the way Qt handles static builds. Turns out you can copy the library and it works, see here.
Now compilation breaks again saying it can not find libpthread.so.0, which would seem to be a toolchain problem rather than a Qt problem.
Searching the directory tree in my toolchain, there are several libpthreads. A copy of the find | grep libpthread command's output is below for reference.
./arm-none-linux-gnueabi/sysroot/vfp/lib/libpthread-2.5.so
./arm-none-linux-gnueabi/sysroot/vfp/usr/lib/libpthread_nonshared.a
./arm-none-linux-gnueabi/sysroot/vfp/usr/lib/libpthread.a
./arm-none-linux-gnueabi/sysroot/vfp/usr/lib/libpthread.so_orig
./arm-none-linux-gnueabi/sysroot/vfp/usr/lib/libpthread.so
./arm-none-linux-gnueabi/sysroot/lib/libpthread-2.5.so
./arm-none-linux-gnueabi/sysroot/usr/lib/libpthread_nonshared.a
./arm-none-linux-gnueabi/sysroot/usr/lib/libpthread.a
./arm-none-linux-gnueabi/sysroot/usr/lib/libpthread.so_orig
./arm-none-linux-gnueabi/sysroot/usr/lib/libpthread.so
So it seems that there is something weird with the linker? Also, what needs to be symlinked to create the libpthread.so.0?
Note: the _libpthread.so_orig_ and libpthread.so follow this fix.
Any help or suggestions are much appreciated. I've been banging my head against a wall for two days now.
Thanks
In general, you should make sure that the toolchain you built (or has been built for you) is in the same exact path it was built at. The libraries (*.so *.a) should also be in the same original path. It should look like this:
<path>/bin
<path>/usr/lib
<path>/lib
Those folders should not be moved. The toolchain executables are in "bin" and the libraries it looks for are in "../usr/lib and ../lib". Also, <path> may be hard-coded into your gcc binaries in some fashion. Moving it around seems to break things.
Target is a raspberry PI
I copy target lib directory to myuserdirectory
target /usr/lib to my crosscompiler /usr/lib/ directorie
target /lib my crosscompiler /lib/ directorie
I create two symbolic link:
ln -s /yourcrosscompilerusrlibdirectory /usr/lib/arm-linux-gnueabihf
ln -s /yourcrosscompilerusrdirectory /lib/arm-linux-gnueabihf
and it's work for me
libpthread are in /yourcrosscompilerusrlibdirectory