Recent

Author Topic: What is the cause of the crti.o, crtn.o warnings?  (Read 11045 times)

vfclists

  • Hero Member
  • *****
  • Posts: 1013
    • HowTos Considered Harmful?
What is the cause of the crti.o, crtn.o warnings?
« on: March 10, 2017, 10:12:53 am »
What is the cause of the crti.o, crtn.o warnings?

Is it because the path to the /usr/lib/{$TargetCPU}-{$TargetOs} directories eg /usr/lib/i386-linux, are not present in the fpc.cfg, or are not the ones the linker expects?
Lazarus 3.0/FPC 3.2.2

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11446
  • FPC developer.
Re: What is the cause of the crti.o, crtn.o warnings?
« Reply #1 on: March 10, 2017, 10:44:18 am »
"the" warnings? Maybe it would be practical if you'd show them?

BeniBela

  • Hero Member
  • *****
  • Posts: 906
    • homepage
Re: What is the cause of the crti.o, crtn.o warnings?
« Reply #2 on: March 10, 2017, 12:12:05 pm »
Oh, I get them, too:

Quote
Code: [Select]
Compile Project, Target: /tmp/project1, Warnings: 2
project1.lpr(20,1) Warning: "crtbeginS.o" not found, this will probably cause a linking failure
project1.lpr(20,1) Warning: "crtendS.o" not found, this will probably cause a linking failure

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11446
  • FPC developer.
Re: What is the cause of the crti.o, crtn.o warnings?
« Reply #3 on: March 10, 2017, 12:13:48 pm »
Yes. Either files not installed, for wrong target or version, or the wrong path (which is indeed set via fpc.cfg and detected by the various programs that create fpc.cfg (fpmkcfg ?)

vfclists

  • Hero Member
  • *****
  • Posts: 1013
    • HowTos Considered Harmful?
Re: What is the cause of the crti.o, crtn.o warnings?
« Reply #4 on: March 10, 2017, 12:16:51 pm »
"the" warnings? Maybe it would be practical if you'd show them?

I understand that they are stock Linux/Unix development packages but when does the linker decide that they are missing even when they are present in the file system?
Code: Pascal  [Select][+][-]
  1. vfclists@hp01:~/Lazarus$ sudo locate crti.o
  2. [sudo] password for vfclists:
  3. /home/vfclists/QtSDK/Madde/sysroots/harmattan_sysroot_10.2011.34-1_slim/usr/lib/crti.o
  4. /usr/lib/i386-linux-gnu/crti.o
  5. /usr/lib/x86_64-linux-gnu/crti.o
  6. /usr/lib32/crti.o
  7. /usr/libx32/crti.o
  8. vfclists@hp01:~/Lazarus

How do you configure Linux to install the right ones from the start, or ensure that those required by your version of Linux are in place?

PS. The one in the QtSDK path can be ignored. I don't think Lazarus goes anywhere near there.
« Last Edit: March 10, 2017, 12:19:24 pm by vfclists »
Lazarus 3.0/FPC 3.2.2

rvk

  • Hero Member
  • *****
  • Posts: 6162
Re: What is the cause of the crti.o, crtn.o warnings?
« Reply #5 on: March 10, 2017, 12:38:11 pm »
You still didn't specify what warning you get.
Please copy the exact warning.

Is it about missing the files or that the files are corrupt or that they are on holiday... we still don't know.

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: What is the cause of the crti.o, crtn.o warnings?
« Reply #6 on: March 12, 2017, 05:59:40 am »
The warning should be harmless. However if you can't bear them, just put -Fl/usr/lib into your fpc.cfg. AFAICS the warning is generated by the compiler (it will try to search the file in all paths it knows), while linking is done by the linker, which is why linking succeeded despite the warning. Note that on different (Linux) system, the warning and solution can be different. On my manjaro system, for instance, the warning is generated for the crtbegin.o and crtend.o instead of crti.o and crtn.o, in which those files are located in /usr/lib/gcc/x86_64-pc-linux-gnu/<gcc version> instead of /usr/lib.

vfclists

  • Hero Member
  • *****
  • Posts: 1013
    • HowTos Considered Harmful?
Re: What is the cause of the crti.o, crtn.o warnings?
« Reply #7 on: March 12, 2017, 10:33:01 am »
I had the problem in another build, fpcupdeluxe did not complete propelry, Clean and Build would result in a message saying 'startlazarus could not be found' and some programs would not build at all with a linking failure.

I had to set the -vd option, Copy All/Original messages from the messages panel and checked it, where I found out that crtbegin.o and crtend.o were missing. They were on the file system and trying to fix fpc.cfg didn't seem to work. So I had to link them into the locations configured in the fpc.cfg.

Code: Pascal  [Select][+][-]
  1. sudo ln -s /usr/lib/gcc/x86_64-linux-gnu/4.9/32/crtend.o /usr/lib/i386-linux-gnu/crtend.o
  2. sudo ln -s /usr/lib/gcc/x86_64-linux-gnu/4.9/32/crtbegin.o /usr/lib/i386-linux-gnu/crtbegin.o
  3.  
Lazarus 3.0/FPC 3.2.2

rvk

  • Hero Member
  • *****
  • Posts: 6162
Re: What is the cause of the crti.o, crtn.o warnings?
« Reply #8 on: March 12, 2017, 01:20:00 pm »
Code: Pascal  [Select][+][-]
  1. sudo ln -s /usr/lib/gcc/x86_64-linux-gnu/4.9/32/crtend.o /usr/lib/i386-linux-gnu/crtend.o
  2. sudo ln -s /usr/lib/gcc/x86_64-linux-gnu/4.9/32/crtbegin.o /usr/lib/i386-linux-gnu/crtbegin.o
  3.  
Wait... are you creating a link from the 64bit versions of crtbegin.o to a 32bit directory?

Shouldn't you install the 32bit version of libgcc to get the correct 32bit versions?

Or does that not matter for .o files?

vfclists

  • Hero Member
  • *****
  • Posts: 1013
    • HowTos Considered Harmful?
Re: What is the cause of the crti.o, crtn.o warnings?
« Reply #9 on: March 12, 2017, 01:29:42 pm »
Code: Pascal  [Select][+][-]
  1. sudo ln -s /usr/lib/gcc/x86_64-linux-gnu/4.9/32/crtend.o /usr/lib/i386-linux-gnu/crtend.o
  2. sudo ln -s /usr/lib/gcc/x86_64-linux-gnu/4.9/32/crtbegin.o /usr/lib/i386-linux-gnu/crtbegin.o
  3.  
Wait... are you creating a link from the 64bit versions of crtbegin.o to a 32bit directory?

Shouldn't you install the 32bit version of libgcc to get the correct 32bit versions?

Or does that not matter for .o files?

I am not quite sure. All I saw was that there were x32 and 32 subdirectories under /usr/lib/gcc/x86_64-linux-gnu/4.9 which I assumed were for 32 bit development so I copied them there. Perhaps install libgcc:i386 as you suggest may be better.
Lazarus 3.0/FPC 3.2.2

rvk

  • Hero Member
  • *****
  • Posts: 6162
Re: What is the cause of the crti.o, crtn.o warnings?
« Reply #10 on: March 12, 2017, 01:35:33 pm »
I am not quite sure. All I saw was that there were x32 and 32 subdirectories under /usr/lib/gcc/x86_64-linux-gnu/4.9 which I assumed were for 32 bit development so I copied them there. Perhaps install libgcc:i386 as you suggest may be better.
Woops, yer, you're correct. I missed that 32.

But didn't adding (or changing) this to the fpc.cfg work?

Code: Pascal  [Select][+][-]
  1. # path to the gcclib
  2. #ifdef cpui386
  3. -Fl/usr/lib/gcc/x86_64-linux-gnu/4.9/32
  4. #endif
  5. #ifdef cpux86_64
  6. -Fl/usr/lib/gcc/x86_64-linux-gnu/4.9
  7. #endif

vfclists

  • Hero Member
  • *****
  • Posts: 1013
    • HowTos Considered Harmful?
Re: What is the cause of the crti.o, crtn.o warnings?
« Reply #11 on: March 12, 2017, 01:42:47 pm »
I am not quite sure. All I saw was that there were x32 and 32 subdirectories under /usr/lib/gcc/x86_64-linux-gnu/4.9 which I assumed were for 32 bit development so I copied them there. Perhaps install libgcc:i386 as you suggest may be better.
Woops, yer, you're correct. I missed that 32.

But didn't adding (or changing) this to the fpc.cfg work?

Code: Pascal  [Select][+][-]
  1. # path to the gcclib
  2. #ifdef cpui386
  3. -Fl/usr/lib/gcc/x86_64-linux-gnu/4.9/32
  4. #endif
  5. #ifdef cpux86_64
  6. -Fl/usr/lib/gcc/x86_64-linux-gnu/4.9
  7. #endif

I tried that and it didn't work. Some of the issues seem to come from other utiltites which don't use fpc.cfg. Adding 32 to the cpui386 section didn't work.
Lazarus 3.0/FPC 3.2.2

Thaddy

  • Hero Member
  • *****
  • Posts: 14363
  • Sensorship about opinions does not belong here.
Re: What is the cause of the crti.o, crtn.o warnings?
« Reply #12 on: March 12, 2017, 04:46:36 pm »
First determine where the buggers actually are: That is the default gcc lib path.
Type "whereis gcc"
Response is one bin and one lib directory. Use the lib directory and add it to /etc/fpc.cfg: -Fl/what/you/just/found/out (important!) .
Job done
« Last Edit: March 12, 2017, 04:48:18 pm by Thaddy »
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: What is the cause of the crti.o, crtn.o warnings?
« Reply #13 on: March 12, 2017, 04:51:54 pm »
I tried that and it didn't work. Some of the issues seem to come from other utiltites which don't use fpc.cfg. Adding 32 to the cpui386 section didn't work.
Try compiling with -va (or just -vt), look for messages before the compiler issues that warning. They will be list of path used to search for each corresponding file.

Thaddy

  • Hero Member
  • *****
  • Posts: 14363
  • Sensorship about opinions does not belong here.
Re: What is the cause of the crti.o, crtn.o warnings?
« Reply #14 on: March 12, 2017, 05:19:48 pm »
Lazarus seems to listen to /etc/fpc.cfg only. But indeed. That does not harm.
In my experience it is either that or people point to the wrong version of all their installed GCC's. (Hence whereis)
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

 

TinyPortal © 2005-2018