Conda安装的gfortran和gcc无法编译可执行文件

问题描述 投票:0回答:1

在Linux 64上,创建环境后,我用

conda install conda-forge::gfortran
安装了gfortran。我看到它安装了 gfortran 14 和 gcc 14。然后我用
conda install openmpi
安装了 openmpi,它安装了 mpi-1.0。

which mpirun
which mpicc
这样的命令给出位置 /bin/mpirun 和 /bin/mpicc。我觉得很正常。

但是当尝试配置FFTW时,它无法编译可执行文件。我使用了以下示例 c 代码:

#include <stdio.h>
int main() {   
    int number;
   
    printf("Enter an integer: ");  
    
    // reads and stores input
    scanf("%d", &number);

    // displays output
    printf("You entered: %d", number);
    
    return 0;
}

并尝试自己用

mpicc printInteger.c
编译一些东西,它给出了以下输出:

/home/zhangxifen/miniconda3/envs/f2018/bin/../lib/gcc/x86_64-conda-linux-gnu/13.3.0/../../../../x86_64-conda-linux-gnu/bin/ld: warning: libstdc++.so.6, needed by /home/zhangxifen/miniconda3/envs/f2018/lib/./././libicuuc.so.73, not found (try using -rpath or -rpath-link)
/home/zhangxifen/miniconda3/envs/f2018/bin/../lib/gcc/x86_64-conda-linux-gnu/13.3.0/../../../../x86_64-conda-linux-gnu/bin/ld: /home/zhangxifen/miniconda3/envs/f2018/lib/./././libicuuc.so.73: undefined reference to `__cxa_throw_bad_array_new_length@CXXABI_1.3.8'
/home/zhangxifen/miniconda3/envs/f2018/bin/../lib/gcc/x86_64-conda-linux-gnu/13.3.0/../../../../x86_64-conda-linux-gnu/bin/ld: /home/zhangxifen/miniconda3/envs/f2018/lib/./././libicuuc.so.73: undefined reference to `std::condition_variable::condition_variable()@GLIBCXX_3.4.11'
/home/zhangxifen/miniconda3/envs/f2018/bin/../lib/gcc/x86_64-conda-linux-gnu/13.3.0/../../../../x86_64-conda-linux-gnu/bin/ld: /home/zhangxifen/miniconda3/envs/f2018/lib/./././libicuuc.so.73: undefined reference to `std::__throw_system_error(int)@GLIBCXX_3.4.11'
/home/zhangxifen/miniconda3/envs/f2018/bin/../lib/gcc/x86_64-conda-linux-gnu/13.3.0/../../../../x86_64-conda-linux-gnu/bin/ld: /home/zhangxifen/miniconda3/envs/f2018/lib/./././libicuuc.so.73: undefined reference to `std::condition_variable::~condition_variable()@GLIBCXX_3.4.11'
/home/zhangxifen/miniconda3/envs/f2018/bin/../lib/gcc/x86_64-conda-linux-gnu/13.3.0/../../../../x86_64-conda-linux-gnu/bin/ld: /home/zhangxifen/miniconda3/envs/f2018/lib/./././libicuuc.so.73: undefined reference to `std::condition_variable::notify_all()@GLIBCXX_3.4.11'
/home/zhangxifen/miniconda3/envs/f2018/bin/../lib/gcc/x86_64-conda-linux-gnu/13.3.0/../../../../x86_64-conda-linux-gnu/bin/ld: /home/zhangxifen/miniconda3/envs/f2018/lib/./././libicuuc.so.73: undefined reference to `vtable for __cxxabiv1::__class_type_info@CXXABI_1.3'
/home/zhangxifen/miniconda3/envs/f2018/bin/../lib/gcc/x86_64-conda-linux-gnu/13.3.0/../../../../x86_64-conda-linux-gnu/bin/ld: /home/zhangxifen/miniconda3/envs/f2018/lib/./././libicuuc.so.73: undefined reference to `std::__once_call@GLIBCXX_3.4.11'
/home/zhangxifen/miniconda3/envs/f2018/bin/../lib/gcc/x86_64-conda-linux-gnu/13.3.0/../../../../x86_64-conda-linux-gnu/bin/ld: /home/zhangxifen/miniconda3/envs/f2018/lib/./././libicuuc.so.73: undefined reference to `std::condition_variable::wait(std::unique_lock<std::mutex>&)@GLIBCXX_3.4.11'
/home/zhangxifen/miniconda3/envs/f2018/bin/../lib/gcc/x86_64-conda-linux-gnu/13.3.0/../../../../x86_64-conda-linux-gnu/bin/ld: /home/zhangxifen/miniconda3/envs/f2018/lib/./././libicuuc.so.73: undefined reference to `std::__once_callable@GLIBCXX_3.4.11'
/home/zhangxifen/miniconda3/envs/f2018/bin/../lib/gcc/x86_64-conda-linux-gnu/13.3.0/../../../../x86_64-conda-linux-gnu/bin/ld: /home/zhangxifen/miniconda3/envs/f2018/lib/./././libicuuc.so.73: undefined reference to `__once_proxy@GLIBCXX_3.4.11'
/home/zhangxifen/miniconda3/envs/f2018/bin/../lib/gcc/x86_64-conda-linux-gnu/13.3.0/../../../../x86_64-conda-linux-gnu/bin/ld: /home/zhangxifen/miniconda3/envs/f2018/lib/./././libicuuc.so.73: undefined reference to `__gxx_personality_v0@CXXABI_1.3'
/home/zhangxifen/miniconda3/envs/f2018/bin/../lib/gcc/x86_64-conda-linux-gnu/13.3.0/../../../../x86_64-conda-linux-gnu/bin/ld: /home/zhangxifen/miniconda3/envs/f2018/lib/./././libicuuc.so.73: undefined reference to `__dynamic_cast@CXXABI_1.3'
/home/zhangxifen/miniconda3/envs/f2018/bin/../lib/gcc/x86_64-conda-linux-gnu/13.3.0/../../../../x86_64-conda-linux-gnu/bin/ld: /home/zhangxifen/miniconda3/envs/f2018/lib/./././libicuuc.so.73: undefined reference to `vtable for __cxxabiv1::__si_class_type_info@CXXABI_1.3'
/home/zhangxifen/miniconda3/envs/f2018/bin/../lib/gcc/x86_64-conda-linux-gnu/13.3.0/../../../../x86_64-conda-linux-gnu/bin/ld: /home/zhangxifen/miniconda3/envs/f2018/lib/./././libicuuc.so.73: undefined reference to `vtable for __cxxabiv1::__vmi_class_type_info@CXXABI_1.3'
/home/zhangxifen/miniconda3/envs/f2018/bin/../lib/gcc/x86_64-conda-linux-gnu/13.3.0/../../../../x86_64-conda-linux-gnu/bin/ld: /home/zhangxifen/miniconda3/envs/f2018/lib/./././libicuuc.so.73: undefined reference to `operator delete(void*, unsigned long)@CXXABI_1.3.9'
collect2: error: ld returned 1 exit status

尝试编译测试 C 代码时,fftw 的 config.log 有类似的消息:

configure:4496: mpicc    conftest.c  >&5
/home/zhangxifen/miniconda3/envs/f2018/bin/../lib/gcc/x86_64-conda-linux-gnu/14.1.0/../../../../x86_64-conda-linux-gnu/bin/ld: warning: libstdc++.so.6, needed by /home/zhangxifen/miniconda3/envs/f2018/lib/./././libicuuc.so.73, not found (try using -rpath or -rpath-link)
/home/zhangxifen/miniconda3/envs/f2018/bin/../lib/gcc/x86_64-conda-linux-gnu/14.1.0/../../../../x86_64-conda-linux-gnu/bin/ld: /home/zhangxifen/miniconda3/envs/f2018/lib/./././libicuuc.so.73: undefined reference to `__cxa_throw_bad_array_new_length@CXXABI_1.3.8'
/home/zhangxifen/miniconda3/envs/f2018/bin/../lib/gcc/x86_64-conda-linux-gnu/14.1.0/../../../../x86_64-conda-linux-gnu/bin/ld: /home/zhangxifen/miniconda3/envs/f2018/lib/./././libicuuc.so.73: undefined reference to `std::condition_variable::condition_variable()@GLIBCXX_3.4.11'
/home/zhangxifen/miniconda3/envs/f2018/bin/../lib/gcc/x86_64-conda-linux-gnu/14.1.0/../../../../x86_64-conda-linux-gnu/bin/ld: /home/zhangxifen/miniconda3/envs/f2018/lib/./././libicuuc.so.73: undefined reference to `std::__throw_system_error(int)@GLIBCXX_3.4.11'
/home/zhangxifen/miniconda3/envs/f2018/bin/../lib/gcc/x86_64-conda-linux-gnu/14.1.0/../../../../x86_64-conda-linux-gnu/bin/ld: /home/zhangxifen/miniconda3/envs/f2018/lib/./././libicuuc.so.73: undefined reference to `std::condition_variable::~condition_variable()@GLIBCXX_3.4.11'
/home/zhangxifen/miniconda3/envs/f2018/bin/../lib/gcc/x86_64-conda-linux-gnu/14.1.0/../../../../x86_64-conda-linux-gnu/bin/ld: /home/zhangxifen/miniconda3/envs/f2018/lib/./././libicuuc.so.73: undefined reference to `std::condition_variable::notify_all()@GLIBCXX_3.4.11'
/home/zhangxifen/miniconda3/envs/f2018/bin/../lib/gcc/x86_64-conda-linux-gnu/14.1.0/../../../../x86_64-conda-linux-gnu/bin/ld: /home/zhangxifen/miniconda3/envs/f2018/lib/./././libicuuc.so.73: undefined reference to `vtable for __cxxabiv1::__class_type_info@CXXABI_1.3'
/home/zhangxifen/miniconda3/envs/f2018/bin/../lib/gcc/x86_64-conda-linux-gnu/14.1.0/../../../../x86_64-conda-linux-gnu/bin/ld: /home/zhangxifen/miniconda3/envs/f2018/lib/./././libicuuc.so.73: undefined reference to `std::__once_call@GLIBCXX_3.4.11'
/home/zhangxifen/miniconda3/envs/f2018/bin/../lib/gcc/x86_64-conda-linux-gnu/14.1.0/../../../../x86_64-conda-linux-gnu/bin/ld: /home/zhangxifen/miniconda3/envs/f2018/lib/./././libicuuc.so.73: undefined reference to `std::condition_variable::wait(std::unique_lock<std::mutex>&)@GLIBCXX_3.4.11'
/home/zhangxifen/miniconda3/envs/f2018/bin/../lib/gcc/x86_64-conda-linux-gnu/14.1.0/../../../../x86_64-conda-linux-gnu/bin/ld: /home/zhangxifen/miniconda3/envs/f2018/lib/./././libicuuc.so.73: undefined reference to `std::__once_callable@GLIBCXX_3.4.11'
/home/zhangxifen/miniconda3/envs/f2018/bin/../lib/gcc/x86_64-conda-linux-gnu/14.1.0/../../../../x86_64-conda-linux-gnu/bin/ld: /home/zhangxifen/miniconda3/envs/f2018/lib/./././libicuuc.so.73: undefined reference to `__once_proxy@GLIBCXX_3.4.11'
/home/zhangxifen/miniconda3/envs/f2018/bin/../lib/gcc/x86_64-conda-linux-gnu/14.1.0/../../../../x86_64-conda-linux-gnu/bin/ld: /home/zhangxifen/miniconda3/envs/f2018/lib/./././libicuuc.so.73: undefined reference to `__gxx_personality_v0@CXXABI_1.3'
/home/zhangxifen/miniconda3/envs/f2018/bin/../lib/gcc/x86_64-conda-linux-gnu/14.1.0/../../../../x86_64-conda-linux-gnu/bin/ld: /home/zhangxifen/miniconda3/envs/f2018/lib/./././libicuuc.so.73: undefined reference to `__dynamic_cast@CXXABI_1.3'
/home/zhangxifen/miniconda3/envs/f2018/bin/../lib/gcc/x86_64-conda-linux-gnu/14.1.0/../../../../x86_64-conda-linux-gnu/bin/ld: /home/zhangxifen/miniconda3/envs/f2018/lib/./././libicuuc.so.73: undefined reference to `vtable for __cxxabiv1::__si_class_type_info@CXXABI_1.3'
/home/zhangxifen/miniconda3/envs/f2018/bin/../lib/gcc/x86_64-conda-linux-gnu/14.1.0/../../../../x86_64-conda-linux-gnu/bin/ld: /home/zhangxifen/miniconda3/envs/f2018/lib/./././libicuuc.so.73: undefined reference to `vtable for __cxxabiv1::__vmi_class_type_info@CXXABI_1.3'
/home/zhangxifen/miniconda3/envs/f2018/bin/../lib/gcc/x86_64-conda-linux-gnu/14.1.0/../../../../x86_64-conda-linux-gnu/bin/ld: /home/zhangxifen/miniconda3/envs/f2018/lib/./././libicuuc.so.73: undefined reference to `operator delete(void*, unsigned long)@CXXABI_1.3.9'

在这里阅读了一些帖子,我尝试使用

conda install conda-forge::compilers
安装一组不同的编译器,它安装了 gfortran 和 gcc 的版本 13,我可以验证版本 13 当前处于活动状态,但 mpicc 编译仍然失败。

还有什么我可以尝试的吗?我是否安装了错误版本的 gfortran/gcc 来使用 openmpi?

gcc conda mpi executable fftw
1个回答
0
投票

问题是 gfortran 和 gcc 版本 14 不兼容或与 FFTW 3.3.10 不兼容。将两者降级到版本 12.1.0 效果很好。

© www.soinside.com 2019 - 2024. All rights reserved.