Welcome, Guest
Username: Password: Remember me
CodeTyphon Cross-Build Development, discussions and problems
  • Page:
  • 1

TOPIC:

Cross Compile linker error when using cthreads 11 years 10 months ago #1934

  • tony
  • tony's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 12
  • Thank you received: 1
Hi,
I am using the win32 version of Code Typhon and have the linux cross compiler setup and everything works
except when I try to compile a console app that uses threads. The console app has
cthreads and cmem in the uses and it will not run on ubuntu server unless I have cthreads working.

It builds and then proceeds to link and simply says "Linker Error"
I have attached a file with the message output verbosity set to all.

I have all the linux libs (gcc etc) copied to the win32 box

Anyone have any ideas on how to get cthreads and cmem working with the cross compiler?

Please Log in or Create an account to join the conversation.

Re: Cross Compile linker error when using cthreads 11 years 10 months ago #1935

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
  • Posts: 4506
  • Thank you received: 1100
Sir
can you post the fist 5 lines of your project?
Did you have Administrator privileges in your PC?
PilotLogic Architect and Core Programmer

Please Log in or Create an account to join the conversation.

Last edit: by Sternas Stefanos.

Re: Cross Compile linker error when using cthreads 11 years 10 months ago #1936

  • tony
  • tony's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 12
  • Thank you received: 1
Here is a example program that produces the same error:
(I do have admin rights on my PC, but I was not running the IDE as a admin at the time)
EDIT:
Just tried running the IDE as admin and it made no difference.

oh, forgot to add adding cmem to the uses also causes the linker to fail. As long as I don't use cthreads or cmem I can compile everything else with the cross compiler.
I am running on windows 7 64bit by the way.

program project1;

{$mode objfpc}{$H+}

uses cthreads,sysutils;


{ you can add units after this }//;

begin
writeln('dfdfdfdf');

end.

Please Log in or Create an account to join the conversation.

Last edit: by tony.

Re: Cross Compile linker error when using cthreads 11 years 10 months ago #1944

  • tony
  • tony's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 12
  • Thank you received: 1
Success!!

I got it working.

For whatever reason if I had any paths in the project options for the libs it would not show the linker errors, so I removed all the lib paths I added and then the linker showed the actual errors and what libs I was missing.
The other key was to actually create the same path structure as on the target system for the libs.

So I now have the following on drive C:
C:\lib which contains:
crtbegin.o,crtbeginS.o, crtbeginT.o,crtend.o,crtendS.o, crti.o,crtn.o,ld-linux.so.2, libc.so.6,
libdl.so.2,libgcc.a,libpthread.so, libsqlite3.so,

c:\lib\i386-linux-gnu (containos a single file libpthread.so.0)
c:\usr\lib\i386-linux-gnu (contains a single file libpthread_nonshared.a)

Hope this helps someone else out. NOTE: this is to compile a console app/daemon, for a GUI you will need more libs for the widget set you are using, but if you follow this it should cross compile fine.

This is a huge deal as using Linux from a VM is fairly slow when compared to the cross compiler which is lightning fast.

Please Log in or Create an account to join the conversation.

Re: Cross Compile linker error when using cthreads 11 years 10 months ago #1945

  • tony
  • tony's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 12
  • Thank you received: 1
I just wanted to say thanks to the Code Typhon guys, your distribution of Lazarus is pure
genius and a real time saver. Keep up the great work, looking forward to the next version.
The following user(s) said Thank You: Konstantinos Papadoulas

Please Log in or Create an account to join the conversation.

Re: Cross Compile linker error when using cthreads 11 years 10 months ago #1951

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
  • Posts: 4506
  • Thank you received: 1100
Thanks Sir
we prepare CT for
Cross build lab tests on Linux, FreeBSD and Solaris
PilotLogic Architect and Core Programmer
The following user(s) said Thank You: Konstantinos Papadoulas

Please Log in or Create an account to join the conversation.

Last edit: by Sternas Stefanos.
  • Page:
  • 1