服务器 make总是出错 待解决...

最近有个论文代码框架需要在服务器上实现,代码框架大神已经写好,只需要make编译就能build好,但是
现在的问题就是make总是失败,已经搞了几天,还是没有解决,这里先记录一下开端,结尾后面慢慢来
但是这个问题,是一定要解决的

总是Errno.cpp:
undefined reference to `std::各种函数

Errno.cpp:(.text._ZN4llvm3sys8StrErrorB5cxx11Ei+0x51): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_replace(unsigned long, unsigned long, char const*, unsigned long)'
clang-3.9: 
error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [utils/prepare-builtins] Error 1
make[2]: Leaving directory `/export/******/code/build/clgen/native/libclc/d0f8ca7247ded04afbf1561fc5823c3e3517d892'
make[1]: *** [/export/******/code/build/clgen/native/libclc/d0f8ca7247ded04afbf1561fc5823c3e3517d892/utils/prepare-builtins.o] Error 2
make[1]: Leaving directory `/export/******/code/build/clgen'
make: *** [/export/******/code/build/deeptune/bin/clgen] Error 2

std:: 一看应该是C++或者C语言的错误或者编译器GCC的问题,
因此编写了一个C++作为测试程序.

  1 #include <iostream>
  2 #include <string.h>
  3 using namespace std;
  4 int main(){
  5         cout<<"hello"<<endl;
  6         return 0;
 7 }

只见,我使用gcc main.cpp -o main
竟然失败了,
哎呀不对,应该是 g++ main.cpp -o main
运行成功

但是注意,这里使用gcc编译的时候出现的问题

(zjq) [xxx@localhost test1]$ gcc main.cpp -o main
/tmp/cc7xkpkR.o: In function `main':
main.cpp:(.text+0xa): undefined reference to `std::cout'
main.cpp:(.text+0xf): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
main.cpp:(.text+0x14): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)'
main.cpp:(.text+0x1c): undefined reference to `std::ostream::operator<<(std::ostream& (*)(std::ostream&))'
/tmp/cc7xkpkR.o: In function `__static_initialization_and_destruction_0(int, int)':
main.cpp:(.text+0x4a): undefined reference to `std::ios_base::Init::Init()'
main.cpp:(.text+0x59): undefined reference to `std::ios_base::Init::~Init()'
collect2: error: ld returned 1 exit status
(zjq) [xxx@localhost test1]$ ls

错误竟然跟make出错的样子很像,
这样就很显然,排除了GCC的问题了,人家可以编译运行gcc程序

那么下面应该是应该验证是运行脚本中调用的gcc与g++应该是使用错了吧,这里很怀疑大神应该不会出现这样的错误吧
因此找到了Makefile文件,查找关键字gcc/g++ 竟然没有
查找config文件,竟然没有

接下来待续…

解决方案:

根据出现的问题定位到了gcc/g++错误,于是查看版本问题, 确定了是版本问题后, 或是升级或者是降级, 要么就是卸载重装基本就可以解决上面的问题

涉及到make编译也可能是因为cmake版本或者没有安装, 依然是重新安装或者版本变化, 总之最后一定要保证软件可用没有问题

最后涉及到c/C++也可以考虑LLVM的前端clang

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

落子无悔!

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值