On Fri, 21 Dec 2007, Lorenzo Fiorini wrote:
> I've successfully rebuilt Harbour and my apps under Fc8 32 bit in
> native ( Linux ), mingw32 and cemgw mode.
> I've also done it with Ubuntu 7.10 Amd64 and the only issue I've found is:
> /usr/bin/ld: ./page.o: relocation R_X86_64_32 against `a local symbol'
> can not be used when making a shared object; recompile with -fPIC
> and adding -fPIC to CC_C_USR it works.
> Is it correct?

Yes. -fPIC causes that compiler always generate forces relocatable
code  eliminating some optimizations. Only relocatable code can be
used in shared libraries. On [EMAIL PROTECTED] it's not very important because
usually even static code generated by GCC is relocatable but on most
of other platform it is and if you want to use shared libraries
you have to compile Harbour and your code with -fPIC GCC switch.
If you look at harbour.spec, make_gcc.sh, make_gnu.sh or make_tgz.sh
then you will find that it's set automatically for Harbour compilation
(C_USR). But if you compile your own code then you have to use -fPIC
switch yourself. If you are using hb* scripts then you can add it to
CC_C_USR so it will always be added by them. I think that I can add
it automatically if Harbour is compiler with -fPIC too.
The side effect of using relocatable code is small performance reduction.
The difference is not very big but it should be noticeable in speedtst.prg.
Important is not your code but flag used to compile HVM. The best solution
would be added two phase Harbour compilation for non GNU make files.
1-st for static libraries and 2-nd for shared library with -fPIC for
other then [EMAIL PROTECTED] platforms but the difference is too small and my
too lazy to make it ;-)

best regards,
Przemek
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to