Recent

Author Topic: Problem with linking under Linux in debug mode compilation  (Read 2285 times)

simone

  • Hero Member
  • *****
  • Posts: 573
Problem with linking under Linux in debug mode compilation
« on: April 27, 2019, 11:35:47 am »
I periodically check under Linux Ubuntu a quite complex project developed under Windows, in order to detect OS dependencies. I have never had any problems in these years so far, but with Lazarus 2.x, when I compile in debug mode (no problem in release mode), I have the following linking error: 

Code: Pascal  [Select][+][-]
  1. (9015) Linking /home/simone/Scrivania/MyGraphEditor 346/mygrapheditor
  2. /usr/bin/objcopy: "346/mygrapheditor.dbg"": questo file non esiste (***)
  3. /home/simone/Scrivania/MyGraphEditor 346/MyGraphEditor.lpr(67,1) Error: (9013) Error while linking
  4. /home/simone/Scrivania/MyGraphEditor 346/MyGraphEditor.lpr(67,1) Fatal: (10026) There were 1 errors compiling module, stopping
  5. Fatal: (1018) Compilation aborted
  6. Error: /usr/bin/ppcx64 returned an error exitcode
  7.  
  8.  
  9. (***) translated: This file does not exist
  10.  

It seems that the linker is not able to find the .dbg file because of space character in the path. My experience in using Lazarus under Linux is limited. Has someone some explanations?  Thanks in advance.

 
Microsoft Windows 10 64 bit - Lazarus 3.0 FPC 3.2.2 x86_64-win64-win32/win64

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: Problem with linking under Linux in debug mode compilation
« Reply #1 on: April 27, 2019, 11:46:19 am »
On Windows I think FPC uses an internal linker if possible.
On other OSs FPC relies on third party tools, some of which still cannot cope with space characters in paths.
Does renaming the offending directory path to remove all spaces dispose of the issue?

simone

  • Hero Member
  • *****
  • Posts: 573
Re: Problem with linking under Linux in debug mode compilation
« Reply #2 on: April 27, 2019, 11:54:56 am »
Thanks Howard. Just tested: If I remove the space in the path, renaming the folder, the linking process ends without errors. The strange thing is that in the past, with same os istallation but different Lazarus version, I have never had this issue.     
Microsoft Windows 10 64 bit - Lazarus 3.0 FPC 3.2.2 x86_64-win64-win32/win64

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9791
  • Debugger - SynEdit - and more
    • wiki
Re: Problem with linking under Linux in debug mode compilation
« Reply #3 on: April 27, 2019, 12:51:20 pm »
Maybe a difference between using internal and external debug info file?

simone

  • Hero Member
  • *****
  • Posts: 573
Re: Problem with linking under Linux in debug mode compilation
« Reply #4 on: April 27, 2019, 04:40:16 pm »
I'm not sure to understand your hypothesis. I compiled the project starting without a .dbg file. The compiler generate the .dbg file, but the linker don't find it, reporting a path truncated in the space position. With respect to my intial post, the created .dbg file has the following path:

/home/simone/Scrivania/MyGraphEditor 346/mygrapheditor.dbg

The linker says:

/usr/bin/objcopy: "346/mygrapheditor.dbg"": This file does not exist

So I thought that the problem was the space in path. Indeed, if I remove it, the linker works well.
« Last Edit: April 27, 2019, 04:42:29 pm by simone »
Microsoft Windows 10 64 bit - Lazarus 3.0 FPC 3.2.2 x86_64-win64-win32/win64

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9791
  • Debugger - SynEdit - and more
    • wiki
Re: Problem with linking under Linux in debug mode compilation
« Reply #5 on: April 27, 2019, 05:17:32 pm »
But you also said (or did I misread?) that you did not have the issue at some earlier point, yet believed the space had been there already?

Afaik (but not a 100% sure) the .dbg file is only used/needed if you select "Use external debug symbol file (-Xg)". So maybe you did change that setting at some time.

simone

  • Hero Member
  • *****
  • Posts: 573
Re: Problem with linking under Linux in debug mode compilation
« Reply #6 on: April 27, 2019, 06:09:02 pm »
Dear Martin, you read correctly. For this project I have always used to name the folder with last version as name+whitespace+number, without problems under Linux since now. Moreover I always used -Xg option for gbd.

Are you asking me this because my problem is not reproducible?

     
« Last Edit: April 27, 2019, 06:16:00 pm by simone »
Microsoft Windows 10 64 bit - Lazarus 3.0 FPC 3.2.2 x86_64-win64-win32/win64

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9791
  • Debugger - SynEdit - and more
    • wiki
Re: Problem with linking under Linux in debug mode compilation
« Reply #7 on: April 27, 2019, 06:24:41 pm »
I haven tried if it is reproducible.

I couldn't know if or how much you know about -Xg. I saw the dbg file, and the mention that something seems to have changed. So I pointed this out, in case it may have been changed unintentionally.

As this is not the case, I do not know what caused the change.

simone

  • Hero Member
  • *****
  • Posts: 573
Re: Problem with linking under Linux in debug mode compilation
« Reply #8 on: April 27, 2019, 06:39:43 pm »
I always used external gdb file. However, as soon as I can, I try to reproduce the issue with a project created from scratch.

The Lazarus 2.0.2 installation is fresh (from .deb files).
Microsoft Windows 10 64 bit - Lazarus 3.0 FPC 3.2.2 x86_64-win64-win32/win64

Cyrax

  • Hero Member
  • *****
  • Posts: 836
Re: Problem with linking under Linux in debug mode compilation
« Reply #9 on: April 27, 2019, 07:05:03 pm »
This thread somewhat reminded this bugreport of mine : https://bugs.freepascal.org/view.php?id=35326

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: Problem with linking under Linux in debug mode compilation
« Reply #10 on: April 27, 2019, 08:04:02 pm »
I always used external gdb file. However, as soon as I can, I try to reproduce the issue with a project created from scratch.

The Lazarus 2.0.2 installation is fresh (from .deb files).

I use external debug files too and I've always had this problem: objcopy and some other utils don't like spaces in the file names, whatever the platform. At least the versions I have; maybe the latest versions have corrected this behaviour.

The "solution" is either to make sure there's never a space in the passed paths or not use the "external debug file"  option.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

simone

  • Hero Member
  • *****
  • Posts: 573
Re: Problem with linking under Linux in debug mode compilation
« Reply #11 on: April 27, 2019, 08:43:50 pm »
Under Windows this problem don't arise. However I will avoid paths with spaces, undoubtedly a bad practice used by me.

I was afraid that my software had some obscure dependence on the Windows platform.

Thanks for help.
Microsoft Windows 10 64 bit - Lazarus 3.0 FPC 3.2.2 x86_64-win64-win32/win64

 

TinyPortal © 2005-2018