Installing and using PureBasic on Linux

Linux specific forum
Ramihyn_
Enthusiast
Enthusiast
Posts: 314
Joined: Fri Feb 24, 2006 9:40 am

Installing and using PureBasic on Linux

Post by Ramihyn_ »

This thread will focus on how to install and run PureBasic on common linux distributions.

I will focus on 32-bit Linux distributions for PureBasic development, because 32-bit binaries run on 64-bit versions but not vice versa and i have no use for more than 4gb of memory for my PureBasic tasks. The installations will include commands for VirtualBox integration, if you are not installing linux in VirtualBox, you can just skip them.

To avoid the common problem of informations disappearing due to outdated links, all instructions are written into this thread, so please excuse the lack of nice formatting :)

Here are instructions about Using PureBasic (32bit) on 64bit Linux by Freak in the PureBasic Team Blog.

Running multiple PureBasic installations is simple, just unpack them to different directories and start the PureBasic IDE ("<installation directory>compilers/purebasic") from there. Linux package administration tools will resolve dependancies if you want to install a package following one of the install instructions. Just accept the additionally required installations when they are requested.

Make sure you use the right ISO file which is named in the intructions and watch carefully which hard disk is used before you let a linux installation "clean and use entire disk"!

If you are new or unsure - use VirtualBox and backup often!

VirtualBox

Homepage: www.virtualbox.org

VirtualBox is a free virtual machine which allows to run one operating system within another. It is used here to easily run different linux distributions from within Windows or Mac OS X.

The following settings where used:

Main memory: 1500 MB
Fixed hard disk size: 15 GB

During installation in VirtualBox use "Erase and use the entire disk" or similar automatic partitioning options. On first start of the new virtual machine, assign the downloaded ISO file as "installation media".

Install the OS, reboot and install the guest extensions and reboot the system.

Create a "shared folder" (Geräte->Gemeinsame Ordner for the german version) and mark it "automatisch einbinden" and "permanent erzeugen".

To transfer files between the Host (usually Windows) and the guest (Linux), just copy them into the "shared folder". The "shared folder" in Linux is usually accessible somewhere in "/media/" or "/mnt". Make the folder sharing permanent and reboot, call "df" in a shell and you should see where the shared folder is mounted. You usually need root access to use the shared folder.

If the install succeeded, you should be able to resize the window and have the linux desktop use it's full size.

That works fine for my computers with 6/8gb RAM and will give you about 10 to 13 GB of free disk space. The downside of using VirtualBox, is that you usually cant use 2D or 3D hardware acceleration.

Suggested linux configuration changes after install

For current gnome based linux installations like Fedora or Ubuntu, the menubar icons and icons in buttons are disabled. Enable them by using the "dconf-editor" and enable the options in "org->gnome->desktop->interface" called "menus-have-icons" and "buttons-have-icons".

or use the commands

Code: Select all

gconftool-2 --set /desktop/gnome/interface/buttons_have_icons --type bool true
gconftool-2 --set /desktop/gnome/interface/menus_have_icons --type bool true
Useful tips & tricks

Finding the (K)Ubuntu version installed:
cat /etc/lsb-release

Showing which dynamically linked libraries are used by a program:
ldd <program>

Programs useful to dissect the program flow in case of problems:
ltrace
strace

General debuggers:
ddd
gdb
IDA starter

Displaying the dynamic linker cache:
ldconfig -p
Last edited by Ramihyn_ on Thu Oct 13, 2011 10:38 pm, edited 10 times in total.
Ramihyn_
Enthusiast
Enthusiast
Posts: 314
Joined: Fri Feb 24, 2006 9:40 am

Re: Installing and using PureBasic on Linux

Post by Ramihyn_ »

Ubuntu 10.04 LTS, 32-bit

Homepage: www.ubuntu.com
Download: www.ubuntu.com/download/ubuntu/download
File: ubuntu-10.04.3-desktop-i386.iso

Burn the ISO to a CD/DVD or create a new VirtualBox machine and use the ISO as boot installation media


Select "Install Ubuntu 10.04.3 LTS"

Create an account of your choice, the password you choose here, will also be the root password.

Start "System->administration->synaptic package manager"

Click the buttons "Reload", "Mark all upgrades" and "Apply" to update the system.

Open "Applications->Accessories" and drag the "Terminal" entry to the desktop so you have easier access to a terminal session.

If you need to execute a command as "root" in Ubuntu, execute "sudo /bin/bash" in a terminal to get a root shell.

Unpack the purebasic archive (for example "tar zxvf purebasic_4_51_x86.tgz").

In a terminal as "root" do:

apt-get -y install libgtk2.0-dev
apt-get -y install libgnome2-dev
apt-get -y install libgnomeprintui2.2-dev
apt-get -y install libxine-dev
apt-get -y install libsdl1.2-dev
apt-get -y install libiodbc2-dev

Close the root shell and open a regular terminal. Change to the directory "purebasic/compilers" and start the purebasic IDE with the command "./purebasic".

If you want to use multiple PureBasic installations at once, just unpack the first and "mv purebasic purebasic451" and unpack the next.

To create an icon for the PureBasic IDE, just right-click on the desktop use "Create Launcher...". Use "Browse" to select the IDE ("purebasic/compilers/purebasic").
Last edited by Ramihyn_ on Sun Aug 28, 2011 1:20 am, edited 1 time in total.
Ramihyn_
Enthusiast
Enthusiast
Posts: 314
Joined: Fri Feb 24, 2006 9:40 am

Re: Installing and using PureBasic on Linux

Post by Ramihyn_ »

Fedora 15, 32-bit

Homepage: fedoraproject.org
Download: fedoraproject.org/en/get-fedora-options#formats
File: Fedora-15-i386-DVD.iso - installable DVD image

Burn the ISO to a CD/DVD or create a new VirtualBox machine and use the ISO as boot installation media

Select the first option from the menu "install a new system or upgrade an existing system".

During the installer - choose "basic storage devices" in VirtualBox. For type of installation use "use all space" in VirtualBox.

I have chosen a "graphical desktop" as default installation and sticked with using only the "installation repo". If you have a permanent internet connection and want to save bandwidth, i assume you can add the "Fedora 15 i386" repository and avoid some downloading/patching after the initial installation, but due to my broadband flatrate i dont care and havent tested that :)

Due to a "PackageKit" bug, the first update should by done via the yum commandline tool as "System tools->Software update" will abort with a transaction error. Open a shell and execute 'su -c "yum update"' or "yum update" from a root shell.

Go into "applications->system tools->add/remove software" and install the following packages:

gcc-4.6.0-10.fc15
gcc-c++-4.6.0-10.fc15
kernel-PAE-devel-2.6.40.3-0.fc15

For VirtualBox you can install the guest additions now, but you need to reboot first due to the previous updates which included a new kernel. After installing the VirtualBox guest additions, reboot again to activate them.

Install the following packages using the GPK-Application (Applications->System Tools->Add/Remove Software)

gtk2-devel-2.24.4-2.fc15
libgnome-devel-2.32.1-2.fc15
libgnomeprintui22-devel-2.18.6-2.fc15
xine-lib-devel-1.1.19-6.fc15
SDL-devel-1.2.14-11.fc15
libiodbc-devel-3.52.7-2.fc15

For PureBasic 4.51 and 4.60 Beta4, you need to do the following argument fix for GCC:

Step 1 - Copy & paste the following source into a file, for example "dummy.c"

Code: Select all

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(int argc, char *argv[])
{
  int i,j;
  int LibFlag;
  char **PList;

  // argc + 1 + optional number of injected flags

  PList = malloc((argc + 10) * sizeof(char *));
  PList[0] = strdup("/usr/bin/gcc_");

  j = 1;
  LibFlag = 0;
  for (i=1; i<argc; i++)
  {
    if (strcasecmp(argv[i], "-arch=i386") != 0)
      PList[j++] = argv[i];

    // required for Fedora 15 32-bit
    if ((LibFlag == 0) && (strncmp(argv[i], "-l", 2) == 0))
    {
      LibFlag++;
      PList[j++] = strdup("-ldl");
      PList[j++] = strdup("-lX11");
    }

  }
  PList[j] = 0;

  execvp("/usr/bin/gcc_", PList);

  return -1;
}
Step 2 - Compile it "gcc dummy.c"

Step 3 - rename your gcc from /usr/bin/gcc to /usr/bin/gcc_

Step 4 - move the "a.out" you compiled, as new "gcc" into /usr/bin

Step 5 - verify the ownership and access rights of /usr/bin/gcc

Step 6 - try "gcc" without parameters and "gcc -v" to verify that it worked - you should see "gcc_" instead of "gcc" in the output.

Image
Windowed OpenGL based Sprite3D demo from Rayman1970 (http://www.menzer-software.de) running in Gnome3 on Fedora15
Last edited by Ramihyn_ on Sun Aug 28, 2011 1:48 am, edited 6 times in total.
Ramihyn_
Enthusiast
Enthusiast
Posts: 314
Joined: Fri Feb 24, 2006 9:40 am

Re: Installing and using PureBasic on Linux

Post by Ramihyn_ »

KNOPPIX 6.7.0

Homepage: www.knoppix.org
Download: www.knopper.net/knoppix-mirrors/
File: KNOPPIX_V6.7.0CD-2011-08-01-EN.iso


Work in progress...
Last edited by Ramihyn_ on Sun Aug 28, 2011 2:01 am, edited 2 times in total.
Ramihyn_
Enthusiast
Enthusiast
Posts: 314
Joined: Fri Feb 24, 2006 9:40 am

Re: Installing and using PureBasic on Linux

Post by Ramihyn_ »

Place holder #4 - work in progress
Post Reply