最近做个项目需要RSA,便调用了tommath,平时开发环境都在32位的系统上,编译运行一切都没问题,但当把程序换到一台64位系统上编译时出现:

/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/libtommath.a(bn_mp_init.o): relocation R_X86_64_32 against `a local symbol’ can not be used when making a shared object; recompile with -fPIC/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/libtommath.a: could not read symbols: Bad value

看来在64位系统编译libtommath时需要加-fPIC,于是修改makefile在CFLAGS里追加上-fPIC,重新编译libtommath后安装,此时再编译自己的程序,问题解决!

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-09-01
  • 2022-01-01
  • 2022-01-10
  • 2022-12-23
  • 2021-08-27
猜你喜欢
  • 2021-07-17
  • 2021-06-28
  • 2021-11-16
  • 2021-11-06
  • 2022-12-23
  • 2021-11-22
  • 2022-01-11
相关资源
相似解决方案