Recent

Author Topic: fpc3.0.4 fails durink linking on Centos 7  (Read 2016 times)

tomsi42

  • New member
  • *
  • Posts: 7
fpc3.0.4 fails durink linking on Centos 7
« on: February 26, 2018, 01:57:22 pm »
Hi,

I installed lazarus 1.8.0 woth fpc& fpc-src 3.0.4 on CentOS 7. There I get an error during linking; which comes from fpc. I created a simple pascal program and tried to compile it with fpc and I get the same error.

/usr/bin/ld: warning: link.res contains output sections; did you forget -T?
/usr/bin/ld: /usr/lib64/fpc/3.0.4/units/x86_64-linux/rtl/prt0.o: unrecognized relocation (0x2a) in section `.text'
/usr/bin/ld: final link failed: Bad value
hello.pas(4,4) Error: Error while linking
hello.pas(4,4) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
Error: /usr/bin/ppcx64 returned an error exitcode

I f I uninstall 3.0.4 and install fpc 3.0.2 instead, it works fine. Also, using the fpc found in fpc-3.0.4.x86_64-linux.tar works fine.

Is this a known issue?

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6608
Re: fpc3.0.4 fails durink linking on Centos 7
« Reply #1 on: February 26, 2018, 02:07:40 pm »
Yes, https://bugs.freepascal.org/view.php?id=32251

In short, the FPC RPMs were built on a system with newer binutils.

tomsi42

  • New member
  • *
  • Posts: 7
Re: fpc3.0.4 fails durink linking on Centos 7
« Reply #2 on: February 27, 2018, 08:55:01 am »
Thanks for the reply - I am thinking that this is unfortunate. The rpms should be compatible with CentOS 7 at least.

Unfortunately, I am not able to build the RPM's my self as I get an error when I try to build the fpc source rpm:

make[1]: Leaving directory `/home/cpt3tsi/rpmbuild/BUILD/fpc-3.0.4/utils'
+ '[' -z ']'
+ make -C fpcdocs pdf FPC=/home/cpt3tsi/rpmbuild/BUILD/fpc-3.0.4/compiler/ppcx64
make: *** fpcdocs: No such file or directory.  Stop.

Thaddy

  • Hero Member
  • *****
  • Posts: 7178
Re: fpc3.0.4 fails durink linking on Centos 7
« Reply #3 on: February 27, 2018, 09:31:19 am »
If you already have a working starting compiler: fpc3.0.0 or 3.0.2 you can svn checkout the source tree and from the root of the checkout directory do make clean all install. After that you need to edit /etc/fpc.cfg to point to the new version.
I suppose you know how to do that. Otherwise ask again. Note if you insist on using old binutils you will get the "did you forget -T?" warning every time, which you can ignore. Better to upgrade.
« Last Edit: February 27, 2018, 09:37:55 am by Thaddy »
inline variables like in D10.3 are a bit like Brexit: if you are given the wrong information it sounds like a good idea. Every kid loves candy, but it makes you fat and your teeth will disappear.

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6608
Re: fpc3.0.4 fails durink linking on Centos 7
« Reply #4 on: February 27, 2018, 10:11:12 am »
Probably you need a "fpcbuild" checkout or archive, not a "fpc" source.

fpcbuild is a release engineering repository that pulls in the fpcdocs and fpc repos as externals.

tomsi42

  • New member
  • *
  • Posts: 7
Re: fpc3.0.4 fails durink linking on Centos 7
« Reply #5 on: February 27, 2018, 10:31:59 am »
Thanks for the tips.

I will look into building from a fpcbuild archive.

Also, the  compiler in the fpc 3.0.4 standalone  tar package works fine, I can use that.

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6608
Re: fpc3.0.4 fails durink linking on Centos 7
« Reply #6 on: February 27, 2018, 11:08:33 am »
I always use either the .tar or self build. Never the deb/rpm, usually they cause more problems and the only thing they fix is easy deinstall.

I avoid the deinstall problem by installing in a special dir as prefix, and symlinking the relevant binaries to my ~/bin This also allows easy switching branches.

tomsi42

  • New member
  • *
  • Posts: 7
Re: fpc3.0.4 fails durink linking on Centos 7
« Reply #7 on: February 27, 2018, 12:05:23 pm »
I always use either the .tar or self build. Never the deb/rpm, usually they cause more problems and the only thing they fix is easy deinstall.
I am coming to the same conclusion myself.

I avoid the deinstall problem by installing in a special dir as prefix, and symlinking the relevant binaries to my ~/bin This also allows easy switching branches.
Do you do the same with lazarus? How do toy set up the fpc source for lazarus in that case?


marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6608
Re: fpc3.0.4 fails durink linking on Centos 7
« Reply #8 on: February 27, 2018, 12:14:24 pm »
I avoid the deinstall problem by installing in a special dir as prefix, and symlinking the relevant binaries to my ~/bin This also allows easy switching branches.
Do you do the same with lazarus? How do toy set up the fpc source for lazarus in that case?

I just have a lazarus repo somewhere. But that usually only uses (FPC-) trunk. I only use Lazarus for source editing on *nix, not really for major application development.

tomsi42

  • New member
  • *
  • Posts: 7
Re: fpc3.0.4 fails durink linking on Centos 7
« Reply #9 on: February 27, 2018, 12:56:30 pm »
I have now a working setup I am happy with.

I installed the fpc tar file in /opt/fpc, added my newly-built lazarus package in the same directory and placed the fpc source in a suitable directory.

I had to ad /opt/fpc/bin to my path, otherwise lazarus would complain that it couldn't find fpcres. Which makes sense, I think.

(I didn't want to install in /usr/lcoal as I expect I will be upgrading once in a while  ;D )

Thanks for the help.