* * *

Author Topic: Small virtual machine to cross compile FPC  (Read 18471 times)

Paul Breneman

  • Full Member
  • ***
  • Posts: 245
    • Control Pascal
Small virtual machine to cross compile FPC
« 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!
Regards,
Paul Breneman
www.ControlPascal.com

Paul Breneman

  • Full Member
  • ***
  • Posts: 245
    • Control Pascal
Re: Small virtual machine to cross compile FPC
« Reply #1 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.
Regards,
Paul Breneman
www.ControlPascal.com

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: Small virtual machine to cross compile FPC
« Reply #2 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...
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: Small virtual machine to cross compile FPC
« Reply #3 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
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

Paul Breneman

  • Full Member
  • ***
  • Posts: 245
    • Control Pascal
Re: Small virtual machine to cross compile FPC
« Reply #4 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.
Regards,
Paul Breneman
www.ControlPascal.com

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: Small virtual machine to cross compile FPC
« Reply #5 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...
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

Paul Breneman

  • Full Member
  • ***
  • Posts: 245
    • Control Pascal
Re: Small virtual machine to cross compile FPC
« Reply #6 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).
Regards,
Paul Breneman
www.ControlPascal.com

sam707

  • Hero Member
  • *****
  • Posts: 595
Re: Small virtual machine to cross compile FPC
« Reply #7 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!!!
« Last Edit: November 14, 2014, 01:40:26 am by sam707 »
Lazarus fixes branch (1.8+), Emulators = Radio Shack TRS-80, basic, Pascal 80 , Misosys C pro, Turbo Pascal from version 2 to 5 on amtrad cpc6128 CP/M also a bunch of C compilers. Pascal, C, C++ all versions windows/linux. also assembler from Zilog Z-80 to Pentium MMX

sam707

  • Hero Member
  • *****
  • Posts: 595
Re: Small virtual machine to cross compile FPC
« Reply #8 on: November 14, 2014, 01:21:01 am »
https://www.virtualbox.org

SIMPLY AWESOME!!! good bye vmware, expensive crap  :D
« Last Edit: November 14, 2014, 01:24:28 am by sam707 »
Lazarus fixes branch (1.8+), Emulators = Radio Shack TRS-80, basic, Pascal 80 , Misosys C pro, Turbo Pascal from version 2 to 5 on amtrad cpc6128 CP/M also a bunch of C compilers. Pascal, C, C++ all versions windows/linux. also assembler from Zilog Z-80 to Pentium MMX

Paul Breneman

  • Full Member
  • ***
  • Posts: 245
    • Control Pascal
Re: Small virtual machine to cross compile FPC
« Reply #9 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).

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.
Regards,
Paul Breneman
www.ControlPascal.com

Fred vS

  • Hero Member
  • *****
  • Posts: 1663
    • miXimum is the DJ's best friend
Re: Small virtual machine to cross compile FPC
« Reply #10 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...
I use Lazarus 1.8.0 32/64 and FPC 3.0.3 32/64 on Linux Mint Mate 17 32/64, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64 and Mac OS X Snow Leopard 32.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt, Carbon.

https://github.com/fredvs

sam707

  • Hero Member
  • *****
  • Posts: 595
Re: Small virtual machine to cross compile FPC
« Reply #11 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"
« Last Edit: November 14, 2014, 10:40:00 pm by sam707 »
Lazarus fixes branch (1.8+), Emulators = Radio Shack TRS-80, basic, Pascal 80 , Misosys C pro, Turbo Pascal from version 2 to 5 on amtrad cpc6128 CP/M also a bunch of C compilers. Pascal, C, C++ all versions windows/linux. also assembler from Zilog Z-80 to Pentium MMX

sam707

  • Hero Member
  • *****
  • Posts: 595
Re: Small virtual machine to cross compile FPC
« Reply #12 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
« Last Edit: November 14, 2014, 10:35:20 pm by sam707 »
Lazarus fixes branch (1.8+), Emulators = Radio Shack TRS-80, basic, Pascal 80 , Misosys C pro, Turbo Pascal from version 2 to 5 on amtrad cpc6128 CP/M also a bunch of C compilers. Pascal, C, C++ all versions windows/linux. also assembler from Zilog Z-80 to Pentium MMX

Paul Breneman

  • Full Member
  • ***
  • Posts: 245
    • Control Pascal
Re: Small virtual machine to cross compile FPC
« Reply #13 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.

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)
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.
« Last Edit: May 24, 2015, 07:23:29 pm by Paul Breneman »
Regards,
Paul Breneman
www.ControlPascal.com

Graeme

  • Hero Member
  • *****
  • Posts: 1414
    • Graeme on the web
Re: Small virtual machine to cross compile FPC
« Reply #14 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]
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus