FileGDB:'make'对于样本失败(Ubuntu 15)

时间:2016-01-20 18:05:24

标签: ubuntu makefile

我现在已经搜索了一段时间如何编译te FileGDB示例(我假设当我解决这个问题时,我将能够使用FileGDB支持编译GDAL。它编译好没有。)。我之前在Debian 7上做过,并将笔记与几个网站进行了比较。我使用c:\​​ temp下载并解压缩,然后将其复制到/ usr / local / FileGDB_API

以下是我遵循的步骤(x64): http://hydrogeotools.blogspot.be/2013/07/install-gdal-with-file-gdb-and.html

从esri下载filegdb api,确保为64位机器等选择64位,在〜/ src /中解压缩并通过将文件复制到更相关的位置来“安装”

sudo cp -r ~/src/FileGDB_API /usr/local/

然后打开/etc/ld.so.conf

来修复链接
sudo gedit /etc/ld.so.conf

并将以下行放入文件中 在/ usr /本地/ FileGDB_API / lib目录  保存并关闭文件,然后更新链接

sudo ldconfig

测试它

cd ~/src/FileGDB_API/samples
make
cd ~/src/FileGDB_API/samples/bin
./Querying

但是当我运行make时,我明白了:

make -C Domains
make[1]: Entering directory '/usr/local/FileGDB_API/samples/Domains'
g++ -fPIC -O3 -m64 -W -fexceptions -D_CONSOLE -DUNICODE -D_UNICODE -DUNIX -D_REENTRANT -DFILEGDB_API -D__USE_FILE_OFFSET64 -DUNIX_FILEGDB_API -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I../../include -I.  -c Domains.cpp
g++ -fPIC -O3 -m64 -W -fexceptions -D_CONSOLE -DUNICODE -D_UNICODE -DUNIX -D_REENTRANT -DFILEGDB_API -D__USE_FILE_OFFSET64 -DUNIX_FILEGDB_API -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I../../include -I. -m64 -L"../../lib" -o ../bin/Domains ./Domains.o -lFileGDBAPI
./Domains.o: In function `main':
Domains.cpp:(.text.startup+0x8e): undefined reference to `FileGDBAPI::OpenGeodatabase(std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&, FileGDBAPI::Geodatabase&)'
Domains.cpp:(.text.startup+0xe7): undefined reference to `FileGDBAPI::ErrorInfo::GetErrorDescription(int, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >&)'
Domains.cpp:(.text.startup+0x1af): undefined reference to `FileGDBAPI::Geodatabase::DeleteDomain(std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&)'
Domains.cpp:(.text.startup+0x247): undefined reference to `FileGDBAPI::Geodatabase::DeleteDomain(std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&)'
Domains.cpp:(.text.startup+0x553): undefined reference to `FileGDBAPI::Geodatabase::CreateDomain(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
Domains.cpp:(.text.startup+0x58f): undefined reference to `FileGDBAPI::ErrorInfo::GetErrorDescription(int, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >&)'
Domains.cpp:(.text.startup+0x6a4): undefined reference to `FileGDBAPI::Geodatabase::GetDomainDefinition(std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) const'
Domains.cpp:(.text.startup+0x6f8): undefined reference to `FileGDBAPI::ErrorInfo::GetErrorDescription(int, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >&)'
Domains.cpp:(.text.startup+0x98e): undefined reference to `FileGDBAPI::Geodatabase::CreateDomain(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
Domains.cpp:(.text.startup+0x9ca): undefined reference to `FileGDBAPI::ErrorInfo::GetErrorDescription(int, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >&)'
Domains.cpp:(.text.startup+0xba7): undefined reference to `FileGDBAPI::Geodatabase::AlterDomain(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
Domains.cpp:(.text.startup+0xbe0): undefined reference to `FileGDBAPI::ErrorInfo::GetErrorDescription(int, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >&)'
Domains.cpp:(.text.startup+0xd09): undefined reference to `FileGDBAPI::Geodatabase::OpenTable(std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&, FileGDBAPI::Table&)'
Domains.cpp:(.text.startup+0xd60): undefined reference to `FileGDBAPI::ErrorInfo::GetErrorDescription(int, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >&)'
Domains.cpp:(.text.startup+0xee2): undefined reference to `FileGDBAPI::Table::AlterField(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
Domains.cpp:(.text.startup+0xf1b): undefined reference to `FileGDBAPI::ErrorInfo::GetErrorDescription(int, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >&)'
Domains.cpp:(.text.startup+0xf9b): undefined reference to `FileGDBAPI::ErrorInfo::GetErrorRecord(int, int&, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >&)'
Domains.cpp:(.text.startup+0x1144): undefined reference to `FileGDBAPI::Table::AlterField(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
Domains.cpp:(.text.startup+0x117d): undefined reference to `FileGDBAPI::ErrorInfo::GetErrorDescription(int, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >&)'
Domains.cpp:(.text.startup+0x11fd): undefined reference to `FileGDBAPI::ErrorInfo::GetErrorRecord(int, int&, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >&)'
Domains.cpp:(.text.startup+0x1314): undefined reference to `FileGDBAPI::ErrorInfo::GetErrorDescription(int, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >&)'
collect2: error: ld returned 1 exit status
Makefile:33: recipe for target '../bin/Domains' failed
make[1]: *** [../bin/Domains] Error 1
make[1]: Leaving directory '/usr/local/FileGDB_API/samples/Domains'
Makefile:26: recipe for target 'Domains' failed
make: *** [Domains] Error 2

这可能是一个更普遍的错误,我对Linux并不熟悉,但我会喜欢一些帮助/指针。

3 个答案:

答案 0 :(得分:2)

我在Ubuntu 15上遇到了与FileGDB_API 1.3和1.4 64位相同的问题。

我找到了一个解决方案:我必须使用g ++ - 4.8编译GDAL,而不是使用g ++ - 5.2.1编译,它在我的ubuntu 15上作为标准编译器安装

sudo apt-get install g++-4.8
export CXX=g++-4.8
cd FileGDB_API_1_4/samples
make clean
make
cd gdal-2
make clean
make
sudo make install

答案 1 :(得分:0)

我找到了一种替代方法,它不需要回退到较旧的编译器。在D_GLIBCXX_USE_CXX11_ABI的makefile中设置gdal/gdal/ogr/ogrsf_frmts/filegdb/GNUmakefile c ++编译器标志允许g ++使用用旧版本的g ++构建的fgdb库:

CXXFLAGS := -D_GLIBCXX_USE_CXX11_ABI=0

所以在我的GNUmake文件中,前几行是:

include ../../../GDALmake.opt

OBJ =   FGdbDatasource.o FGdbDriver.o FGdbLayer.o FGdbUtils.o FGdbResultLayer.o

CPPFLAGS    :=  -I../generic  $(FGDB_INC) $(CPPFLAGS)
CXXFLAGS := -D_GLIBCXX_USE_CXX11_ABI=0  // <---------------------------- I added this line

default:    $(O_OBJ:.o=.$(OBJ_EXT))

发现了一些参考信息here,而且关键是here

更新:虽然看起来编译没有问题,但是在构建之后从gdal运行自动测试模块会导致fgdb测试发生灾难性故障(特别是在调用fgdb_driver.CreateDatasource(path)时)。用g ++ - 4.8重新编译是一个有效的解决方案。

答案 2 :(得分:0)

在此期间,ESRI已更新了他们的文件。 https://github.com/Esri/file-geodatabase-api/blob/master/FileGDB_API_1.5.1/FileGDB_API_1_5_1-64gcc51.tar.gz专用于g ++ / gcc 5.1及更高版本。

有了这个,FileGDB API会使用默认的编译器版本在Ubuntu 16.04和18.04上正确编译。

另请参阅https://gis.stackexchange.com/questions/292506/how-do-i-install-esri-file-gdb-api-in-ubuntu-16-04-so-qgis-2-8-can-see-it