Recent

Author Topic: Error while linking [SOLVED]  (Read 23599 times)

odvesims

  • Full Member
  • ***
  • Posts: 176
Error while linking [SOLVED]
« on: May 22, 2017, 04:51:02 pm »
Hey There!

I've been developing under windows so far. Now I want to switch to ubuntu as my development environment. I have a project I've been working on for a while and I want to continue working on it under Linux. However, when I try to run the project it throws an "error while linking" error message and the project wouldn't build. I've created a new project to check if it'd be something related to Lazarus IDE but it's not since brand-new project builds and runs correctly. What am I missing..? Thanks in advance  :D
« Last Edit: July 26, 2017, 09:09:58 pm by odvesims »

Handoko

  • Hero Member
  • *****
  • Posts: 5131
  • My goal: build my own game engine using Lazarus
Re: Error while linking
« Reply #1 on: May 22, 2017, 05:40:10 pm »
Do you use the stable version of Lazarus? For production use, you should use only the stable version, not the development version.

On the project that failed to build, can you check if the setting is configured to Linux target? If you want to target Windows binary, you should first make your Lazarus/FPC to cross compile to Windows.

zeljko

  • Hero Member
  • *****
  • Posts: 1594
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Error while linking
« Reply #2 on: May 22, 2017, 05:44:46 pm »
Hey There!

I've been developing under windows so far. Now I want to switch to ubuntu as my development environment. I have a project I've been working on for a while and I want to continue working on it under Linux. However, when I try to run the project it throws an "error while linking" error message and the project wouldn't build. I've created a new project to check if it'd be something related to Lazarus IDE but it's not since brand-new project builds and runs correctly. What am I missing..? Thanks in advance  :D

You're probably missing *-dev packages ... I'm using fedora so don't know exact names, but probably something like libgtk2-dev libgdk2-dev etc

Handoko

  • Hero Member
  • *****
  • Posts: 5131
  • My goal: build my own game engine using Lazarus
Re: Error while linking
« Reply #3 on: May 22, 2017, 06:31:12 pm »
In my tests, I found that to make Lazarus/FPC working correctly on Linux, you may need to install these:

- libx11-dev
- libgtk2.0-dev
- libgdk-pixbuf2.0-dev
- libcairo2-dev
- libpango1.0-dev
- libgl1-mesa-dev (if you want to develop OpenGL programs)

Read more here:
http://forum.lazarus.freepascal.org/index.php/topic,35214

odvesims

  • Full Member
  • ***
  • Posts: 176
Re: Error while linking
« Reply #4 on: May 22, 2017, 08:12:55 pm »
In my tests, I found that to make Lazarus/FPC working correctly on Linux, you may need to install these:

- libx11-dev
- libgtk2.0-dev
- libgdk-pixbuf2.0-dev
- libcairo2-dev
- libpango1.0-dev
- libgl1-mesa-dev (if you want to develop OpenGL programs)

Read more here:
http://forum.lazarus.freepascal.org/index.php/topic,35214

I have all of those installed.  :-\

Handoko

  • Hero Member
  • *****
  • Posts: 5131
  • My goal: build my own game engine using Lazarus
Re: Error while linking
« Reply #5 on: May 22, 2017, 08:26:09 pm »
You mentioned you got "error while linking" message. Can you please provide the whole message or screenshot? Usually it contains something useful for fixing the issue.

odvesims

  • Full Member
  • ***
  • Posts: 176
Re: Error while linking
« Reply #6 on: May 22, 2017, 08:31:02 pm »
You mentioned you got "error while linking" message. Can you please provide the whole message or screenshot? Usually it contains something useful for fixing the issue.

That's all it says. It's like "user/myProjects/myProject.lpr(63,1) Error: Error while linking". The 63,1 points to the "end." line in my project's .lpr file.

balazsszekely

  • Guest
Re: Error while linking
« Reply #7 on: May 22, 2017, 08:45:34 pm »
@odvesims
Try to increase verbosity(project options) during compilation, maybe you get more info. In my experience the linking failure usually is caused by the missing libgl-dev.

odvesims

  • Full Member
  • ***
  • Posts: 176
Re: Error while linking
« Reply #8 on: May 22, 2017, 08:52:26 pm »
@odvesims
Try to increase verbosity(project options) during compilation, maybe you get more info. In my experience the linking failure usually is caused by the missing libgl-dev.

Checked all the checkboxes in verborsity and even increased the number for the "stop after" at the bottom. Same results, it doesn't give any extra information %)  :(

balazsszekely

  • Guest
Re: Error while linking
« Reply #9 on: May 22, 2017, 09:03:59 pm »
Quote
Checked all the checkboxes in verborsity and even increased the number for the "stop after" at the bottom. Same results, it doesn't give any extra information %)  :(
I'm out of ideas. Do you use resources in your application? Perhaps you deleted some resource declaration by accident? You should also try to build your application on a different platform(windows maybe?).

Handoko

  • Hero Member
  • *****
  • Posts: 5131
  • My goal: build my own game engine using Lazarus
Re: Error while linking
« Reply #10 on: May 22, 2017, 09:05:46 pm »
What version of your Ubuntu, Lazarus and FPC?

Do you install Lazarus that comes from Ubuntu repositories?

molly

  • Hero Member
  • *****
  • Posts: 2330
Re: Error while linking
« Reply #11 on: May 22, 2017, 09:09:21 pm »
@handoko
linker does usually not ouput verbose information, so either you need a full log (and know where to look for), or use gnu link verbosity option using fpc's -k option

odvesims

  • Full Member
  • ***
  • Posts: 176
Re: Error while linking
« Reply #12 on: May 22, 2017, 09:54:46 pm »
What version of your Ubuntu, Lazarus and FPC?

Do you install Lazarus that comes from Ubuntu repositories?

I downloaded it from the lazarus web-page and downloaded some packages (basically the ones you listed in a previous post) using apt-get.

cpicanco

  • Hero Member
  • *****
  • Posts: 618
  • Behavioral Scientist and Programmer
    • Portfolio
Re: Error while linking
« Reply #13 on: May 23, 2017, 11:07:24 pm »
Hi,

Some tips:

1) Right click at the messages windows and change filtering setting to the lowest level.
2) In Debian 8, stable, FPC 3.0.2 and above, I had a linker issue solved (I should say worked around) by recompiling the compiler:
https://bugs.freepascal.org/view.php?id=31490
Be mindful and excellent with each other.
https://github.com/cpicanco/

odvesims

  • Full Member
  • ***
  • Posts: 176
Re: Error while linking
« Reply #14 on: July 25, 2017, 09:19:57 pm »
Hi,

Some tips:

1) Right click at the messages windows and change filtering setting to the lowest level.
2) In Debian 8, stable, FPC 3.0.2 and above, I had a linker issue solved (I should say worked around) by recompiling the compiler:
https://bugs.freepascal.org/view.php?id=31490

Sorry for sort of "abandoning" this thread.

I'm now using rasbian, which is a Debian distribution for raspberry. I installed Lazarus (1.9) and FPC (3.1.1) and after installing all my required packages, the project build fails with the same "Error while linking" error, no other output (When hovering the error message it says "generic linking error" and that's it)

I tried your suggestion but it stops with a "*** The only supported starting compiler version is 3.0.0. You are trying to build with 3.1.1.. Stop".

 

TinyPortal © 2005-2018