View Issue Details

IDProjectCategoryView StatusLast Update
0035072FPCCompilerpublic2019-02-15 19:57
ReporterTimm ThalerAssigned ToFlorian 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Platformx64OSWinOS VersionWin7
Product Version3.3.1Product BuildFPC r41259 LAZ svn60369 
Target VersionFixed in Version3.3.1 
Summary0035072: AVR embedded - wrong Linker parameters when space in path
DescriptionWith Laz trunk (Laz2.1+FPC3.3.1) and Laz stable (Laz2.0+FPC3.2.0) there is an Linker Error when calling avr-embedded-objcopy.exe if file path contains spaces:

    Projekt kompilieren, OS: embedded, CPU: avr, Ziel: datalogger: Exit code 1, Fehler: 1, Warnungen: 3, Hinweise: 20
    ...
    [0.335] Executing "C:\Tools\Lazarus\cross\bin\avr-embedded\avr-embedded-ld.exe" with command line "-g --gc-sections -L. -o "D:\Eigene Dateien\Technik\Datalogger\datalogger.elf" -T "D:\Eigene Dateien\Technik\Datalogger\link.res""
    Size of Code: 29068 bytes
    Size of initialized data: 336 bytes
    Size of uninitialized data: 814 bytes
    [0.353] Searching file C:\Tools\Lazarus\cross\bin\avr-embedded\avr-embedded-objcopy.exe... found
    Using util C:\Tools\Lazarus\cross\bin\avr-embedded\avr-embedded-objcopy.exe
    [0.353] Executing "C:\Tools\Lazarus\cross\bin\avr-embedded\avr-embedded-objcopy.exe" with command line "-O ihex D:\Eigene Dateien\Technik\Datalogger\datalogger.elf D:\Eigene Dateien\Technik\Datalogger\datalogger.hex"
    Usage: C:\Tools\Lazarus\cross\bin\avr-embedded\avr-embedded-objcopy.exe [option(s)] in-file [out-file]
     Copies a binary file, possibly transforming it in the process
     The options are:
    ...
    datalogger.lpr(194,0) Error: Error while linking

With Laz1.9+FPC3.1.1 the same projects compile without error. Seems "" are missing now.

I use the latest trunk and fixes, FPC and IDE build with fpcupdeluxe. All .s, .ppu, .o files of the project are created, only the last call to avr-embedded-objcopy.exe went wrong.
Steps To ReproduceTry to compile an AVR embedded project with latest trunk (3.3.1) or stable (3.2.0).
TagsNo tags attached.
Fixed in Revision41324
FPCOldBugId
FPCTarget
Attached Files
  • datalogger.lpi (3,721 bytes)
  • t_embed.pas.patch (1,199 bytes)
    Index: compiler/systems/t_embed.pas
    ===================================================================
    --- compiler/systems/t_embed.pas	(revision 41323)
    +++ compiler/systems/t_embed.pas	(working copy)
    @@ -1311,12 +1311,12 @@
       if success and (target_info.system in [system_arm_embedded,system_avr_embedded,system_mipsel_embedded]) then
         begin
           success:=DoExec(FindUtil(utilsprefix+'objcopy'),'-O ihex '+
    -        ChangeFileExt(current_module.exefilename,'.elf')+' '+
    -        ChangeFileExt(current_module.exefilename,'.hex'),true,false);
    +        maybequoted(ChangeFileExt(current_module.exefilename,'.elf'))+' '+
    +        maybequoted(ChangeFileExt(current_module.exefilename,'.hex')),true,false);
           if success then
             success:=DoExec(FindUtil(utilsprefix+'objcopy'),'-O binary '+
    -          ChangeFileExt(current_module.exefilename,'.elf')+' '+
    -          ChangeFileExt(current_module.exefilename,'.bin'),true,false);
    +          maybequoted(ChangeFileExt(current_module.exefilename,'.elf'))+' '+
    +          maybequoted(ChangeFileExt(current_module.exefilename,'.bin')),true,false);
         end;
     
       MakeExecutable:=success;   { otherwise a recursive call to link method }
    
    t_embed.pas.patch (1,199 bytes)

Activities

Thaddy de Koning

2019-02-13 16:10

reporter   ~0114089

Last edited: 2019-02-13 16:14

View 2 revisions

This is a limitation of the toolchain and really not an FPC issue.
For AVR there is no internal linker available. This limitation is documented AFAIK.
You can set up a symlink to a spaceless directory or use the windows shortpath equivalents (c:\program~1\ style)

Timm Thaler

2019-02-13 22:17

reporter   ~0114094

So what else changed then the Láz and FPC version? In Laz1.9+FPC3.1.1 it worked with the same compiler settings.

Timm Thaler

2019-02-14 01:55

reporter   ~0114099

There is one thing I found:

In project => project settings => show compiler settings the Laz2.1 shows an -oPath that is not present in Laz1.9. But there is no compiler switch -o (lower), only -O (upper). This is new in Laz2.1 and Laz2.0.

Thaddy de Koning

2019-02-14 10:09

reporter   ~0114103

-o<x> Change the name of the executable produced to <x>
  -O<x> Optimizations:

Cyrax

2019-02-14 13:39

reporter   ~0114109

Can you attach your project .lpi file only?

Timm Thaler

2019-02-14 15:46

reporter  

datalogger.lpi (3,721 bytes)

Timm Thaler

2019-02-14 15:47

reporter   ~0114112

See in datalogger.lpi

Michl

2019-02-15 19:54

reporter  

t_embed.pas.patch (1,199 bytes)
Index: compiler/systems/t_embed.pas
===================================================================
--- compiler/systems/t_embed.pas	(revision 41323)
+++ compiler/systems/t_embed.pas	(working copy)
@@ -1311,12 +1311,12 @@
   if success and (target_info.system in [system_arm_embedded,system_avr_embedded,system_mipsel_embedded]) then
     begin
       success:=DoExec(FindUtil(utilsprefix+'objcopy'),'-O ihex '+
-        ChangeFileExt(current_module.exefilename,'.elf')+' '+
-        ChangeFileExt(current_module.exefilename,'.hex'),true,false);
+        maybequoted(ChangeFileExt(current_module.exefilename,'.elf'))+' '+
+        maybequoted(ChangeFileExt(current_module.exefilename,'.hex')),true,false);
       if success then
         success:=DoExec(FindUtil(utilsprefix+'objcopy'),'-O binary '+
-          ChangeFileExt(current_module.exefilename,'.elf')+' '+
-          ChangeFileExt(current_module.exefilename,'.bin'),true,false);
+          maybequoted(ChangeFileExt(current_module.exefilename,'.elf'))+' '+
+          maybequoted(ChangeFileExt(current_module.exefilename,'.bin')),true,false);
     end;
 
   MakeExecutable:=success;   { otherwise a recursive call to link method }
t_embed.pas.patch (1,199 bytes)

Michl

2019-02-15 19:55

reporter   ~0114159

Possible patch added.

Issue History

Date Modified Username Field Change
2019-02-13 11:03 Timm Thaler New Issue
2019-02-13 16:10 Thaddy de Koning Note Added: 0114089
2019-02-13 16:14 Thaddy de Koning Note Edited: 0114089 View Revisions
2019-02-13 22:17 Timm Thaler Note Added: 0114094
2019-02-14 01:55 Timm Thaler Note Added: 0114099
2019-02-14 10:09 Thaddy de Koning Note Added: 0114103
2019-02-14 13:39 Cyrax Note Added: 0114109
2019-02-14 15:46 Timm Thaler File Added: datalogger.lpi
2019-02-14 15:47 Timm Thaler Note Added: 0114112
2019-02-15 19:54 Michl File Added: t_embed.pas.patch
2019-02-15 19:55 Michl Note Added: 0114159
2019-02-15 19:57 Florian Fixed in Revision => 41324
2019-02-15 19:57 Florian Status new => resolved
2019-02-15 19:57 Florian Fixed in Version => 3.3.1
2019-02-15 19:57 Florian Resolution open => fixed
2019-02-15 19:57 Florian Assigned To => Florian