Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fails: relocation R_X86_64_32 against `.bss' can not be used when making a shared object #3

Open
shrx opened this issue May 15, 2017 · 1 comment

Comments

@shrx
Copy link
Contributor

shrx commented May 15, 2017

$ make avx
...
gfortran -lstdc++ -fopenmp -fPIC -B /usr/share/libhugetlbfs -Wl,--hugetlbfs-link=B -Wall -O3 -ffast-math -march=core2 -mavx adjust.o [...] cxvpred.o -o nbody6
ld.hugetlbfs: --hugetlbfs-link is deprecated. Migrate to --hugetlbfs-align.
/usr/bin/ld: gpuirr.o: relocation R_X86_64_32 against `.bss' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
/home/shrx/fortran/testi/Nbody6/GPU2/Makefile.build:152: recipe for target 'sse' failed
make[1]: *** [sse] Error 1
make[1]: Leaving directory '/home/shrx/fortran/testi/Nbody6/GPU2/Build'
Makefile:68: recipe for target 'avx' failed
make: *** [avx] Error 2

I tried modifying the relevant code in Makefile:

ifeq ($(avx), enable)
gpuirr.o: gpuirr.s
	$(CXX) -fPIC -c $^ -o $@

But it results in the same error.
Here is the full build log: https://gist.github.com/shrx/19f45946ccd938edf68280cc77b06cca

gfortran --version 
GNU Fortran (Ubuntu 6.3.0-12ubuntu2) 6.3.0 20170406
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
@lwang-astro
Copy link
Contributor

This issue is related to the SIMD library AVX and SSE.
First please check your computer enviroment. Whether your CPU support AVX and SSE.
The following steps help you to identify:

  1. in terminal shell:
    egrep avx /proc/cpuinfo
  2. if it return any lines. Thus means your CPU support AVX. You can use the same way to check SSE

IF the avx/sse are detected but the compiling still failed, then please check your gcc version by
gcc --version
if the gcc version is too low, the avx and sse may not be supported. The suggestion is to use version >= 4.4

If these cannot help, please let me know

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants