0

I am trying to compile nvcc that works on other machines and clusters, now that im running x86-64 machine I was getting errors for relocation R_X86_64_32 against ... diffrent lib files and errors. placing --compiler-options after the concerning libraries that flagged the errors. adding -fPIC after causes the error to return. So I am very confused.

The command(easy to read):

nvcc -o exe/prog src/main.cu -gencode=arch=compute_20,code=sm_20 -gencode=arch=compute_30,code=sm_30 -gencode arch=compute_37,code=sm_37 -gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_52,code=sm_52 -gencode=arch=compute_52,code=compute_52 -L/home/mohamed/PhD/VENV/lib -L/home/mohamed/PhD/VENV/glew-1.10.0/lib -llua -lGLEW -lglfw3 -lcuda -lGLU -ljpeg -lGL -lGLU -lglfw3 --compiler-options -lX11 -lXxf86vm -lXrandr -lpthread -lXi -I ./code_generator_lua/utils/ -I/home/mohamed/PhD/VENV/include/GLFW -I/home/mohamed/PhD/VENV/glew-1.10.0/include -I ./utils2/visualisation -D WITH_OPENGL -I ./geo -I/home/mohamed/PhD/VENV/lua-5.1.5/src -I/home/mohamed/PhD/VENV/boost_1_61_0 -I/usr/local/cuda-7.5/samples/common/inc

Here is my compile command line output(terminal) (please ignore the warnings-they are normal):

nvcc -o exe/prog src/main.cu -gencode=arch=compute_20,code=sm_20 -gencode=arch=compute_30,code=sm_30 -gencode arch=compute_37,code=sm_37 -gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_52,code=sm_52 -gencode=arch=compute_52,code=compute_52 -L/home/mohamed/PhD/VENV/lib -L/home/mohamed/PhD/VENV/glew-1.10.0/lib -llua -lGLEW -lglfw3 -lcuda -lGLU -ljpeg -lGL -lGLU -lglfw3 --compiler-options -lX11 -lXxf86vm -lXrandr -lpthread -lXi -I ./code_generator_lua/utils/ -I/home/mohamed/PhD/VENV/include/GLFW -I/home/mohamed/PhD/VENV/glew-1.10.0/include -I ./utils2/visualisation -D WITH_OPENGL -I ./geo -I/home/mohamed/PhD/VENV/lua-5.1.5/src -I/home/mohamed/PhD/VENV/boost_1_61_0 -I/usr/local/cuda-7.5/samples/common/inc

/home/mohamed/PhD/VENV/boost_1_61_0/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp(75): warning: variable "tmp" was set but never used

src/main.cu(364): warning: variable "fname2" was declared but never referenced

src/main.cu(392): warning: conversion from a string literal to "char *" is deprecated

/home/mohamed/PhD/VENV/boost_1_61_0/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp(75): warning: variable "tmp" was set but never used

src/main.cu(364): warning: variable "fname2" was declared but never referenced

src/main.cu(392): warning: conversion from a string literal to "char *" is deprecated

/home/mohamed/PhD/VENV/boost_1_61_0/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp(75): warning: variable "tmp" was set but never used

src/main.cu(364): warning: variable "fname2" was declared but never referenced

src/main.cu(392): warning: conversion from a string literal to "char *" is deprecated

/home/mohamed/PhD/VENV/boost_1_61_0/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp(75): warning: variable "tmp" was set but never used

src/main.cu(364): warning: variable "fname2" was declared but never referenced

src/main.cu(392): warning: conversion from a string literal to "char *" is deprecated

/home/mohamed/PhD/VENV/boost_1_61_0/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp(75): warning: variable "tmp" was set but never used

src/main.cu(364): warning: variable "fname2" was declared but never referenced

src/main.cu(392): warning: conversion from a string literal to "char *" is deprecated

/home/mohamed/PhD/VENV/boost_1_61_0/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp(75): warning: variable "tmp" was set but never used

src/main.cu(364): warning: variable "fname2" was declared but never referenced

src/main.cu(392): warning: conversion from a string literal to "char *" is deprecated

/home/mohamed/PhD/VENV/boost_1_61_0/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp(75): warning: variable "tmp" was set but never used

src/main.cu(364): warning: variable "fname2" was declared but never referenced

src/main.cu(392): warning: conversion from a string literal to "char *" is deprecated

/home/mohamed/PhD/VENV/boost_1_61_0/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp(75): warning: variable "tmp" was set but never used

src/main.cu(364): warning: variable "fname2" was declared but never referenced

src/main.cu(392): warning: conversion from a string literal to "char *" is deprecated

/home/mohamed/PhD/VENV/boost_1_61_0/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp(75): warning: variable "tmp" was set but never used

src/main.cu(364): warning: variable "fname2" was declared but never referenced

src/main.cu(392): warning: conversion from a string literal to "char *" is deprecated

/home/mohamed/PhD/VENV/boost_1_61_0/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp(75): warning: variable "tmp" was set but never used

src/main.cu(364): warning: variable "fname2" was declared but never referenced

src/main.cu(392): warning: conversion from a string literal to "char *" is deprecated

/usr/bin/ld: /home/mohamed/PhD/VENV/lib/libglfw3.a(x11_clipboard.c.o): undefined reference to symbol 'XConvertSelection'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libX11.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

Malieh
  • 1
  • 4
  • https://stackoverflow.com/q/28531014/681865 – talonmies Feb 25 '20 at 13:24
  • adding I have tried what was on that page it resulted in no compile. or I do not know how to flag `pkg-config --static --libs` throwing errors "unknown command -static" when removing it results in "unkown command -libs" @talonmies – Malieh Feb 25 '20 at 13:46
  • how would I try to add pkg-config? I am starting to get desperate. – Malieh Feb 25 '20 at 14:30

1 Answers1

0

I have fixed the problem for all those who are using new systems, and running older codes. It was actually an issue with relocation R_X86_64_32 ... error due to static and dynamic libraries. Now the resolution for this can be found by either running gcc in my case nvcc with no-pie flag if you are using a gcc and g++ version <4.8. Also to make sure that even gcc 4.8 that pie was not enabled by default. You can check enabled defaults by checking the version gcc -v.

Malieh
  • 1
  • 4
  • You can use `-fno-pie` to let GCC make more efficient code (e.g. for indexing static arrays) when it knows the object file doesn't have to be linked into a PIE. (And yes, most modern distros configure GCC to make PIEs by default, so the default is `-fPIE -pie`). [32-bit absolute addresses no longer allowed in x86-64 Linux?](https://stackoverflow.com/q/43367427) – Peter Cordes Mar 09 '20 at 22:10
  • @PeterCordes thanks, very useful information, especially to those who recently migrated to a newer system and do not have a comprehensive Linux and gcc knowledge like myself. – Malieh Mar 16 '20 at 11:36