CMake IA64 FPIC problem

From KitwarePublic
Revision as of 21:04, 20 April 2018 by Brad.king (talk | contribs) (Remove leading space rectangles from preformatted blocks)
Jump to navigationJump to search

bar.c:

int i = 0;
void bar()
 {
 i = 5;
 }

foo.c:

extern void bar();
void foo()
  {
  bar();
  }

Compiled with

rm -f libbar.a *.o
gcc -c bar.c
ar cr libbar.a bar.o
gcc -c foo.c
gcc -shared -o libfoo.so foo.o -L. -lbar

Will fail:

/usr/bin/ld: bar.o: @gprel relocation against dynamic symbol i collect2: ld returned 1 exit status

But, putting:

gcc -fPIC -c bar.c

works.



CMake: [Welcome | Site Map]