-
Notifications
You must be signed in to change notification settings - Fork 5
Description
I have finally compiled it in Fedora Linux. I want to report some issues I faced and how I solved them (for my system):
-
in installing the include files (i.e.
make install), these are omitted:clarisma/io/detail/*.inl. But they are needed byclarisma/io/FileError.h. -
I have downloaded
gtlfrom the git repo yourCMakeFiles.txtuses, and installed it in my local system so as not to re-fetch it each time I experiment with a new build. In this scenario, there is nolibgtl. But there is a-lgtlinbuild/CMakeFiles/geodesk.dir/link.txtwhichgcccomplains about and stops. Removing that-lgtl(from the end of the 1st line of said file), solves the problem for me. -
If doing testing, file
build/CMakeFiles/geodesk-test.dir/link.txthas the same problem with-lgtlat the end of the line. -
Also in file
build/CMakeFiles/geodesk-test.dir/link.txt, it has the staticlibgeodesk.aat the end of the line (1st line) and linking does not happen, it seems, because it complains about undefined symbols from said library and also for the other libraries around there, likelibCatch2.a. For my system/gcc, it worked if all those libraries were moved BEFORE-o geodesk-test. Currently, these libraries are after it. -
Additionally, I do not know why linking with
-Wl,-rpath,/home/xyz/Downloads/libgeodesk2/build2 libgeodesk.sodoes not work (undefined symbols likegeodesk::MatcherCompiler::getMatcher(char const*)are reported). So instead, for testing I built the static library (libgeodesk.a) and linked it with thisCMakeFiles/geodesk-test.dir/link.txt(the difference is that all the libraries to be linked are now before: -o geodesk-test):
/usr/lib64/ccache/c++ "CMakeFiles/geodesk-test.dir/test/Features_test.cpp.o" "CMakeFiles/geodesk-test.dir/test/common/math/Decimal_test.cpp.o" "CMakeFiles/geodesk-test.dir/test/common/math/Math_test.cpp.o" "CMakeFiles/geodesk-test.dir/test/common/store/BTree_test.cpp.o" "CMakeFiles/geodesk-test.dir/test/common/store/FreeStore_test.cpp.o" "CMakeFiles/geodesk-test.dir/test/common/text/Format_test.cpp.o" "CMakeFiles/geodesk-test.dir/test/common/text/TextTemplate_test.cpp.o" "CMakeFiles/geodesk-test.dir/test/common/util/Crc32C_test.cpp.o" "CMakeFiles/geodesk-test.dir/test/geom/Geos_test.cpp.o" "CMakeFiles/geodesk-test.dir/test/geom/Tile_test.cpp.o" "CMakeFiles/geodesk-test.dir/test/match/MatcherCompiler_test.cpp.o" "CMakeFiles/geodesk-test.dir/test/test_concur.cpp.o" "CMakeFiles/geodesk-test.dir/test/test_main.cpp.o" libgeodesk.a /usr/local/lib64/libCatch2Main.a /usr/local/lib64/libCatch2.a -o geodesk-test
- I have also noticed diagonally, that during testing if it did not find a gol file it caused a segmentation fault. I will check further on that though.
EDIT after 2h:
7. There are some undefined symbols in the produced static library (libgeodesk.a). For example: nm -a libgeodesk.a | grep parseDouble says:
0000000000000000 T _ZN8clarisma4Math11parseDoubleEPKcmPd
00000000000004cc T _ZN8clarisma15SimpleXmlParser16parseDeclarationEv
0000000000000000 t .text._ZN8clarisma4Math11parseDoubleESt17basic_string_viewIcSt11char_traitsIcEEPd
U _ZN8clarisma4Math11parseDoubleEPKcmPd
0000000000000000 W _ZN8clarisma4Math11parseDoubleESt17basic_string_viewIcSt11char_traitsIcEEPd
Now there are two variants of clarisma::Math::parseDouble with 2 and 3 parameters. The 2-param is inlined in include/clarisma/math/Math.h. One of them seems undefined in libgeodesk.a and also tried with the static version.(errors below indicate that it can not find the 3-param variant of parseDouble).
Because of the above, this program does not compile, perhaps I am doing something wrong? Am I trying to use a private API? Because of the porting to Perl I need to get the tag's key and value to basic C strings (char *):
/////
// g++ -std=c++20 gol.cpp -I/usr/local/include -lgeodesk
/////
#include <geodesk/geodesk.h>
int main(void){
const char *golfilename = "france-latest.osm.gol";
const char *query = "n[place=city][population >= 100000]";
geodesk::Features fobj = geodesk::Features(golfilename);
geodesk::Nodes results = fobj.nodes(query);
for(geodesk::Feature result : results){
for(geodesk::Tag atag : result.tags()){
const char *k = atag.key().data();
const char *v = atag.value()+""; // trying the operator...
// ideally these should go to a Perl hash
// and then into a Perl array
}
}
return 0;
}
output of compilation via g++ -std=c++20 gol.cpp -I/usr/local/include -lgeodesk is:
/usr/bin/ld: /tmp/ccx5M5gM.o: in function `clarisma::Math::parseDouble(std::basic_string_view<char, std::char_traits<char> >, double*)':
gol.cpp:(.text._ZN8clarisma4Math11parseDoubleESt17basic_string_viewIcSt11char_traitsIcEEPd[_ZN8clarisma4Math11parseDoubleESt17basic_string_viewIcSt11char_traitsIcEEPd]+0x4f): undefined reference to `clarisma::Math::parseDouble(char const*, unsigned long, double*)'
/usr/bin/ld: /tmp/ccx5M5gM.o: in function `clarisma::Decimal::operator double() const':
gol.cpp:(.text._ZNK8clarisma7DecimalcvdEv[_ZNK8clarisma7DecimalcvdEv]+0x76): undefined reference to `clarisma::Math::POWERS_OF_10'
/usr/bin/ld: /tmp/ccx5M5gM.o: in function `geodesk::TagTablePtr::empty()':
gol.cpp:(.text._ZN7geodesk11TagTablePtr5emptyEv[_ZN7geodesk11TagTablePtr5emptyEv]+0xd): undefined reference to `geodesk::TagValues::EMPTY_TABLE_STRUCT'
collect2: error: ld returned 1 exit status
I am not sure if I am using the API correctly because when I compiled the gol-tool (after your latest changes) it compiled and worked OK.
P.S. For the last error (undefined symbols in the library) I tried compiling with gcc v14.3 and with clang 19.1.7 to the exact same effect.