![gfortran 编译 GILDAS 失败,对 libgio 的引用未定义](https://linux22.com/image/864743/gfortran%20%E7%BC%96%E8%AF%91%20GILDAS%20%E5%A4%B1%E8%B4%A5%EF%BC%8C%E5%AF%B9%20libgio%20%E7%9A%84%E5%BC%95%E7%94%A8%E6%9C%AA%E5%AE%9A%E4%B9%89.png)
我正在尝试编译软件包 GILDAS (http://www.iram.fr/IRAMFR/GILDAS/),在 make 检查时卡住了,出现错误,似乎是 libgio 库或软件包来源的问题。我联系了维护人员,以防这是代码中的错误,但我没有收到回复,我怀疑不是,因为已知它在 14.04 上编译成功 (http://vilhelmp.blogspot.co.uk/2012/11/installing-iram-gildas-on-ubuntu-1210.html)。
具体故障为:
gfortran built/x86_64-ubuntu14.04-gfortran/clean.o -o /home/richard/Gildas/gildas-src-jul14a/integ/x86_64-ubuntu14.04-gfortran/tasks/clean.exe -L/home/richard/Gildas/gildas-src-jul14a/integ/x86_64-ubuntu14.04-gfortran/lib -L/home/richard/Canopy/appdata/canopy-1.4.1.1975.rh5-x86_64/lib -lmaptasks -lmapping -lggui -lgcore -lgio -lgwcs -lgmath -lgsys -lginc -lslatec -llapack -lblas \
-lpython2.7 -lutil -lpng -lz -lrt -lpthread -lm -ldl
/usr/lib/x86_64-linux-gnu/libgio-2.0.so.0: undefined reference to `g_variant_dict_end'
/usr/lib/x86_64-linux-gnu/libgio-2.0.so.0: undefined reference to `g_variant_dict_new'
/usr/lib/x86_64-linux-gnu/libgio-2.0.so.0: undefined reference to `g_str_tokenize_and_fold'
/usr/lib/x86_64-linux-gnu/libgio-2.0.so.0: undefined reference to `g_option_context_parse_strv'
/usr/lib/x86_64-linux-gnu/libgio-2.0.so.0: undefined reference to `g_hash_table_get_keys_as_array'
/usr/lib/x86_64-linux-gnu/libgio-2.0.so.0: undefined reference to `g_variant_new_take_string'
/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0: undefined reference to `g_unix_fd_source_funcs'
/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0: undefined reference to `g_unix_signal_funcs'
/usr/lib/x86_64-linux-gnu/libgio-2.0.so.0: undefined reference to `g_variant_parse_error_quark'
/usr/lib/x86_64-linux-gnu/libgio-2.0.so.0: undefined reference to `g_variant_dict_insert_value'
/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0: undefined reference to `g_variant_dict_ref'
/usr/lib/x86_64-linux-gnu/libgio-2.0.so.0: undefined reference to `g_variant_dict_unref'
collect2: error: ld returned 1 exit status
make[3]: *** [/home/richard/Gildas/gildas-src-jul14a/integ/x86_64-ubuntu14.04-gfortran/tasks/clean.exe] Error 1
rm built/x86_64-ubuntu14.04-gfortran/clean.o built/x86_64-ubuntu14.04-gfortran/clean.f90
make[3]: Leaving directory `/home/richard/Gildas/gildas-src-jul14a/packages/map/tasks'
make[2]: *** [default] Error 1
make[2]: Leaving directory `/home/richard/Gildas/gildas-src-jul14a/packages/map'
make[1]: *** [default] Error 1
make[1]: Leaving directory `/home/richard/Gildas/gildas-src-jul14a/packages'
make: *** [default] Error 1
我已经安装了 libgio 并且位于该目录中:
richard@florianus:~/Gildas/gildas-src-jul14a$ ls -l /usr/lib/x86_64-linux-gnu/ |fgrep gio
drwxr-xr-x 3 root root 4096 Jul 22 23:02 gio
drwxr-xr-x 3 root root 4096 Oct 4 16:41 giomm-2.4
-rw-r--r-- 1 root root 3574336 Sep 25 18:56 libgio-2.0.a
lrwxrwxrwx 1 root root 22 Sep 25 18:56 libgio-2.0.so -> libgio-2.0.so.0.4002.0
lrwxrwxrwx 1 root root 22 Sep 25 18:56 libgio-2.0.so.0 -> libgio-2.0.so.0.4002.0
-rw-r--r-- 1 root root 1513096 Sep 25 18:56 libgio-2.0.so.0.4002.0
-rw-r--r-- 1 root root 3093530 Apr 8 2014 libgiomm-2.4.a
lrwxrwxrwx 1 root root 21 Apr 8 2014 libgiomm-2.4.so -> libgiomm-2.4.so.1.3.0
lrwxrwxrwx 1 root root 21 Oct 4 12:00 libgiomm-2.4.so.1 -> libgiomm-2.4.so.1.3.0
-rw-r--r-- 1 root root 1570304 Apr 8 2014 libgiomm-2.4.so.1.3.0
目前是 2.4 版本:
richard@florianus:~/Gildas/gildas-src-jul14a$ pkg-config --modversion glib-2.0
2.40.2
但是,我不能完全确定这些软件包是否真的正确链接,原因是:
richard@florianus:~/Gildas/gildas-src-jul14a$ ldd -v /usr/lib/x86_64-linux-gnu/libgio-2.0.so | fgrep glib
libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f2cdde38000)
/lib/x86_64-linux-gnu/libglib-2.0.so.0:
似乎指向了错误的位置?然而,在运行 make 之前将其包含在源代码中并不能解决问题;会返回相同的错误消息。
到目前为止,我还没有在这个操作系统上手动安装任何库:所有东西都是通过 apt-get 安装的,所以我很惊讶这是一个问题。任何有关这个问题的帮助都将不胜感激!祝一切顺利
答案1
在与维护人员一起解决了该问题之后,我发现问题似乎出在 Python 的 Canopy 发行版中,该发行版拥有自己某些库的版本,因此同一时间会使用同一个库的两个版本。
由于我不需要 CLASS 的 Python 绑定,因此使用以下选项运行源命令:
-n python
使一切都能够正确编译。