Lazarus

Free Pascal => General => Topic started by: Paul Breneman on October 31, 2014, 01:38:53 am

Title: Small virtual machine to cross compile FPC
Post by: Paul Breneman on October 31, 2014, 01:38:53 am
I've spent a bit of time during the past 7 years trying to figure out how to simplify things by avoiding cross-compiling.  This page has many of the details:
  http://turbocontrol.com/monitor.htm

I think there is a way to simplify cross-compiling.  Levinux is a small (~20 MB) QEMU download for x86 PCs (Windows, OS X, Linux) that provides a small Tiny Core Linux VM.  I'd like to see something similar but with all the files and tools needed to pull the latest source code and cross-compile FPC (also with Debian instead of Tiny Core?).
  http://mikelev.in/ux/

It seems to me that such a small VM should allow a nice standard method that will make it easy to test and see things work.

I look forward to your thoughts and comments!
Title: Re: Small virtual machine to cross compile FPC
Post by: Paul Breneman on October 31, 2014, 03:29:14 pm
I'm not suggesting a single VM for multiple uses.

How hard would it be to make a small VM (~100 MB with Debian?)  that will run on a x86 PC and download FPC and Lazarus source (trunk) and configure Lazarus for Android development?

I think having a small VM (that doesn't depend on anything on the user's PC) that can easily demonstrate things would be very nice.
Title: Re: Small virtual machine to cross compile FPC
Post by: BigChimp on November 03, 2014, 03:44:29 pm
Go ahead. I just wonder how small small will be once you start including X etc. OTOH, bandwidth is fairly cheap and having everything (including FPC, fpc sources, cross compiling tools and libs, Lazarus) set up ready to go is a huge timesaver.

BTW: something like this has been done before; there is/was a Virtual Machine image or iso file with FPC Laz and android stuff pre-set up. Posts in the forum and IIRC iso image on Sourceforge somewhere...
Title: Re: Small virtual machine to cross compile FPC
Post by: BigChimp on November 05, 2014, 09:47:50 am
FYI: OP cross-posted on fpc-devel mailing list; see http://www.mail-archive.com/fpc-devel@lists.freepascal.org/msg31828.html etc
Title: Re: Small virtual machine to cross compile FPC
Post by: Paul Breneman on November 11, 2014, 05:56:04 pm
I did cross-post this on the fpc-devel mailing list.  Since this forum section is still fairly new (and the mailing list has been around for ages) I'm confused if I should just post on one or the other.  Can anyone help me?

I don't know where to find existing FPC virtual machines so if anyone can provide a link I'd appreciate it.  I've used VMWare for decades (and still do), so anything existing would be very interesting.

The Levinux is interesting as it should work on about any x86 machine without requiring any specific VM host program to be already installed.
Title: Re: Small virtual machine to cross compile FPC
Post by: BigChimp on November 11, 2014, 06:04:31 pm
I did cross-post this on the fpc-devel mailing list.  Since this forum section is still fairly new (and the mailing list has been around for ages) I'm confused if I should just post on one or the other.  Can anyone help me?
Well, I'd suggest you choose one and not cross post until after you haven't had any response for a while.
Or at least mention that you're cross posting so people can look for all responses/discussions.

I don't know where to find existing FPC virtual machines so if anyone can provide a link I'd appreciate it.  I've used VMWare for decades (and still do), so anything existing would be very interesting.
Did you read my post above?

The Levinux is interesting as it should work on about any x86 machine without requiring any specific VM host program to be already installed.
Well, it apparently uses qemu.... nothing wrong with that but VirtualBox, VMWare, HyperV/Virtual PC etc are easier to work with/more performant...
Title: Re: Small virtual machine to cross compile FPC
Post by: Paul Breneman on November 11, 2014, 06:22:22 pm
Thanks for the reply and suggestions.

Yes, Levinux uses qemu, but it doesn't have to already be installed (unlike the other vm host options you mentioned).
Title: Re: Small virtual machine to cross compile FPC
Post by: sam707 on November 14, 2014, 01:20:00 am
I use Oracle VirtualBox which is FREE software.

I compiled it with TDM-GCC under windows 7, it is a modified GCC version that produces statically linked executables but you can just download and install the binaries and plugins of VirtualBox for your platform

after what I have set up an Ubuntu and a DOS machine with respectivelly 2 dynamically allocated emulated drives (meaning they dont crunch big part of my REAL hard drive)

on the Ubuntu I got Lazarus installed easily (they got a version in the ubuntu repository) and then I installed the Laz version I wanted just by following tutorials on ubuntu

on the DOS machine, I Formated 32bits FAT, then installed FreeDOS, Turbo pascal 7.01 (1992), Turbo C++ 3.00 (1992), and Free Pascal Go32V2 with NO EFFORT

I use this last one (DOS Machine) to make different tests around TurboVision and FreeVision... It's Great!!! OMG GREAT!!!
Title: Re: Small virtual machine to cross compile FPC
Post by: sam707 on November 14, 2014, 01:21:01 am
https://www.virtualbox.org (https://www.virtualbox.org)

SIMPLY AWESOME!!! good bye vmware, expensive crap  :D
Title: Re: Small virtual machine to cross compile FPC
Post by: Paul Breneman on November 14, 2014, 05:47:30 pm
Thanks sam707 for the feedback!   :)

I still use Turbo Pascal on embedded equipment so what you wrote about your DOS VM is very interesting.  I'm trying to get FreeVision working on Android so any help would be appreciated (search for "GNUroot" and see my TurboControl page, or see: http://forum.lazarus.freepascal.org/index.php/topic,23927.0.html (http://forum.lazarus.freepascal.org/index.php/topic,23927.0.html)).

I will look at VirtualBox more and try to find out how easily it and a vm can be installed.  Then need to see how to make a vm with fpcup and/or LazToApk or similar tools.
Title: Re: Small virtual machine to cross compile FPC
Post by: Fred vS on November 14, 2014, 07:04:25 pm
Quote
https://www.virtualbox.org

=> A other great feature of VirtualBox is the Host-Addins given for many os.

For example, if you want to install PC-BSD on VirtualBox, PC-BSD ask you if you want to install the Host-addins, out of the box...
Title: Re: Small virtual machine to cross compile FPC
Post by: sam707 on November 14, 2014, 10:23:47 pm
yea! this addin 'plugin' brings the mouse pointer to 'shareable' between host and embeded oses, PLUS shared Clipboard, shared folders upon configuration AND EVEN a shared virtual tunnel to the Internet/Intranet! (also making remote debuggig easy)

VirtualBox is truely a "MUST TO HAVE"
Title: Re: Small virtual machine to cross compile FPC
Post by: sam707 on November 14, 2014, 10:26:36 pm
oh I forgot, VirtualBox can also read/write Virtual HardDrives in around 7-8 formats, comprising VHD (Microsoft virtual HD chiped with win 7 and laters) and of course those from vmware :p

as I did not owe a DOS 32bits FAT defragmenter I built a VHD drive instead of VDI statndard of Virtualbox , then I can mount this drive on my win 7 (disk managmnt UI), defrag it, and drop it back to my DOS emulation :D
Title: Re: Small virtual machine to cross compile FPC
Post by: Paul Breneman on April 14, 2015, 05:56:44 am
I'm slowly making a little progress on this.  I recently built (on Ubuntu 14.04) a minimal i386 VM with QEMU with Debian (new version 8 release) Jessie (notes below).  Next I  hope to add fpcup (or something similar) to compile trunk to get  an embedded ARM compiler which I hope to use with Teensy https://www.sparkfun.com/products/12646 (https://www.sparkfun.com/products/12646).

Dowload debian-8.0.0-i386-netinst.iso (330 MB) and rename to debjes.iso
qemu-img create -f qcow2 debjes.img 2G

qemu-system-i386 -m 512 -hda debjes.img -cdrom debjes.iso -boot d
Networking worked without having to add other command line parameters!  I removed the 2 default software collections (near the end of the install).  The QEMU image file is 1.3 GB.

In the VM:
add sudo (I have instruction near the bottom of this page: http://controlpascal.com/picoscope.htm (http://controlpascal.com/picoscope.htm))
sudo apt-get clean
sudo dd if=/dev/zero of=/mytempfile
sudo rm -f /mytempfile
sudo halt

After this the new img file is 635 MB:
qemu-img convert -O qcow2 debjes.img debjesnew.img

Archive with 7z and the file is now 143 MB.  Not very big for a nice new Debian console VM.
Title: Re: Small virtual machine to cross compile FPC
Post by: Graeme on April 14, 2015, 10:44:24 am
I think having a small VM (that doesn't depend on anything on the user's PC) that can easily demonstrate things would be very nice.
+1
I've been doing that for around 6 years  now. I gave up on trying to setup complex cross-compiling, so instead built around 5 virtual machines that use the latest released FPC and has Git and Lazarus (sometimes MSEide too) setup so I can quickly pull the latest code and do a release compile and move on to the next VM.

Virtual Machines definitely changed the way developers work! [for the better]
Title: Re: Small virtual machine to cross compile FPC
Post by: zeljko on April 14, 2015, 11:01:31 am
Virtual Machines definitely changed the way developers work! [for the better]

Tempora mutantur nos et mutamur in illis :)
Title: Re: Small virtual machine to cross compile FPC
Post by: Paul Breneman on April 14, 2015, 09:19:02 pm
I'm making a little more progress on this.  I just built (on Ubuntu 12.04) a minimal i386 VM with QEMU with ReactOS 0.3.17 (notes below).  Next I  hope to add fpcup (or something similar) to compile trunk to get  an embedded ARM compiler which I hope to use with Teensy https://www.sparkfun.com/products/12646.

Download http://reactos.org/ (http://reactos.org/) ReactOS-0.3.17-REL-iso.zip (88MB) and unzip to get ReactOS-BootCD.iso (103MB)
qemu-img create -f qcow2 reactos0317.img 2G

qemu-system-i386 -m 512 -hda reactos0317.img -cdrom ReactOS-BootCD.iso -boot d
For the install I just pressed <Enter> for everything.  When it reboots (twice) don't hit any key so it won't boot from the CD.

Shut down ReactOS.  The QEMU image file is 280MB.

Restart with networking:
qemu-system-i386 -m 512 -hda reactos0317.img -boot c -net nic -net user

In the VM (I hope to edit this more ASAP):
Double-click on the Command Prompt and run ipconfig.
I installed Firefox 3.6 (28 and 37 had problems) with the ReactOS Application Manager and then downloaded https://github.com/LongDirtyAnimAlf/Reiniero-fpcup (https://github.com/LongDirtyAnimAlf/Reiniero-fpcup) fpcup.exe and ran it.  There are several problems that will hopefully be solved soon.

No, you don't want to use ReactOS for your desktop operating system, but it might be good enough to use for some specific things (like putting in a small VM).  I've had a bit of fun with ReactOS for some time: http://turbocontrol.com/reactos.htm (http://turbocontrol.com/reactos.htm)
Title: Re: Small virtual machine to cross compile FPC
Post by: Paul Breneman on May 24, 2015, 07:25:36 pm
Just updated my previous message for creating a small VM with the Debian version 8 (Jessie) release.
Title: Re: Small virtual machine to cross compile FPC
Post by: Paul Breneman on May 25, 2015, 08:21:04 pm
Maybe I need to mention the word embedded to get more feedback in this thread?   :)

When I'm in a forum or in a meeting with electrical engineers, how can I introduce them to Free Pascal?

I'd like to suggest they spend very little money and purchase Teensy:
https://www.sparkfun.com/products/12646 (https://www.sparkfun.com/products/12646)

Then I'd like to have a small VM they could download and with just a few steps compile and run a program on the Teensy.

http://www.turbocontrol.com/monitor.htm (http://www.turbocontrol.com/monitor.htm) is a simple introduction for non-embedded systems.  I'd like a simple introduction for embedded systems, and it seems a small VM with fpcup is the way to go.  Other suggestions?  Please understand that these folks are mostly electrical engineers and not full-time programmers.

*** a few notes pertaining to previous messages ***

On Ubuntu kvm can be substitued for quem-system-i386 and things work much faster.

I am interested in working on a console version of fpcup to use in a small linux console VM, and I'd also like to get the present fpcup (GUI) working in my ReactOS VM.
Title: Re: Small virtual machine to cross compile FPC
Post by: Paul Breneman on July 18, 2015, 06:21:08 pm
I've added a wiki page (http://wiki.freepascal.org/Small_Virtual_Machines (http://wiki.freepascal.org/Small_Virtual_Machines)) where I hope to collect this info.
Title: Re: Small virtual machine to cross compile FPC
Post by: eny on July 19, 2015, 12:28:08 am
I've added a wiki page (http://wiki.freepascal.org/Small_Virtual_Machines (http://wiki.freepascal.org/Small_Virtual_Machines)) where I hope to collect this info.
As it is (the wiki page) there is no relation with Lazarus whatsoever.
Better move it to some Linux wiki.
Title: Re: Small virtual machine to cross compile FPC
Post by: Paul Breneman on July 19, 2015, 03:45:16 am
This message thread is in the Free Pascal section of the forum and there is now a part of the Debian example that shows how to compile and run a Free Pascal program (no Lazarus needed).  Thanks for your comment but I think it is an example of how to make a simple virtual machine and compile a simple program on it. I hope we can expand such simple examples for Teensy and other platforms so they can be used to introduce Free Pascal to real engineers.
Title: Re: Small virtual machine to cross compile FPC
Post by: eny on July 19, 2015, 04:12:08 am
This message thread is in the Free Pascal section of the forum and there is now a part of the Debian example that shows how to compile and run a Free Pascal program (no Lazarus needed).
It does now after you updated the wiki!

ReactOS could do with an fpc example too.
Title: Re: Small virtual machine to cross compile FPC
Post by: Paul Breneman on July 19, 2015, 04:17:28 am
Sorry eny that I posted a message in this thread before I did more with the wiki page.  If you read all of the messages in this forum thread I think it would be clear what my intentions are.  That is the first wiki page this old person has ever done.  Hopefully (with help) I'll learn more.
Title: Re: Small virtual machine to cross compile FPC
Post by: eny on July 19, 2015, 11:50:11 am
It's an interesting topic nonetheless.
Title: Re: Small virtual machine to cross compile FPC
Post by: Paul Breneman on July 19, 2015, 09:10:22 pm
Thanks eny.  I hope to start publishing more things on the wiki and github (instead of my web pages) so it is easier for others to contribute.
Title: Re: Small virtual machine to cross compile FPC
Post by: jc99 on July 19, 2015, 11:14:51 pm
Thanks eny.  I hope to start publishing more things on the wiki and github (instead of my web pages) so it is easier for others to contribute.
8-)
So you got a Win, a miniLinux, then the only thing missing is a mini-virtual-osx, then we got all what we need.
Title: Re: Small virtual machine to cross compile FPC
Post by: Paul Breneman on July 20, 2015, 01:33:49 pm
Yeah, jc99, but there is nothing legally available for osx?
Title: Re: Small virtual machine to cross compile FPC
Post by: jc99 on July 20, 2015, 09:48:21 pm
To install OS x i found u.a.
http://www.sysprobs.com/guide-install-os-x-10-9-mavericks-on-vmware-workstation-with-windows-7-or-windows-8 (http://www.sysprobs.com/guide-install-os-x-10-9-mavericks-on-vmware-workstation-with-windows-7-or-windows-8)
As long as you buy a OS x you could use it in a vm
In some country the "only on Apple-Hardware" is nifty.
See Hackintosh
http://www.whyapple.us/how-to-install-niresh-mavericks-hackintosh-on-your-pc-110/ (http://www.whyapple.us/how-to-install-niresh-mavericks-hackintosh-on-your-pc-110/)
Title: Re: Small virtual machine to cross compile FPC
Post by: Paul Breneman on July 29, 2015, 01:01:47 am
I updated the Debian instructions for compiling a Free Pascal program today on the http://wiki.freepascal.org/Small_Virtual_Machines (http://wiki.freepascal.org/Small_Virtual_Machines) page.

I also added a wget for downloading fpcup but it won't execute.  Any ideas or suggestions?
Title: Re: Small virtual machine to cross compile FPC
Post by: lagprogramming on July 29, 2015, 09:04:08 pm
I've tried to help you using a different approach, an alternative to fpcup but I'm stuck:

1. Regarding fpc,
Code: [Select]
make crossall crossinstall OS_TARGET=linux CPU_TARGET=i386 INSTALL_PREFIX=~/fpcompiler/ works fine but
Code: [Select]
make crossall crossinstall OS_TARGET=embedded CPU_TARGET=arm SUBARCH=armv7em INSTALL_PREFIX=~/fpcompiler/ returns an error and I'm unable to pinpoint the solution:

Code: [Select]
system.pp(292) Error: Assembler arm-embedded-as not found, switching to external assembling
system.pp(292) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
make[4]: *** [system.ppu] Error 1
make[4]: Leaving directory `/home/user/fpcompiler/rtl/embedded'
make[3]: *** [embedded_all] Error 2
make[3]: Leaving directory `/home/user/fpcompiler/rtl'
make[2]: *** [rtl_all] Error 2
make[2]: Leaving directory `/home/user/fpcompiler'
make[1]: *** [build-stamp.arm-embedded] Error 2
make[1]: Leaving directory `/home/user/fpcompiler'
make: *** [crossall] Error 2

2.
For now I don't know a Pascal written IDE that fits your needs:
MSE* doesn't compile with the latest fpc trunk version but you need the trunk.
Lazarus has a strange way to use fpc.cfg file and I wonder if this approach may lead to conflicts when having simultaneous fpc installs.
Fpgui can be built with the latest fpc trunk but the status of an internal IDE is unknown to me. Also I don't know if it's possible to completely build Lazarus using the fpgui LCL widged type.
Title: Re: Small virtual machine to cross compile FPC
Post by: Laksen on July 29, 2015, 11:29:31 pm
lagprogramming, you need a working arm-embedded- or arm-none-eabi- binutils installed. Since you are on linux just install arm-none-eabi- and then add BINUTILSPREFIX=arm-none-eabi- when making the arm embedded cross FPC
Title: Re: Small virtual machine to cross compile FPC
Post by: Paul Breneman on August 06, 2015, 03:35:25 pm
Yesterday I got the ReactOS virtual machine working much better and the http://wiki.freepascal.org/Small_Virtual_Machines (http://wiki.freepascal.org/Small_Virtual_Machines) page is updated.  My next goal is to try fpcup on ReactOS!
Title: Re: Small virtual machine to cross compile FPC
Post by: mse on August 06, 2015, 05:08:51 pm
2.
For now I don't know a Pascal written IDE that fits your needs:
MSE* doesn't compile with the latest fpc trunk version but you need the trunk.

A Linux x86 -> ARM cross compiling environment with a patched FPC 2.6.4, binutils, cross GDB and the necessary ARM libraries for MSEgui is here:
http://sourceforge.net/projects/mseide-msegui/files/fpcrossarm/
MSEide has a project template for cross compiling and remote debugging, tested on RaspberryPi. With MSEide plus the cross development environment it is possible to develop and debug RaspberryPi applications on a Linux x86 PC as if one would work on the Raspi, merely faster. ;-)
The RaspberryPi is connected to the development PC by Ethernet. From README.TXT:
Code: [Select]
Crosscompiling and remote debugging i386-linux -> arm-linux
***********************************************************
For Raspberry Pi:
- Establish a ssh login without password (public key authentication).

- On the i386-linux host download and extract
http://sourceforge.net/projects/mseide-msegui/files/fpcrossarm/crossfpc-i386_linux-eabihf_1.tar.gz
to <your crossfpc directory>.

- Start MSEide, in 'Settings'-'Configure MSEide'-'Global Macros' add:

Name          Value

CROSSMSEDIR   <MSEide+MSEgui directory>
CROSSFPCDIR   <your crossfpc directory>
HOSTIP        <the IP of the host>
REMOTEIP      <the IP of the remote target>
REMOTEPORT    <the remote port, ex: 2345>
REMOTEUSER    pi

- 'Project'-'New'-'From Template', select "crossarmdefault.prj".
- Create the new project.
- 'Project'-'Options'-'Macros', set the TARGETPROJECTDIR value to the project
  path in remote target, ex: "/home/pi/proj/testcase".
- Check the TARGETENV macro.

Press F9 and hope the best. ;-)
MSEide also runs amazingly fast on RaspberryPi directly. ARM MSEide binary is here:
http://sourceforge.net/projects/mseide-msegui/files/mseide-msegui/3.8/
Title: Re: Small virtual machine to cross compile FPC
Post by: Paul Breneman on August 06, 2015, 07:48:59 pm
Thanks mse but lagprogramming and myself are trying to get ARM Embedded (not ARM Linux) to work on small virtual machines.  I have a RPi so what you wrote is interesting anyway.
Title: Re: Small virtual machine to cross compile FPC
Post by: mse on August 07, 2015, 07:08:57 am
I also use MSEide for development of ARM M3 microprocessor projects with the gcc toolchain. Host is Linux, target flashing and debugging is done by a debugger probe like Segger J-Link, see the MSEide debugger settings in attachment. I assume it should be possible to use FPC instead of gcc.
Title: Re: Small virtual machine to cross compile FPC
Post by: lagprogramming on August 07, 2015, 09:18:35 pm
   Would it be enough to install fpc and fpgui? Do you think fpgui's IDE(Maximus) is in a sufficiently advanced state to fulfill your requirements? You may not need fancy stuff of modern IDEs for embedded programming, I don't know. If fpgui would be enough, then with some minor changes to the Maximus IDE, I think you will have some advantages like:
1. I might be able to provide you a console mode installer. With it's presence, a single command line would be enough to install everything.
2. You would need only X server, not additional 3rd party libraries like qt or gtk, this reduces download sizes and installation complexity.
3. Updates to both fpc and fpgui may be applied with a single command line or IDE menu entry.
   Same thing with mseIDE/GUI, it's just that support for Teensy in fpc is added after the 3rd of June. See http://forum.lazarus.freepascal.org/index.php/topic,28561.msg179240.html#msg179240 (http://forum.lazarus.freepascal.org/index.php/topic,28561.msg179240.html#msg179240). If mse* is not able to compile using a fpc trunk later than that date then you will loose probably your most important target. Maybe there is a workaround for this situation, compile mse* with the stable fpc and compile your programs with a recent fpc trunk. But this would complicate things a little bit.
   I'm looking forward for a reply because I'm curious if this approach would fit your needs.
Title: Re: Small virtual machine to cross compile FPC
Post by: mse on August 08, 2015, 09:05:33 am
   Same thing with mseIDE/GUI, it's just that support for Teensy in fpc is added after the 3rd of June. See http://forum.lazarus.freepascal.org/index.php/topic,28561.msg179240.html#msg179240 (http://forum.lazarus.freepascal.org/index.php/topic,28561.msg179240.html#msg179240). If mse* is not able to compile using a fpc trunk later than that date then you will loose probably your most important target.
MSEide compiled with FPC 2.6.4 has no problems to work with FPC trunk compiler. MSEide+MSEgui for FPC 3.0 is available soon.
Title: Re: Small virtual machine to cross compile FPC
Post by: mse on August 10, 2015, 03:05:44 pm
MSEide+MSEgui current GitLab master branch is FPC 3.0 compatible, please test.
https://gitlab.com/mseide-msegui/mseide-msegui

Martin
Title: Re: Small virtual machine to cross compile FPC
Post by: lagprogramming on August 16, 2015, 06:54:25 pm
lagprogramming, you need a working arm-embedded- or arm-none-eabi- binutils installed. Since you are on linux just install arm-none-eabi- and then add BINUTILSPREFIX=arm-none-eabi- when making the arm embedded cross FPC

1. Is the presence of "BINUTILSPREFIX=..." parameter mandatory? Can I ommit it if the involved utils are installed in a directory that's included in the PATH environment?

2. How can I find if I have a working arm-embedded- or arm-none-eabi- binutils installed in a default path? I mean somewhere where the build process would be searching by default. I give an example to explain better what I mean. I can find if I have fpc installed and added in the PATH environment by doing the following test: run a TProcess.Execute with "fpc" as executable and "-i" as parameter. If the output starts with "Free Pascal Compiler" then I consider it's installed.
Can I do something like that with arm-embedded- or arm-none-eabi- binutils?
Title: Re: Small virtual machine to cross compile FPC
Post by: lagprogramming on September 04, 2015, 12:15:39 am
When building fpc, what's the philosophy of having an "embedded" OS instead of "none"?  :-\
Title: Re: Small virtual machine to cross compile FPC
Post by: molly on September 04, 2015, 12:56:21 am
When building fpc, what's the philosophy of having an "embedded" OS instead of "none"?  :-\
AFAIK that is a little different from what you interpreted, see also here (http://stackoverflow.com/questions/5961701/arm-gcc-toolchain-as-arm-elf-or-arm-none-eabi-what-is-the-difference) (scroll down, if wanted follow link)

So that would mean that in arm-none-eabi, the none part isn't the OS part rather the vendor part and targeting no particular OS using embedded ABI ?
Title: Re: Small virtual machine to cross compile FPC
Post by: molly on September 04, 2015, 01:43:21 am
lagprogramming, you need a working arm-embedded- or arm-none-eabi- binutils installed. Since you are on linux just install arm-none-eabi- and then add BINUTILSPREFIX=arm-none-eabi- when making the arm embedded cross FPC

1. Is the presence of "BINUTILSPREFIX=..." parameter mandatory? Can I ommit it if the involved utils are installed in a directory that's included in the PATH environment?
The binutils prefix isn't a path, rather a way to distinguish between different binutils.

Most known/used binutils are: ar, as, ld, objcopy and objdump.

But... they are all named the same for each target. So how to distinguish ? By placing a prefix before their 'common' name, which depends on the target. That's when BINUTILSPREFIX comes into play -> so that you can tell the compiler which particular set of binutils to use (or in case you are living the wild live and named them differently you are still able to use them).

Quote
2. How can I find if I have a working arm-embedded- or arm-none-eabi- binutils installed in a default path?
In practice: you don't.

If someone's sole target is a single one, then he/she can name the binutils by their 'common' name like ar and ld. There is no other way of telling if it's the right binutils then reading their --help output and seeing which targets the specific binutil supports. Of course attempting to compile for a particular target and receiving an missing binutil error also is a way to determine if the binutil is in place or not.

Quote
I mean somewhere where the build process would be searching by default. I give an example to explain better what I mean. I can find if I have fpc installed and added in the PATH environment by doing the following test: run a TProcess.Execute with "fpc" as executable and "-i" as parameter. If the output starts with "Free Pascal Compiler" then I consider it's installed.
I don't have any of my installed FPC compilers in my path, neither are any of my binutils in the path. Still i am able to compile perfectly with FPC, using different targets as i wish.

FPC and its configuration file, are awesome (and completely self-contained) in that regards  :D

^^ the only thing missing to make it completely independent would be to be able to retrieve/obtain the path to the FPC executable to be used in the fpc.cfg configuration file. Right now i need an environment variable for that.

Quote
Can I do something like that with arm-embedded- or arm-none-eabi- binutils?
I don't know of a particular option other then --help that is able to display the supported targets (and if not mistaken that could depend per binutil).
Title: Re: Small virtual machine to cross compile FPC
Post by: lagprogramming on September 04, 2015, 09:55:53 am
Quote
2. How can I find if I have a working arm-embedded- or arm-none-eabi- binutils installed in a default path?
In practice: you don't.

   In a different thread marcov gave me a great hint: "make info". I think it's possible to use this command prior to actually building the compiler. By doing so I might be able to get the paths of involved tools(like as, ar, ld) because I see the values are affected by parameters like BINUTILSPREFIX and CROSSBINDIR.
   But even this approach appears to have some flaws. For example, in Windows, I've noticed that make.exe must be in the same directory as binutils, or place all of them in PATH, otherwise make info will fail.
   Also, apparently the lines shown by the "make info" might not contain full path or even executable extension, even though binutils are not in the PATH environment. If the tools are in the same directory as make.exe then "make info" will show just "As........ as", in windows.
   Slowly, I'm moving forward. I start believing that it's possible to have some good checks prior to building the compiler. This should be better than just interpreting the output of the error messages after a failed build attempt.
Title: Re: Small virtual machine to cross compile FPC
Post by: DonAlfredo on September 10, 2015, 06:58:06 am
@Paul:
Just installed a Debian VM.
And I can reproduce your problem with fpcup !
Will report back if I can find a solution.
Title: Re: Small virtual machine to cross compile FPC
Post by: DonAlfredo on September 10, 2015, 07:38:09 am
Ok. Found it !

FPCUP is expecting the dynamic loader (ld-Linux.so.2) at /usr/lib/ld-Linux.so.2
But its not there.
A link is present in /lib
Another link is present in /lib/i386-linux-gnu

The real file is here: /lib/i386-linux-gnu/ld-2.19.so

So, just create a symlink from /lib/ld-linux.so.2 -> /usr/lib/ld-Linux.so.2

And off you go !
Good luck !!
Title: Re: Small virtual machine to cross compile FPC
Post by: DonAlfredo on September 10, 2015, 05:39:21 pm
I have updated fpcup.
Should work now on Debian, without the need of manually adding links !
Title: Re: Small virtual machine to cross compile FPC
Post by: Paul Breneman on September 16, 2015, 04:22:11 am
I have updated fpcup.
Should work now on Debian, without the need of manually adding links !

Yes, thank you very much!  The Debian LXDE VM on this page (http://wiki.freepascal.org/Small_Virtual_Machines (http://wiki.freepascal.org/Small_Virtual_Machines)) now works with fpcup!

Hopefully tomorrow I can try the ReactOS VM.
Title: Re: Small virtual machine to cross compile FPC
Post by: jc99 on November 14, 2015, 04:57:24 pm
Hi Paul,

Have you had any luck on the ReactOS & fpcup -Issue ?
In ReactOS i desperatly miss the SMB-drive-mapping-support.
I think that I have to wait for the 0.4 version.

Greetings
JC
Title: Re: Small virtual machine to cross compile FPC
Post by: Paul Breneman on November 18, 2015, 01:46:32 am
Have you had any luck on the ReactOS & fpcup -Issue ?

Today I tried 69923 (the 60 MB version, not the msvc version) from here:
http://iso.reactos.org/bootcd/ (http://iso.reactos.org/bootcd/)

I no longer get the "blue-screen-of-death" but fpcup never completes.
Title: Re: Small virtual machine to cross compile FPC
Post by: Paul Breneman on May 19, 2016, 08:57:33 pm
I think that I have to wait for the 0.4 version.

I just tested the ReactOS 0.4.1 version and things work much better.  I also updated the ReactOS section of the wiki page: http://wiki.freepascal.org/Small_Virtual_Machines#ReactOS_virtual_machine (http://wiki.freepascal.org/Small_Virtual_Machines#ReactOS_virtual_machine)
Title: Re: Small virtual machine to cross compile FPC
Post by: Paul Breneman on May 23, 2016, 06:15:36 pm
I have updated fpcup.
Should work now on Debian, without the need of manually adding links !

I just added a new section to this wiki page and I've been trying to get fpcup working on TinyCoreLinux: http://wiki.freepascal.org/Small_Virtual_Machines#Levinux_virtual_machine
 (http://wiki.freepascal.org/Small_Virtual_Machines#Levinux_virtual_machine)

Is there any hope?  Regardless, Levinux sure is fun!
Title: Re: Small virtual machine to cross compile FPC
Post by: Paul Breneman on June 03, 2017, 01:31:02 pm
This section was updated for the recent ReactOS 0.4.5 release:
http://wiki.freepascal.org/Small_Virtual_Machines#ReactOS_virtual_machine (http://wiki.freepascal.org/Small_Virtual_Machines#ReactOS_virtual_machine)
Title: Re: Small virtual machine to cross compile FPC
Post by: Paul Breneman on July 29, 2019, 06:08:28 pm
Win10 makes console mode linux simple and fast!

I just added: https://wiki.freepascal.org/Small_Virtual_Machines#Windows_WSL_and_WSL2 (https://wiki.freepascal.org/Small_Virtual_Machines#Windows_WSL_and_WSL2)

Title: Re: Small virtual machine to cross compile FPC
Post by: Thaddy on July 29, 2019, 06:17:43 pm
Yes it does. I have installed a Debian user space. Once you could only install Ubuntu, but that limitation has gone.
Both FPC and Lazarus can be compiled under WSL. It is not a VM, though, it actually runs native.
It is somewhat limited, though, since it is confined to user space Linux.
Title: Re: Small virtual machine to cross compile FPC
Post by: avra on July 29, 2019, 11:55:45 pm
Win10 makes console mode linux simple and fast!
Only if you do not already use VMware or VirtualBox. If you want WSL2 then you will have to choose between WSL2 OR VMs. You can not use both in the same Win10 session. Bummer. Main thing for WSL2 was to bring Docker support, but I will not use WSL2 if I have to say goodbye to my VMs. I think this is a very nasty way of M$ to make  VMware and VBox users switch over to M$ camp.
Title: Re: Small virtual machine to cross compile FPC
Post by: julkas on July 30, 2019, 08:56:28 am
Win10 makes console mode linux simple and fast!

I just added: https://wiki.freepascal.org/Small_Virtual_Machines#Windows_WSL_and_WSL2 (https://wiki.freepascal.org/Small_Virtual_Machines#Windows_WSL_and_WSL2)
Offtopic quest. About what console mode linux are you talking ?
Title: Re: Small virtual machine to cross compile FPC
Post by: PascalDragon on July 30, 2019, 09:03:49 am
Yes it does. I have installed a Debian user space. Once you could only install Ubuntu, but that limitation has gone.
I use it with ArchLinux :D

Both FPC and Lazarus can be compiled under WSL. It is not a VM, though, it actually runs native.
The VM part is correct for WSL, but not for WSL2 as there they're running the whole kernel in a Hyper-V VM.

It is somewhat limited, though, since it is confined to user space Linux.
Again, not true anymore for WSL2. Though to be honest: when you really need to develop something in kernel you do that either with a dedicated hardware or a dedicated VM.

Win10 makes console mode linux simple and fast!

I just added: https://wiki.freepascal.org/Small_Virtual_Machines#Windows_WSL_and_WSL2 (https://wiki.freepascal.org/Small_Virtual_Machines#Windows_WSL_and_WSL2)
Offtopic quest. About what console mode linux are you talking ?
If you want to run GUI applications on WSL you need to install a X11 server for Windows and have WSL use that to display any GUI. So by default you're restricted to command line applications only.
Title: Re: Small virtual machine to cross compile FPC
Post by: Thaddy on July 30, 2019, 09:12:47 am
I forgot to read the WSL2 documentation properly it seems. Thanks for the corrections. I indeed assumed WSL.
Title: Re: Small virtual machine to cross compile FPC
Post by: julkas on July 30, 2019, 09:27:28 am
Yes it does. I have installed a Debian user space. Once you could only install Ubuntu, but that limitation has gone.
I use it with ArchLinux :D

Both FPC and Lazarus can be compiled under WSL. It is not a VM, though, it actually runs native.
The VM part is correct for WSL, but not for WSL2 as there they're running the whole kernel in a Hyper-V VM.

It is somewhat limited, though, since it is confined to user space Linux.
Again, not true anymore for WSL2. Though to be honest: when you really need to develop something in kernel you do that either with a dedicated hardware or a dedicated VM.

Win10 makes console mode linux simple and fast!

I just added: https://wiki.freepascal.org/Small_Virtual_Machines#Windows_WSL_and_WSL2 (https://wiki.freepascal.org/Small_Virtual_Machines#Windows_WSL_and_WSL2)
Offtopic quest. About what console mode linux are you talking ?
If you want to run GUI applications on WSL you need to install a X11 server for Windows and have WSL use that to display any GUI. So by default you're restricted to command line applications only.
I don't know about WSL. I always use putty and mc for VM console access. Putty has SSH, X11 port mapping so you can integrate it with XMing (if needed).
TinyPortal © 2005-2018