服务器 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文件,竟然没有

接下来待续…

发布了97 篇原创文章 · 获赞 18 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/qq_32460819/article/details/100547734