Sign in Join

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

Mailing lists / lazarus / 2014-01

Linker errors

9 messages · 3 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.

In a TDaemon project running nicely since beginning of last year, I have added a TTimer to execute periodically an internal control procedure. I then added a TTimer component, the unit "ExtCtrls" in the uses clause, the code of the TTimer event, compile and ... nothing: linker fails with a lot of errors like these:

/usr/bin/ld: warning: /home/sources/compiled/link.res contains output sections; did you forget -T?
/home/sita/.lazarus/lib/LCLBase/units/x86_64-linux/wsimglist.o: In function `WSIMGLIST_REGISTERCUSTOMIMAGELIST':
wsimglist.pp:(.text+0x99f): undefined reference to `WSRegisterCustomImageList'
/home/sita/.lazarus/lib/LCLBase/units/x86_64-linux/wsmenus.o: In function `WSMENUS_REGISTERMENUITEM':
wsmenus.pp:(.text+0x167): undefined reference to `WSRegisterMenuItem' /home/sita/.lazarus/lib/LCLBase/units/x86_64-linux/wsmenus.o: In function `WSMENUS_REGISTERMENU':
wsmenus.pp:(.text+0x187): undefined reference to `WSRegisterMenu' /home/sita/.lazarus/lib/LCLBase/units/x86_64-linux/wsmenus.o: In function `WSMENUS_REGISTERMAINMENU':
wsmenus.pp:(.text+0x1a7): undefined reference to `WSRegisterMainMenu'

As you can read the linker references a lot of units located into the local user home directory. I wonder why.
The IDE has been rebuilt without problems

Installation is a Linux Opensuse 12.2 x86_64, Lazarus 1.0.12, fpc 2.6.2 installed out of rpm's.

When I embed all TTimer references into conditional code, no more problem. The daemon compiles and runs as before.
BTW, the same project compiles and runs under Win32 with the TTimer (Lazarus 1.0.12 and FPC 2.2.6, same external componets). I think to a workaround solution based on another thread sleeping for the required period of timet this adds some extra useless overhead

Any explanation ?

Antonio;

---
Ce courrier ?lectronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com

Reply by email

Antonio Fortuny
to Antonio Fortuny

I forgot to be more precise:
embedding the same TDaemon code into a normal application using a front end display the code compiles without problems
Of courese in this case, the daemon register procedures are conditionally surrounded by IFDEFs and are not compiled under the gui application.

Antonio.

---
Ce courrier ?lectronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com

Reply by email

leledumbo
to Antonio Fortuny: Hi Folks. In a TDaemon project running nicely since beginning of last year, I have added…

Whenever you have `undefined reference to WSRegisterXXX`, you're missing Interfaces unit in the .lpr. Sometimes package that registers custom components (such as RichMemo) in its package main file is also required to be added to .lpr's uses clause.

View this message in context: http://free-pascal-lazarus.989080.n3.nabble.com/Lazarus-Linker-errors-tp4035393p4035395.html Sent from the Free Pascal - Lazarus mailing list .

Reply by email

Antonio Fortuny
to leledumbo

Le 15/01/2014 10:08, leledumbo a ?crit :

Whenever you have `undefined reference to WSRegisterXXX`, you're missing Interfaces unit in the .lpr. Sometimes package that registers custom components (such as RichMemo) in its package main file is also required to be added to .lpr's uses clause.

Great, it works !! 8-) Thanks a lot and, hum, I look so stupid.:-[ Maybe one more question: is it true if I assume that when using any cocntrol from the "ExtCtrls" unit, the Interfaces unit is required even when the components used are not visible ?

Antonio.

Show quoted text 12 lines
-- View this message in context: http://free-pascal-lazarus.989080.n3.nabble.com/Lazarus-Linker-errors-tp4035393p4035395.html Sent from the Free Pascal - Lazarus mailing list . -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Sita Software *Antonio Fortuny* Senior Software engineer 220, avenue de la Libert? L-4602 Niederkorn Tel.: +352 58 00 93 - 93 www.sitasoftware.lu <http://www.sitasoftware.lu> Your IT Partner --- Ce courrier ?lectronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20140115/484fcb44/attachment.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: hjfjaghd.jpg Type: image/jpeg Size: 2306 bytes Desc: not available URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20140115/484fcb44/attachment.jpg> -------------- next part -------------- A non-text attachment was scrubbed... Name: fjdeadji.jpg Type: image/jpeg Size: 921 bytes Desc: not available URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20140115/484fcb44/attachment-0001.jpg>

Reply by email

Michael Van Canneyt
to Antonio Fortuny
Antonio Fortuny wrote 10 lines
Le 15/01/2014 10:08, leledumbo a ?crit : > Whenever you have `undefined reference to WSRegisterXXX`, you're missing > Interfaces unit in the .lpr. Sometimes package that registers custom > components (such as RichMemo) in its package main file is also required to > be added to .lpr's uses clause. Great, it works !! 8-) Thanks a lot and, hum, I look so stupid.:-[ Maybe one more question: is it true if I assume that when using any cocntrol from the "ExtCtrls" unit, the Interfaces unit is required even when the components used are not visible ?

Yes.

But you should not use an LCL timer.
It will not work anyway in a daemon app since it does not use the LCL application event loop. (unless the lazarus team used some black magic to implement it)

Michael.

Reply by email

Antonio Fortuny
to Michael Van Canneyt

Le 15/01/2014 10:26, Michael Van Canneyt a ?crit :

Show quoted text 18 lines
On Wed, 15 Jan 2014, Antonio Fortuny wrote: > > Le 15/01/2014 10:08, leledumbo a ?crit : >> Whenever you have `undefined reference to WSRegisterXXX`, you're >> missing >> Interfaces unit in the .lpr. Sometimes package that registers custom >> components (such as RichMemo) in its package main file is also >> required to >> be added to .lpr's uses clause. > Great, it works !! 8-) Thanks a lot and, hum, I look so stupid.:-[ > Maybe one more question: is it true if I assume that when using any > cocntrol from the "ExtCtrls" unit, the Interfaces unit is required even > when the components used are not visible ? Yes.

Sounds clear.

But you should not use an LCL timer. It will not work anyway in a daemon app since it does not use the LCL application event loop. (unless the lazarus team used some black magic to implement it)

I don't know whether the Lazarus team used some magic or not but it works on WIn32 with the service. I'll port it now on Linux and I'll report the results.

Antonio.

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

---
Ce courrier ?lectronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com

Reply by email

leledumbo
to Antonio Fortuny: Le 15/01/2014 10:08, leledumbo a ?crit : Great, it works !! 8-) Thanks a lot and, hum, I…
Maybe one more question: is it true if I assume that when using any

cocntrol from the "ExtCtrls" unit, the Interfaces unit is required even when the components used are not visible ?

Yes. Interfaces unit is the unit that links LCL with the chosen GUI library backend.

View this message in context: http://free-pascal-lazarus.989080.n3.nabble.com/Lazarus-Linker-errors-tp4035393p4035407.html Sent from the Free Pascal - Lazarus mailing list .

Reply by email

Antonio Fortuny
to Michael Van Canneyt: Yes. But you should not use an LCL timer. It will not work anyway in a daemon app since…

Le 15/01/2014 10:26, Michael Van Canneyt a ?crit :

Show quoted text 22 lines
On Wed, 15 Jan 2014, Antonio Fortuny wrote: > > Le 15/01/2014 10:08, leledumbo a ?crit : >> Whenever you have `undefined reference to WSRegisterXXX`, you're >> missing >> Interfaces unit in the .lpr. Sometimes package that registers custom >> components (such as RichMemo) in its package main file is also >> required to >> be added to .lpr's uses clause. > Great, it works !! 8-) Thanks a lot and, hum, I look so stupid.:-[ > Maybe one more question: is it true if I assume that when using any > cocntrol from the "ExtCtrls" unit, the Interfaces unit is required even > when the components used are not visible ? Yes. But you should not use an LCL timer. It will not work anyway in a daemon app since it does not use the LCL application event loop. (unless the lazarus team used some black magic to implement it)

Obviously, Lazarus team magic works on Win32 but not on Linux. When starting the service I get the message "(IpService:22520): Gtk-WARNING **: cannot open display:" into the messages file and the service is killed.
When I launch the service by hand (MyProgram -r ), this time it runs (the console seems enough for GTK) but, you are rigth the timer event does not fire. I'm a little bit disappointed.
Do you have, by any chance, some trick to get around this ?

Antonio.

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

---
Ce courrier ?lectronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com

Reply by email

Antonio Fortuny
to Michael Van Canneyt: Yes. But you should not use an LCL timer. It will not work anyway in a daemon app since…

Le 15/01/2014 10:26, Michael Van Canneyt a ?crit :

Show quoted text 22 lines
On Wed, 15 Jan 2014, Antonio Fortuny wrote: > > Le 15/01/2014 10:08, leledumbo a ?crit : >> Whenever you have `undefined reference to WSRegisterXXX`, you're >> missing >> Interfaces unit in the .lpr. Sometimes package that registers custom >> components (such as RichMemo) in its package main file is also >> required to >> be added to .lpr's uses clause. > Great, it works !! 8-) Thanks a lot and, hum, I look so stupid.:-[ > Maybe one more question: is it true if I assume that when using any > cocntrol from the "ExtCtrls" unit, the Interfaces unit is required even > when the components used are not visible ? Yes. But you should not use an LCL timer. It will not work anyway in a daemon app since it does not use the LCL application event loop. (unless the lazarus team used some black magic to implement it)

I guess that TFPTimer should do it (please be clement with me and don't think I'm looking stupid again)

Antonio.

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

---
Ce courrier ?lectronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active. http://www.avast.com

Reply by email