Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 编译时出错_C++_Linux_Gcc - Fatal编程技术网

C++ 编译时出错

C++ 编译时出错,c++,linux,gcc,C++,Linux,Gcc,我从数据预取锦标赛网站()下载了一个软件框架,并安装在一台带有64位Ubuntu操作系统的计算机上。我按照解包压缩文件的所有说明,输入“make”命令进行编译,这就是我收到的: g++ -Wl,-u,main -g -shared -Wl,-Bsymbolic -Wl,--version-script=/grads/hhoffman/Documents/ELE_591/PREF_KIT/pin-2.5-22247-gcc.4.0.0-ia32_intel64-linux/source/inclu

我从数据预取锦标赛网站()下载了一个软件框架,并安装在一台带有64位Ubuntu操作系统的计算机上。我按照解包压缩文件的所有说明,输入“make”命令进行编译,这就是我收到的:

g++ -Wl,-u,main -g -shared -Wl,-Bsymbolic -Wl,--version-script=/grads/hhoffman/Documents/ELE_591/PREF_KIT/pin-2.5-22247-gcc.4.0.0-ia32_intel64-linux/source/include/pintool.ver -L/grads/hhoffman/Documents/ELE_591/PREF_KIT/pin-2.5-22247-gcc.4.0.0-ia32_intel64-linux/Lib/ -L/grads/hhoffman/Documents/ELE_591/PREF_KIT/pin-2.5-22247-gcc.4.0.0-ia32_intel64-linux/ExtLib/ -L/grads/hhoffman/Documents/ELE_591/PREF_KIT/pin-2.5-22247-gcc.4.0.0-ia32_intel64-linux/extras/xed2-intel64/lib -L/grads/hhoffman/Documents/ELE_591/PREF_KIT/pin-2.5-22247-gcc.4.0.0-ia32_intel64-linux/intel64/lib -L/grads/hhoffman/Documents/ELE_591/PREF_KIT/pin-2.5-22247-gcc.4.0.0-ia32_intel64-linux/intel64/lib-ext  -o bin/CMPsim.usetrace ./bin/libCMPsim64.a ./src/prefetch/sample_prefetcher.o -lpin  -lxed -ldwarf -lelf -ldl  /usr/lib/x86_64-linux-gnu/libz.a
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libz.a(gzio.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/lib/x86_64-linux-gnu/libz.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make: *** [CMPsimpref64] Error 1

我相信问题在于libz.a文件。帮助?

我不知道您是如何编译此应用程序的,但您应该将
-fPIC
添加到C/C++文件的编译标志(CFLAGS和CXXFLAGS)中,然后重新编译该应用程序

我也遇到了上面提到的同样的问题,但我能够用scientific linux 5.4gcc 4.1配置来解决它,而且我在设置预取工具包的路径时犯了一个错误。设置PREF_KIT路径时,有一个“$”标志,我们必须将其删除。

您是否尝试过与竞赛负责人联系?我相信他们以前会看到这一点,并有具体的指示,尽管你可能必须明确要求他们。除此之外,错误消息会明确告诉您在构建库时需要添加哪些标志,以使其在您的环境中可链接——或者您可以尝试询问库的源代码并在本地构建库,这将增加您拥有一个与您自己的代码愉快链接的版本的几率。为什么您要通过
libz.a
的直接路径?用
-lz
代替
/usr/lib/x86_64-linux-gnu/libz.a
怎么样?