编译时出错

时间:2014-02-20 02:02:24

标签: c++ linux gcc

我从Data Prefetching Championship网站(http://www.jilp.org/dpc/)下载了一个软件框架,并安装在64位Ubuntu OS的计算机上。我按照所有说明解压缩压缩文件,然后输入" 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文件。帮助

2 个答案:

答案 0 :(得分:2)

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

答案 1 :(得分:0)

我也面临同样的问题,但是我能够用科学的linux 5.4 解决它与 gcc 4.1 的配置,当我们必须设置路径时我犯了一个错误直到预取工具包。在为PREF_KIT设置路径时我们必须删除'$'符号