Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2011-12

compilation erro

25 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Antonio Fortuny

Hi folks.

What's wrong ?
/usr/bin/ld: /usr/lib64/lazarus/lcl/units/x86_64-linux/lclproc.o: relocation R_X86_64_32S against `.data' can not be used when making a shared object; recompile with -fPIC
/usr/lib64/lazarus/lcl/units/x86_64-linux/lclproc.o: could not read symbols: Bad value

The source program compiles without problems on W32, w64 The program is a shared library (dll under Win)

I'm a little bit lost.

Antonio.

Reply by email

Ludo Brands
to Antonio Fortuny
Show quoted text 7 lines
What's wrong ? /usr/bin/ld: /usr/lib64/lazarus/lcl/units/x86_64-linux/lclproc.o: relocation R_X86_64_32S against `.data' can not be used when making a shared object; recompile with -fPIC /usr/lib64/lazarus/lcl/units/x86_64-linux/lclproc.o: could not read symbols: Bad value

If you don't uses the LCL in the library, remove it from the required packages (Project / Project Inspector).

If you need the LCL in the library, you'll need to recompile it with -fPIC. Double click the required package in the Project Inspector, clicok on options / Compiler Options - Other / add -fPIC to Custom options.

Ludo

Reply by email

Antonio Fortuny
to Ludo Brands

In fact I don't really need LCL package but lclproc unit because my project needs UTF-8 functions. Anyway, when I disable the LCL package and include the libtary containing the lclproc unit I get the same error but, this time with a unit of my project.

I have another project similar to the one having the problem (also a shared library) and this one compiles without problem ! Please don't ask me to find differences beacause the problematic project is an evotution (ansi-->UTF-8) with almost all code changed except functions signatures.

I have also downloaded and installed lazarus build 0.9.31 as of 12/05/2011 with the corresponding FPP: same bad result

Antonio

Le 05/12/2011 12:08, Ludo Brands a ?crit :

Show quoted text 23 lines
> What's wrong ? > /usr/bin/ld: /usr/lib64/lazarus/lcl/units/x86_64-linux/lclproc.o: > relocation R_X86_64_32S against `.data' can not be used when making a > shared object; recompile with -fPIC > /usr/lib64/lazarus/lcl/units/x86_64-linux/lclproc.o: could not read > symbols: Bad value > If you don't uses the LCL in the library, remove it from the required packages (Project / Project Inspector). If you need the LCL in the library, you'll need to recompile it with -fPIC. Double click the required package in the Project Inspector, clicok on options / Compiler Options - Other / add -fPIC to Custom options. Ludo -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Ludo Brands
to Antonio Fortuny
Show quoted text 6 lines
In fact I don't really need LCL package but lclproc unit because my project needs UTF-8 functions. Anyway, when I disable the LCL package and include the libtary containing the lclproc unit I get the same error but, this time with a unit of my project.

Same solution, rebuild your project with -fPIC (or -Cg which is the same). On x86_64 the RTL is already build with PIC by default.

Ludo

Reply by email

Antonio Fortuny
to Ludo Brands

Done.
Same error
This time I've included in search path:
$(LazarusDir)/lcl/units/$(TargetCPU)-$(TargetOS) --> lclproc $(LazarusDir)/components/lazutils/lib/$(TargetCPU)-$(TargetOS) --> FileUtils (called by lclproc)
and excluded LCL package
Errors:
/usr/bin/ld: /usr/lib64/lazarus/lcl/units/x86_64-linux/lclproc.o: relocation R_X86_64_32S against `.data' can not be used when making a shared object; recompile with -fPIC
/usr/lib64/lazarus/lcl/units/x86_64-linux/lclproc.o: could not read symbols: Bad value
SitaUdfLib.lpr(11) Error: Error while linking

Antonio.

Le 05/12/2011 15:11, Ludo Brands a ?crit :

Show quoted text 19 lines
> In fact I don't really need LCL package but lclproc unit because my > project needs UTF-8 functions. Anyway, when I disable the LCL package > and include the libtary containing the lclproc unit I get the > same error > but, this time with a unit of my project. > Same solution, rebuild your project with -fPIC (or -Cg which is the same). On x86_64 the RTL is already build with PIC by default. Ludo -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Antonio Fortuny
to Antonio Fortuny: In fact I don't really need LCL package but lclproc unit because my project needs UTF-8…

I have another very strange behaviour:
just after compilation ends, a unit window editor is open by Lazarus. The name of this unit is exactly the same name of the folder containing the project sources and some funny characters are displayed as if the folder itself was displayed as a file !!

I have completely made a new project from scratch and recode all properties for the project. This behaviour does not appear with other projects (including shared libraries) which compile and execute OK in the LINUX system.

Any track to explore ?

Antonio.

Reply by email

Mattias Gaertner
to Antonio Fortuny: Done. Same error This time I've included in search path:…

Antonio Fortuny hat am 5. Dezember 2011 um 15:27
geschrieben:

Show quoted text 7 lines
Done. Same error This time I've included in search path: $(LazarusDir)/lcl/units/$(TargetCPU)-$(TargetOS)? --> lclproc $(LazarusDir)/components/lazutils/lib/$(TargetCPU)-$(TargetOS)? ? ? ? --> FileUtils (called by lclproc) and excluded LCL package?

Or: Simply use package LCLBase.?
?
?

Show quoted text 7 lines
Errors: /usr/bin/ld: /usr/lib64/lazarus/lcl/units/x86_64-linux/lclproc.o: relocation R_X86_64_32S against `.data' can not be used when making a shared object; recompile with -fPIC /usr/lib64/lazarus/lcl/units/x86_64-linux/lclproc.o: could not read symbols: Bad value SitaUdfLib.lpr(11) Error: Error while linking?

You must recompile all units with PIC support.
?
Mattias
?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20111205/c760db57/attachment.html>

Reply by email

Mattias Gaertner
to Antonio Fortuny: I have another very strange behaviour: just after compilation ends, a unit window editor…

Antonio Fortuny hat am 5. Dezember 2011 um 15:34
geschrieben:

Show quoted text 5 lines
I have another very strange behaviour: just after compilation ends, a unit window editor is open by Lazarus. The name of this unit is exactly the same name of the folder containing the project sources and some funny characters are displayed as if the folder itself was displayed as a file !!?

Such a bug was fixed some weeks ago.
Are you sure, you are using a recent 0.9.31??
?
Any how: When that happens: Do not save! Otherwise the IDE will corrupt the directory.?
?
Mattias
?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20111205/d44b83be/attachment.html>

Reply by email

Antonio Fortuny
to Antonio Fortuny

Hum, sorry guys, I sang the song a little bit too early. Out of Lazarus and reboot (OpenSuse 11.4, KDE)
Restart Lazarus IDE:
After
- remove package LCL,
- add package LazUtils,
- replaceing all lclproc occurences by lazutf8
- -fPIC in project properties, other

got same errors this time with lazutf8 and the dummu unit dosplayed with nasty error lines from output window.

Snif, snif !

Antonio.

Reply by email

Antonio Fortuny
to Antonio Fortuny: In fact I don't really need LCL package but lclproc unit because my project needs UTF-8…

Hi guys.

Last song:
- remove LazUtils package,
- copy original unit lazutf8 as a new project unit "utf8"
- change references lazutf8 to utf8 in all units
- include -fPIC directive in props, other (without it compilation is definitely bad)

Compilation and build both OK.
No more error of the dummy unit display.

If you have any explanation I would like to understand. If you need to do some other tests call me.

Antonio.

Reply by email

Felipe Monteiro de Carvalho
to Antonio Fortuny: Hum, sorry guys, I sang the song a little bit too early. Out of Lazarus and reboot…
Antonio Fortuny wrote
got same errors this time with lazutf8 and the dummu unit dosplayed with nasty error lines from output window.

Options are not automatically applied from the main project into packages that it uses. Open the package LazUtils then open the Project Options of the package LazUtils and add -fPIC there too.

Felipe Monteiro de Carvalho

Reply by email

Antonio Fortuny
to Felipe Monteiro de Carvalho

Ok Felipe, I'll try this tomorrow in the morning

Antonio.

Le 05/12/2011 16:58, Felipe Monteiro de Carvalho a ?crit :

Show quoted text 9 lines
On Mon, Dec 5, 2011 at 4:11 PM, Antonio Fortuny wrote: > got same errors this time with lazutf8 and the dummu unit dosplayed with > nasty error lines from output window. Options are not automatically applied from the main project into packages that it uses. Open the package LazUtils then open the Project Options of the package LazUtils and add -fPIC there too.

Reply by email

Antonio Fortuny
to Felipe Monteiro de Carvalho: On Mon, Dec 5, 2011 at 4:11 PM, Antonio Fortuny Options are not automatically applied…

No way !

- Compiled (build) Lazutils package
- rebuilt IDE
same two errors.
Going back to local copy of LazUTF9 unit

Antonio

Le 05/12/2011 16:58, Felipe Monteiro de Carvalho a ?crit :

Show quoted text 9 lines
On Mon, Dec 5, 2011 at 4:11 PM, Antonio Fortuny wrote: > got same errors this time with lazutf8 and the dummu unit dosplayed with > nasty error lines from output window. Options are not automatically applied from the main project into packages that it uses. Open the package LazUtils then open the Project Options of the package LazUtils and add -fPIC there too.

Reply by email

Ludo Brands
to Antonio Fortuny
Show quoted text 7 lines
No way ! - Compiled (build) Lazutils package - rebuilt IDE same two errors. Going back to local copy of LazUTF9 unit

If you rebuild the IDE without -fPIC in the Configure "Build Lazarus" Options then you effectively rebuild Lazutils without -fPIC... Why rebuild the IDE?

Ludo

Reply by email

Antonio Fortuny
to Ludo Brands

Le 06/12/2011 13:44, Ludo Brands a ?crit :

If you rebuild the IDE without -fPIC in the Configure "Build Lazarus" Options then you effectively rebuild Lazutils without -fPIC... Why rebuild the IDE?

New test:
no IDE rebuild since the one this morning
rebuild package Lazutils with -fPIC in project options - other package LazUtils itself not included in required packages but instead add include search path
$(LazarusDir)/components/lazutils/lib/$(TargetCPU)-$(TargetOS) in the project options for fincding lazutf8.o and ppu

On first compile, need a dependency: lazaruspackageintf

Added $(LazarusDir)/packager/units/$(TargetCPU)-$(TargetOS) in compile project options-paths

Same errors, this time the problem is linked to lazaruspackageintf.o

Second run:
- remove search paths for the project
- add required package LazUtils
still the same errors.

Antonio.

Reply by email

Mattias Gaertner
to Antonio Fortuny

Antonio Fortuny hat am 6. Dezember 2011 um 14:21
geschrieben:

Show quoted text 8 lines
Le 06/12/2011 13:44, Ludo Brands a ?crit : > If you rebuild the IDE without -fPIC in the Configure "Build Lazarus" > Options then you effectively rebuild Lazutils without -fPIC... > Why rebuild the IDE? > New test: no IDE rebuild since the one this morning rebuild package Lazutils with -fPIC in project options?

What means "in project options"?
Lazutils is built with its package options, not the project options.? ?
?

- other> package LazUtils itself not included in required packages but instead

add include search path $(LazarusDir)/components/lazutils/lib/$(TargetCPU)-$(TargetOS) in the project options for fincding lazutf8.o and ppu?

That's what the dependency does.
Plus: the IDE auto recompiles the package if needed.? ?
?

> On first compile, need a dependency: lazaruspackageintf Added $(LazarusDir)/packager/units/$(TargetCPU)-$(TargetOS) in compile project options-paths?

Sigh.
I'm working on a tool to help fixing such things properly.? ?
?

Show quoted text 7 lines
Same errors, this time the problem is linked to lazaruspackageintf.o Second run: - remove search paths for the project - add required package LazUtils still the same errors.

?
Mattias
?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20111206/115e8a10/attachment.html>

Reply by email

Felipe Monteiro de Carvalho
to Antonio Fortuny: Le 06/12/2011 13:44, Ludo Brands a ?crit : New test: no IDE rebuild since the one this…
Antonio Fortuny wrote
package LazUtils itself not included in required packages but instead add include search path

Don't do that

Second run: - remove search paths for the project - add required package LazUtils still the same errors.

LazUtils requires the package FCL. You need to add this option to the package FCL too.

And are you sure that you are using the project options dialog of the package? Maybe some screenshots would help.

Felipe Monteiro de Carvalho

Reply by email

Antonio Fortuny
to Mattias Gaertner: Antonio Fortuny hat am 6. Dezember 2011 um 14:21 geschrieben: What means "in project…

Le 06/12/2011 14:36, Mattias Gaertner a ?crit :

Show quoted text 16 lines
Antonio Fortuny hat am 6. Dezember 2011 um 14:21 geschrieben: > Le 06/12/2011 13:44, Ludo Brands a ?crit : > > If you rebuild the IDE without -fPIC in the Configure "Build Lazarus" > > Options then you effectively rebuild Lazutils without -fPIC... > > Why rebuild the IDE? > > > New test: > no IDE rebuild since the one this morning > rebuild package Lazutils with -fPIC in project options What means "in project options"? Lazutils is built with its package options, not the project options.

You're right: I meant in package options not project !! and that's what I've done.

Show quoted text 10 lines
- other> package LazUtils itself not included in required packages but instead > add include search path > $(LazarusDir)/components/lazutils/lib/$(TargetCPU)-$(TargetOS) in the > project options for fincding lazutf8.o and ppu That's what the dependency does. Plus: the IDE auto recompiles the package if needed.

Yes: on build of my project, LazUtils is rebuild too: "Compiling lazutils.pas" and all the its units
...
"Compiling package LazUtils 1.0" completed

Show quoted text 25 lines
> > On first compile, need a dependency: lazaruspackageintf > > Added $(LazarusDir)/packager/units/$(TargetCPU)-$(TargetOS) > in compile project options-paths Sigh. I'm working on a tool to help fixing such things properly. > > Same errors, this time the problem is linked to lazaruspackageintf.o > > Second run: > - remove search paths for the project > - add required package LazUtils > still the same errors. Mattias -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Mattias Gaertner
to Antonio Fortuny

Antonio Fortuny hat am 6. Dezember 2011 um 14:57
geschrieben:

Show quoted text 18 lines
Le 06/12/2011 14:36, Mattias Gaertner a ?crit : > > Antonio Fortuny hat am 6. Dezember 2011 um > 14:21 geschrieben: > >? > Le 06/12/2011 13:44, Ludo Brands a ?crit : >? > > If you rebuild the IDE without -fPIC in the Configure "Build Lazarus" >? > > Options then you effectively rebuild Lazutils without -fPIC... >? > > Why rebuild the IDE? >? > > >? > New test: >? > no IDE rebuild since the one this morning >? > rebuild package Lazutils with -fPIC in project options > > What means "in project options"? > > Lazutils is built with its package options, not the project options. You're right: I meant in package options not project !!?

In "Usage" options or in "Compiler options" of the package? It should be in the compiler options.?
?
Mattias
?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20111206/bb91bf10/attachment-0001.html>

Reply by email

Antonio Fortuny
to Felipe Monteiro de Carvalho: On Tue, Dec 6, 2011 at 2:21 PM, Antonio Fortuny Don't do that LazUtils requires the…

Le 06/12/2011 14:38, Felipe Monteiro de Carvalho a ?crit :

Show quoted text 5 lines
On Tue, Dec 6, 2011 at 2:21 PM, Antonio Fortuny wrote: > package LazUtils itself not included in required packages but instead add > include search path Don't do that

OK

Show quoted text 11 lines
> Second run: > - remove search paths for the project > - add required package LazUtils > still the same errors. LazUtils requires the package FCL. You need to add this option to the package FCL too. And are you sure that you are using the project options dialog of the package? Maybe some screenshots would help.

see image at http://imageshack.us/photo/my-images/341/30757138.png/ all other options unchanged

second image : http://imageshack.us/photo/my-images/841/18653445.png/

used "Recompile clean"
Same for package LazUtils and my project
and miracle: IT WORKS. Thanks to you all.

BUT question: why those differences with WIN versions ? Does this mean that I'm dependent on those manipulations when shared libraries are concerned ?
I have another GUI project and it compiles and executes OK so far. Last but not least:
What about the second problem: a new file is open in the editor only when these kind of error araises but non when i introduce some errors that the compiler detects

Anyway, thanks to all for taking care of my problem.

Antonio.

Reply by email

Mattias Gaertner
to Antonio Fortuny
Show quoted text 30 lines
Le 06/12/2011 14:38, Felipe Monteiro de Carvalho a ?crit : > On Tue, Dec 6, 2011 at 2:21 PM, Antonio Fortuny > wrote: >> package LazUtils itself not included in required packages but instead add >> include search path > Don't do that OK >> Second run: >> - remove search paths for the project >> - add required package LazUtils >> still the same errors. > LazUtils requires the package FCL. You need to add this option to the > package FCL too. > > And are you sure that you are using the project options dialog of the > package? Maybe some screenshots would help. > > see image at http://imageshack.us/photo/my-images/341/30757138.png/ all other options unchanged second image : http://imageshack.us/photo/my-images/841/18653445.png/ used "Recompile clean" Same for package LazUtils and my project and miracle: IT WORKS. Thanks to you all. BUT question: why those differences with WIN versions ?

http://www.freepascal.org/docs-html/prog/progsu99.html

Does this mean that I'm dependent on those manipulations when shared libraries are concerned ?

Yes.

Show quoted text 5 lines
I have another GUI project and it compiles and executes OK so far. Last but not least: What about the second problem: a new file is open in the editor only when these kind of error araises but non when i introduce some errors that the compiler detects

Can you give an example?

Mattias

Reply by email

Antonio Fortuny
to Mattias Gaertner

Le 07/12/2011 01:10, Mattias Gaertner a ?crit :

Show quoted text 33 lines
On Tue, 06 Dec 2011 16:13:24 +0100 Antonio Fortuny wrote: > > Le 06/12/2011 14:38, Felipe Monteiro de Carvalho a ??crit : >> On Tue, Dec 6, 2011 at 2:21 PM, Antonio Fortuny >> wrote: >>> package LazUtils itself not included in required packages but instead add >>> include search path >> Don't do that > OK >>> Second run: >>> - remove search paths for the project >>> - add required package LazUtils >>> still the same errors. >> LazUtils requires the package FCL. You need to add this option to the >> package FCL too. >> >> And are you sure that you are using the project options dialog of the >> package? Maybe some screenshots would help. >> >> > see image at http://imageshack.us/photo/my-images/341/30757138.png/ > all other options unchanged > > second image : http://imageshack.us/photo/my-images/841/18653445.png/ > > used "Recompile clean" > Same for package LazUtils and my project > and miracle: IT WORKS. Thanks to you all. > > BUT question: why those differences with WIN versions ? http://www.freepascal.org/docs-html/prog/progsu99.html

OK, got it.

Show quoted text 5 lines
> Does this mean that I'm dependent on those manipulations when shared > libraries are concerned ? Yes.

:'(

Show quoted text 6 lines
> I have another GUI project and it compiles and executes OK so far. > Last but not least: > What about the second problem: a new file is open in the editor only > when these kind of error araises but non when i introduce some errors > that the compiler detects Can you give an example?

See attached project
Leave the -fPIC and everything goes well.
Remove it : the well known error message is displayed and the IDE editor becomes crazy:
error are listed in a editor's created edit page whose name is the project last folder name !
As far as the project is not saved before closing the strange unit, no problem otherwise beware of your code !! :-$

Antonio.

Show quoted text 8 lines
Mattias -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
A non-text attachment was scrubbed...
Name: udftest.7z
Type: application/octet-stream
Size: 1944 bytes
Desc: not available
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20111207/dbbc6409/attachment.obj>

Reply by email