Skip to content

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

@shrx

Description

@shrx
$ 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions