Recent

Author Topic: Error while linking (Ubuntu)  (Read 16516 times)

slav1962

  • Newbie
  • Posts: 3
Error while linking (Ubuntu)
« on: December 10, 2017, 03:29:16 pm »
Hello everybody!

I tried use Lazarus 1.6.4 and 1.8.0 and got error.
When I run any program (even empty form) from Lazarus I get error "Error while Linking"

OS:  Linux u14045-lrus 4.4.0-101-generic #124~14.04.1-Ubuntu SMP Fri Nov 10 19:05:36 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
FPC: ii  fpc                                           3.0.4                       amd64                       Free Pascal Compiler
GTK:ii  libgtk2.0-dev                                 2.24.23-0ubuntu1.4          amd64                       development files for the GTK+ library
Lazarus: 1.6.4 or 1.8.0 

My sequence of actions:
1. I removed all files related to FPC
    sudo apt  purge fpc lazarus
    sudo rm -Rf /usr/lib/fpc
    sudo rm -Rf /usr/lib/lazarus
    sudo rm -Rf /usr/share/fpcsrc
    sudo rm -f ~/.fpc
    sudo rm -Rf ~/.lazarus
2. Next, I downloaded:
    fpc_3.0.4-1_amd64.deb
    fpc-src_3.0.4-1_amd64.deb
    lazarus-project_1.8.0-0_amd64.deb
3. Next, I installed packages
    libgtk2.0-dev
    fpc_3.0.4-1_amd64.deb
    fpc-src_3.0.4-1_amd64.deb
    lazarus-project_1.8.0-0_amd64.deb
4. Next, I reboot OS, startlazarus, run project1 and got following message:
   "Error while linking"

What can i do run program from IDE?
Best regards, slav1962

P.S. Any attempts to rebuild packages for Lazarus from the sources (http://wiki.freepascal.org/How_to_setup_a_FPC_and_Lazarus_Ubuntu_repository) end in failure with the message of the make utility "the compiler is required 3.0.4 and 2.6.2 is used"



Thaddy

  • Hero Member
  • *****
  • Posts: 14373
  • Sensorship about opinions does not belong here.
Re: Error while linking (Ubuntu)
« Reply #1 on: December 10, 2017, 03:34:54 pm »
P.S. Any attempts to rebuild packages for Lazarus from the sources (http://wiki.freepascal.org/How_to_setup_a_FPC_and_Lazarus_Ubuntu_repository) end in failure with the message of the make utility "the compiler is required 3.0.4 and 2.6.2 is used"
2.6.2 is very very old. Current FPC (3.0.4) and Lazarus (1.8)  REQUIRE at least fpc 3.0.2 to build because they use compiler features not found in 2.6.2. The only supported compiler is the latest release, which is 3.0.4.
The only officially supported bootstrap compiler is therefor FPC 3.0.2 (the next previous release).
Note that the current stable Ubuntu repository already contains FPC 3.0.2.

Analogue to: Delphi 5 will not compile my Delphi Tokyo 10.2 code....Or Windows 16 doesn't run my Windows 10 software... Or I have no systemd on my Ubuntu system with kernel 2.x ... It is THAT bad!

Upgrade and try again. Alternatively, if you must use old software or old OS versions, stick to the old stable release versions of Lazarus and FPC.
It is still possible to build everything from source: First use fpc 2.6.2 to build 3.0.2, then use fpc 3.0.2 to build fpc 3.0.4. Then build lazarus.
But why not upgrade?
« Last Edit: December 10, 2017, 03:49:13 pm by Thaddy »
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

slav1962

  • Newbie
  • Posts: 3
Re: Error while linking (Ubuntu)
« Reply #2 on: December 10, 2017, 03:54:28 pm »
Thank you for your advice. But in the message I indicated that I'm trying to use version 3.0.4 (FPC: ii  fpc  3.0.4  amd64 Free Pascal Compiler) and get an error "Error while linking".

Why?

Dest regards,
  slav1962

molly

  • Hero Member
  • *****
  • Posts: 2330
Re: Error while linking (Ubuntu)
« Reply #3 on: December 10, 2017, 03:59:41 pm »
"the compiler is required 3.0.4 and 2.6.2 is used"
That says: what you need is 3.0.4 and what you have is 2.6.2

That is also the reason for the linker error.

Handoko

  • Hero Member
  • *****
  • Posts: 5154
  • My goal: build my own game engine using Lazarus
Re: Error while linking (Ubuntu)
« Reply #4 on: December 10, 2017, 04:57:50 pm »
@slav1962

You need to make sure which version of FPC is currently installed. You can use Terminal or Synaptic Packager Manager.

Using Terminal To Check FPC Version

01. Start your Ubuntu Terminal (the shortcut should be Ctrl+Alt+T)
02. On the Terminal, type: FPC [Enter]
03. You should able see: Free Pascal Compiler version ?????
04. If you can't see that line, use your mouse to scroll the view

Using Terminal To Check FPC Version (using FP)

01. Start your Ubuntu Terminal (the shortcut should be Ctrl+Alt+T)
02. On the Terminal, type: FP [Enter]
03. On the FP main menu, click Help > About
04. You will see: Compiler Version ?????

Using Synaptic Package Manager

01. Make sure Synaptic Package Manager is installed
     (you can get it from Ubuntu Software Center)
02. Start Synaptic Package Manager
03. Click the Search icon or using shortcut: Ctrl+F
04. Type: fpc [enter]
05. There you can the installed version

------

So what is the version of the FPC currently installed on the computer?

If you're sure you have installed the FPC version 3.x.x correctly but the result showing you have version 2.x.x. Then I know why. It is a classic Ubuntu-Lazarus installation issue.

The keys are:
- You may need to reboot the computer
- You have to perform version locking.

Installing, uninstalling repeatedly without restarting the computer may make the Ubuntu becomes stupid. I ever failed to install Lazarus just because not doing reboot after series of installing/uninstalling.

But I believe the most possible thing that caused you failed to install Lazarus is you didn't perform version locking. The question is, how to do version locking?

Read more on this old thread:
http://forum.lazarus.freepascal.org/index.php/topic,38828.msg265293.html#msg265293
« Last Edit: December 10, 2017, 05:00:41 pm by Handoko »

Thaddy

  • Hero Member
  • *****
  • Posts: 14373
  • Sensorship about opinions does not belong here.
Re: Error while linking (Ubuntu)
« Reply #5 on: December 10, 2017, 05:09:47 pm »
Handoko the version is known: 2.6.2.... because that what is in his distribution (14 ). 16 However, contains 3.0.2.
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

slav1962

  • Newbie
  • Posts: 3
Re: Error while linking (Ubuntu)
« Reply #6 on: December 11, 2017, 09:49:13 am »
Hello everybody!

The situation after the proposed manipulations did not change - the error remained the same.

I followed all the recommendations:
1. Removed all package, files and folder related to Lazarus
    sudo apt  purge fpc lazarus
    sudo rm -Rf /usr/lib/fpc
    sudo rm -Rf /usr/lib/lazarus
    sudo rm -Rf /usr/share/fpcsrc
    sudo rm -Rf /etc/fp*
    sudo rm -f ~/.fpc
    sudo rm -Rf ~/.lazarus
    sudo shutdown -r now
2. Installed Free Pascal Compiler and him sources
    sudo dpkg -i fpc_3.0.4-1_amd64.deb
    sudo dpkg -i fpc-src_3.0.4-1_amd64.deb
    (In terrminal command fpc outputed:
    Free Pascal Compiler version 3.0.4 [2017/12/04] for x86_64
Copyright (c) 1993-2017 by Florian Klaempfl and others
)
    sudo shutdown -r now
3. Using Synaptic locked version of fpc and fpc-src
    sudo shutdown -r now
4. Installed Lazarus
    sudo dpkg  -i lazarus-project_1.8.0-0_amd64.deb
    sudo shutdown -r now
5. Started Lazarus, ran project1 and got same error :(

Any ideas?

Best regards,
   slav1962 (Vyacheslav)
   
   
 
 
     

molly

  • Hero Member
  • *****
  • Posts: 2330
Re: Error while linking (Ubuntu)
« Reply #7 on: December 11, 2017, 01:19:39 pm »
Simpy dumping your issue into the bugtracker without any further information isn't going to help you.

You said that you installed 3.0.4 compiler and lazarus 1.8.0 correctly. You are able to run lazarus 1.8.0 and when you try to compile a project you get a linking error ?

Compile your project with -va and attach the output. I'm betting that lazarus uses the 2.6.0. compiler instead of the 3.0.4 one. That is either a user error or error on behalf of the package manager used by your operating system.

Handoko knows this as he experienced this several times and advised others on the subject. Unfortunately i do not use ubuntu nor do i have the desire to install it to only find out that there simply is a wrong setup.

@Handoko, I'm not familiar with the problem or have informed myself extensively. Do you perhaps know if ubuntu uses wrong (FPC) dependency for lazarus somewhere and tries to (automatically) fix that (wrongly)  for end-user ?
« Last Edit: December 11, 2017, 04:04:46 pm by molly »

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4468
  • I like bugs.
Re: Error while linking (Ubuntu)
« Reply #8 on: December 11, 2017, 03:05:43 pm »
Yet another Ubuntu related problem when installing FPC and Lazarus.
Please use a rolling distro which has recent versions of everything. Then you don't need to struggle with the installation, everything just works.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Handoko

  • Hero Member
  • *****
  • Posts: 5154
  • My goal: build my own game engine using Lazarus
Re: Error while linking (Ubuntu)
« Reply #9 on: December 11, 2017, 03:40:55 pm »
@Handoko, I'm not familiar with the problem or have informed myself extensively. Do you perhaps know if ubuntu uses wrong (FPC) dependency for lazarus somewhere and tries to (automatically) fix that (wrongly)  for end-user ?

I cannot fully remember the details because those installation issues were happened long ago. I can sure to say Ubuntu is stupid.

My Lazarus was working correctly but until one day, Ubuntu Software Updater popped up to ask me to update. Version upgrades usually will take more than 1 hour to download and install, my Internet connection is not very fast. Updates only take some minutes because they only download the outdated libraries. Because that was an update so I answered 'yes' without thinking much and I didn't pay attention what items were going to be updated.

After the update, I cannot run Lazarus properly (I forget what the error message was). Luckily I have Synaptic Package Manager installed, it's really a handy tool. Synaptic Package Manager told me that the installed FPC was broken. After some inspections, I found that my FPC had been downgraded. So Ubuntu software updates can actually mean a downgrade! The weird thing is the installed Lazarus was left being unchanged.

I tried to uninstall all of the Lazarus, FPC and FPC source and reinstall them back. It failed when installing Lazarus, although I was sure I already installed the correct version of FPC and FPC source. After some testings, I found that I have to do version lockings after I install the FPC and FPC source, or Lazarus can't be installed.

Another story was, it happened when I was trying and switching between full and RC releases. I was sure I did them correctly but it just can't be installed. I gave up, I shut down my computer and had a break. When I came back, I was able to install the FPC/source/Lazarus correctly. So I believe sometimes the OS needs a reboot if I want to uninstall and install another version of the same app.

My memory is not good so if I found something important, I'll write it down. I keep the installation/uninstallation procedure in a text file. I've been using that note for years, no problem with Ubuntu-Lazarus installation so far as long as I follow the instruction.

The TS case is interesting, I wish I can sit in front of his computer to inspect the problem.

Note:
I do not use sudo dpkg to install deb packages. I use GDebi (by double clicking that deb file directly) to install. I think using GDebi is easier and it will tell you the error/status like:
- Error: A later version is already installed
- Same version is already installed
- Error: Breaks existing package ...
- Error: Conflicts with the installed package ...
- etc

Maybe the TS can try GDebi to see what the message he will get.

molly

  • Hero Member
  • *****
  • Posts: 2330
Re: Error while linking (Ubuntu)
« Reply #10 on: December 12, 2017, 05:45:53 pm »
Thank you very much for the detailed reply handoko (even though it is perhaps a bit vague in your memory). it is very much appreciated.  8-)

In the end, i guess, it doesn't matter much what is the cause as long as you are able to fix it  :)

Having seen some of the replies of (other) developers, i think we have enough information to work around the problem if needed.

Quote
The TS case is interesting, I wish I can sit in front of his computer to inspect the problem.
In my experience that is usually the case... it would work so much faster sometimes (and usually also delivers interesting (additional) information)).


Quote
Maybe the TS can try GDebi to see what the message he will get.
Any additional information with regard to circumstances like those from OP would be of help imo.

Thanks for the tip btw, as i wasn't aware of the existence of GDebi

Handoko

  • Hero Member
  • *****
  • Posts: 5154
  • My goal: build my own game engine using Lazarus
Re: Error while linking (Ubuntu)
« Reply #11 on: December 13, 2017, 02:14:34 pm »
I tested the installation of Lazarus 1.8.0, it worked.

Please read here for more information:
http://forum.lazarus.freepascal.org/index.php/topic,39281.msg269014/topicseen.html#new

MikeFinch

  • Jr. Member
  • **
  • Posts: 79
Re: Error while linking (Ubuntu)
« Reply #12 on: December 16, 2017, 11:55:34 pm »
PLEASE NOTE THE FOLLOWING
I used lazarus 1.8.0RC05 on my Desktop and Laptop, both Windows and Mageia 6. All worked well.
I then removed lazarus and installed L1.8.0.
My project on Windows works perfectly but under Mageia 6 on both of my computers I get "Error: Error while linking" and the program ends at "end."
On the face of it (to me) it seems something has changed with the linux version between RC05 and the new 1.8.0 release.
Can you please shed some light on this problem.
BTW, using Verbosity : Show everything (-va) I get "[2.359] Executing "/bin/ld/" with command line "-b elf64-x86-64 -m elf_x86_64 --dynamic-linker=/lib64/ld-linux-x86-64.so.2 -s -L. -o MSPairings link.res"
MSPairings is my program. Does this help?   
Thanks MikeFinch (it is very frustrating - other linux problems exist which I have highlighted in previous posts over the years)  %)

Handoko

  • Hero Member
  • *****
  • Posts: 5154
  • My goal: build my own game engine using Lazarus
Re: Error while linking (Ubuntu)
« Reply #13 on: December 17, 2017, 12:04:08 am »
Can your Lazarus 1.8.0 compile other projects? For example start a new empty project and compile it. If it can't, it means there should be something wrong with your installation.

MikeFinch

  • Jr. Member
  • **
  • Posts: 79
Re: Error while linking (Ubuntu)
« Reply #14 on: December 18, 2017, 05:10:39 am »
Handoko >> because of a corruption of the partition table after trying to upgrade to Windows 10 (ouch! - I'm a linux advocate ...) on my laptop, I have installed a fresh Mageia 6. On installing Lazarus 1.8.0 I get exactly the same problem with my MSPairings program.
I tried an older program (as you suggested) and still get exactly the same problem.
It looks as if something about the linux version (64bit) of Laz1.8.0 is wrong. Release Candidate 05 worked perfectly on my laptop and Desktop. Also in Windows.
Can your developers (are you one?) have a look into this?
MikeFinch

 

TinyPortal © 2005-2018