• Print

Author Topic: Desperate for a Linux version of QB64?  (Read 8479 times)

Galleon

  • Administrator
  • Hero Member
  • *****
  • Posts: 4664
  • QB Forever
    • Email
Desperate for a Linux version of QB64?
« on: October 13, 2008, 03:33:28 AM »
I've just set up Ubuntu in a VirtualBox on my PC. I'm a Linux newbie so I'm just getting my head around things. I've managed to install the g++ package from the console, route my internet access through VirtualBox and share directories between my real PC and VirtualBox's virtual hard disks. For any Windows user out there who hasn't tried VirtualBox yet, you are missing something huge!

Ironically, the Ubuntu liveCD I burnt just froze at the "hardy heron" background both real PC's I tried it on, but I'm not going to open up that can of worms (bad burn?).

The next step will be putting together a collection of the linux SDL libraries and getting (painstakingly?) a pre-generated QB64 program in C++ form to compile. If all goes well we'll have a Linux version of QB64 in the near future.
Something old... Something new... Something borrowed... Something blue...

qbguy__

  • Guest
Re: Desperate for a Linux version of QB64?
« Reply #1 on: October 13, 2008, 06:54:08 PM »
Quote from: Galleon on October 13, 2008, 03:33:28 AM
Ironically, the Ubuntu liveCD I burnt just froze at the "hardy heron" background both real PC's I tried it on, but I'm not going to open up that can of worms (bad burn?).
Burning at 8x or even 1x instead of the highest speed might fix that if it's a bad burn, but I haven't had any problems booting Ubuntu from the live CD even burning at the highest speed. If your computer has 256 MB of RAM, it might be that it works but is just slow, but I think you said you had 2 gb of ram. Or maybe you downloaded the amd64 distribution and then tried it on a normal x86. Also, Ubuntu intrepid is about to be released, and intrepid beta supports my wireless card out of the box using the athk5 driver which hardy did not so it might be better to use that instead of hardy.
Quote
The next step will be putting together a collection of the linux SDL libraries and getting (painstakingly?) a pre-generated QB64 program in C++ form to compile. If all goes well we'll have a Linux version of QB64 in the near future.
This command should install the necessary libraries:
Code: [Select]
sudo aptitude install libsdl1.2-dev libsdl-mixer1.2-dev libsdl-image1.2-dev libsdl-ttf2.0-dev

Here are some of the modifications I made (I can give it as a diff):

1) Linux is case sensitive, so I changed msbin.c to MSBIN.C
2) Change __int64, __int32, etc. to int64_t, int32_t, etc. and also unsigned __int64 to uint64_t, etc. Add #include <stdint.h>
3) Linux (Unix) uses forward slashes and not backslashes, so #include "..\..\main.txt" (and other includes) has to be changed to use forward slashes, as must .\\data\\qb64icon.bmp to ./data/qb64icon.bmp
4) Remove #include direct.h and replace with #include unistd.h and #include sys/stat.h (for mkdir). Remove underscores from chdir, rmdir, mkdir, etc.
5) comment out the includes for time64.h and time64.c.

You also have to remove a bunch of windows api stuff
http://www.2038bug.com/pivotal_gmtime_r.c.html

Marco

  • Guest
Re: Desperate for a Linux version of QB64?
« Reply #2 on: October 14, 2008, 04:55:29 AM »
Quote from: qbguy__ on October 13, 2008, 06:54:08 PM
You also have to remove a bunch of windows api stuff
http://www.2038bug.com/pivotal_gmtime_r.c.html

Note that all these -64 functions (time but similarly also for *stat calls) are Linux only. If you ever want to get of Linux (OS X, FreeBSD), you need to wrap this.

angros47

  • Jr. Member
  • **
  • Posts: 99
Re: Desperate for a Linux version of QB64?
« Reply #3 on: October 14, 2008, 09:56:32 AM »
Quote
For any Windows user out there who hasn't tried VirtualBox yet, you are missing something huge!

I'm using Qemu (it even allows 64-bit code on 32-bit machines) and bochs.


Marco

  • Guest
Re: Desperate for a Linux version of QB64?
« Reply #4 on: October 15, 2008, 03:21:02 AM »
Quote from: angros47 on October 14, 2008, 09:56:32 AM
Quote
For any Windows user out there who hasn't tried VirtualBox yet, you are missing something huge!

I'm using Qemu (it even allows 64-bit code on 32-bit machines) and bochs.

I use vmplayer.  64-bit VMs on 32-bit OSes works fine. (requires hardware virtualization bit), and using the same VMs under Linux and Windows.  Performance is decent.

Galleon

  • Administrator
  • Hero Member
  • *****
  • Posts: 4664
  • QB Forever
    • Email
Re: Desperate for a Linux version of QB64?
« Reply #5 on: October 15, 2008, 05:58:16 AM »
Thank you for the sample programs, bug reports and help re. changes required to make QB64 compile in Linux Qbguy, your help is very important to me.

 It's taken me some time to become accustomed to Linux and there are a lot of annoying differences, particularly in relation to packages, but I've already got some simple SDL programs to compile and run and the Linux versions of SDL_image, SDL_mixer & SDL_ttf included (nothing specifically to do with QB64 yet). The next step is the important one, getting a C++ program already generated by QB64 to run. I'll be keeping everyone posted about this.
Something old... Something new... Something borrowed... Something blue...

Galleon

  • Administrator
  • Hero Member
  • *****
  • Posts: 4664
  • QB Forever
    • Email
Re: Desperate for a Linux version of QB64?
« Reply #6 on: October 16, 2008, 04:06:33 AM »
More progress towards a Linux version!

I've now got the C++ generated by QB64 to almost compile with just a few nitpicky things like TIME$ and DATE$ containing a Windows specific command. Overall though, I'm confident that within a week I'll not only be able to run QB64 generated C++ programs but also have a linux built QB64 compiler too.

Exciting stuff,
Galleon

PS. See, I told you it wouldn't take long to port once I go around to it. Sorry, no "fun" stuff to see yet.
Something old... Something new... Something borrowed... Something blue...

qbguy

  • Full Member
  • ***
  • Posts: 239
Creating a debian package
« Reply #7 on: October 16, 2008, 06:51:54 PM »
http://www.kclee.de/clemens/unix/HowToCreateYourOwnDebianPackage.html

This should help if you want to package it so that *buntu, debian, etc users can use a package that automatically installs stuff.

Basically, you just create a directory called debian which contains another directory called DEBIAN which contains a control file which lists dependencies as well as a bunch of directories that are all the files that you change (i.e., if you create put your qb64 exe at /usr/bin/qb64, you would have /usr/bin/ as a directory inside your debian directory and the qb64 in that.)

This is an example of a control file for qb64
Code: [Select]
Package: qb64
Version: 0.81-1
Section: main
Priority: optional
Architecture: all
Depends: libsdl1.2-dev, libsdl-mixer1.2-dev, libsdl-image1.2-dev, libsdl-ttf2.0-dev, build-essential, g++
Maintainer: Galleon
Description: QB64 BASIC Compiler
 This is a QBASIC compatible self-hosting BASIC Compiler
 for Linux and Windows.


roy

  • Newbie
  • *
  • Posts: 32
    • Email
Re: Desperate for a Linux version of QB64?
« Reply #8 on: October 17, 2008, 01:06:03 PM »
angros47, I know you are interested in making an interpreter. It would be very helpful if you could try some of your ideas on the QB64 project.
« Last Edit: October 17, 2008, 03:46:58 PM by roy »

angros47

  • Jr. Member
  • **
  • Posts: 99
Re: Desperate for a Linux version of QB64?
« Reply #9 on: October 18, 2008, 01:44:46 AM »
I've tried to build a basic interpreter in basic (it was very slow, but somehow worked), and posted it on freebasic forum (but it was developed in pure QB). The only problem (by now) is that it used an array inside an UDT (allowed in QB PDS and in FB, not allowed in QB4.5 or QB64), so porting will be a little tricky.

QB64 is a lot more suitable to be interpreted than FB, because some FB features (pointers, libraries, OOP) are not easily interpreted.
Also, the graphic interface of QB64 is perfect for an IDE/interpreter: the program could show two windows, one for the running program (where program outputs and graphic are displayed) and one for the IDE (where source and error messages are displayed)

This interpreter could be an independent program, integrated with QB64 compiler (i.e. with a "run" command, that executes the program by the interpreter, and a "make exe file" that run QB64 compiler.)
Maybe, even a byte-code interpreter can be made: the basic source file is tokenized, compressed, ad then run by a light version of interpreter (".exe requiring QBRUN64.EXE to run"). This could be useful when porting to other platforms, non-x86 based (even Java, actionscript, javascript, cell-phones...).

Another possible feature could be a "smart" help: in QB, when I press F1 on a word, it tells me not only if it's a command, but also if it's a line label, a variable (and it's type/scope), an array (and it's dimensions) or a sub/functions (and it's parameters).

That was very useful, but can be done only if the IDE contain a parser/precompiler (in fact, i never seen an analog feature in new compilers, that have separated IDE).

The main problem is having a parser working EXACTLY like the compiler (well, QBasic itself didn't behave exactly in the same way in interpreted and compiled mode). So, this task will be a lot easier when QB64 source (the basic one, self-compiling), or at least part of it, will be avaible.

Galleon

  • Administrator
  • Hero Member
  • *****
  • Posts: 4664
  • QB Forever
    • Email
Re: Desperate for a Linux version of QB64?
« Reply #10 on: October 18, 2008, 03:20:12 AM »
 ;D

http://www.qb64.net/screenshots/displayimage.php?pid=3&fullsize=1

The screen-shot speaks for itself really,
Galleon

PS. I'd like to (again) thank Qbguy for his encouragement and support in getting things this far.
PPS. The next step will be compiling the QB64 compiler's source C++ output in Linux and then... expect the next release of QB64 to include a Windows and Linux version!
Something old... Something new... Something borrowed... Something blue...

Marco

  • Guest
Re: Desperate for a Linux version of QB64?
« Reply #11 on: October 18, 2008, 12:24:41 PM »
Quote from: Galleon on October 18, 2008, 03:20:12 AM

PS. I'd like to (again) thank Qbguy for his encouragement and support in getting things this far.
PPS. The next step will be compiling the QB64 compiler's source C++ output in Linux and then... expect the next release of QB64 to include a Windows and Linux version!

Ok, so when can we expect a FreeBSD version ? :-)

qbguy  

  • Guest
Re: Desperate for a Linux version of QB64?
« Reply #12 on: October 18, 2008, 03:52:46 PM »
Quote
Ok, so when can we expect a FreeBSD version ? :-)
Well, either Galleon can release the source code and I can make a FreeBSD version, or, Galleon can learn to use FreeBSD.

FreeBSD has a ports tree to compile stuff from source and a package system for pre-compiled packages.

To build from source:
Code: [Select]
cd /usr/ports/devel/sdl12/ && make install clean

To add binary package:
Code: [Select]
pkg_add -r sdl

Here is a list of the directories in /usr/ports where you may find the various sdl libraries.
sdl: devel/sdl12

image: graphics/sdl_image

mixer: audio/sdl_mixer


roy

  • Newbie
  • *
  • Posts: 32
    • Email
Re: Desperate for a Linux version of QB64?
« Reply #13 on: October 18, 2008, 04:45:27 PM »
I still think it is too early to release the source code. If Galleon wants to go down the same road as V!c did with FB then so be it but I would prefer Galleon to perfect QB64 before it was released.

qbguy

  • Full Member
  • ***
  • Posts: 239
Re: Desperate for a Linux version of QB64?
« Reply #14 on: October 18, 2008, 06:38:09 PM »
Quote from: roy on October 18, 2008, 04:45:27 PM
I still think it is too early to release the source code. If Galleon wants to go down the same road as V!c did with FB then so be it but I would prefer Galleon to perfect QB64 before it was released.

But what if I am really paranoid and am worried about Galleon injecting viruses (trojan horses) into my BASIC programs at compile time? Even checking the C++ generated source is not enough (I am paranoid remember) because galleon might be distributing a hacked g++ that injects the virus when it detects that it is compiling qb64 stuff.
« Last Edit: October 18, 2008, 06:42:20 PM by qbguy »

  • Print