Linux

Archives Forums/Linux Discussion/Linux

JoshK(Posted 2007) [#1]
Assume I have never seen Linux in my life, which is close to the truth. Tell me how to download and install it, then install BlitzMax on it and compile a module.


LarsG(Posted 2007) [#2]
visit: http://www.ubuntu.com/getubuntu/download

choose your preferred location for download and download the ISO.
burn the downloaded ISO to a CD and reboot with the CD in tray.

when all booted up, click the "install" icon..
follow instructions.. (be careful regarding the HD partitioning, so you don't loose any data)

reboot the computer without the CD.. (booting from HD).

visit blitzbasic.com and DL BlitzMax, run the installation.

visit this page to setup the dependencies (extra packages); http://www.blitzbasic.com/Community/posts.php?topic=54592
which will basically tell you to install the following packages;
g++-3.3
libasound2-dev
libglu1-mesa-dev
libxxf86vm-dev

these can be dowloaded with a program called "Synaptic Package Manager", if I recall correctly..
just start that program and you can search for parts of the package names.. mark it for installation and run the update.

finally, try to compile one of the samples from the BlitzMax IDE..
Hopefully, you'll be able to copmile and run.. :)


Winni(Posted 2007) [#3]
What LarsG said... "And may the force be with you." :-)

But I really, really wish you would finish that Mac port first before you go on that long journey in Adventureland...............


Picklesworth(Posted 2007) [#4]
Bah, forget Synaptic. Here is a command you can paste right to the terminal (Applications -> Accessories -> Terminal on the top left, with the default install), to have it going in seconds. To paste in the terminal, I believe the default is Ctrl+Shift+V, or you can highlight this and middle click:

sudo apt-get install libstdc++5 g++-3.3 libasound2-dev libglu1-mesa-dev x11proto-core-dev x11proto-gl-dev x11proto-kb-dev libxxf86vm-dev

(That should get the official stuff running).
When you type that command it will ask for a password, because "sudo" makes it run as root. Just type your account's password. (And don't be alarmed that nothing shows up in the input box).

If you decide to run the Community IDE (GTK version), to have it looking decent you must first run
sudo ldconfig /usr/lib/firefox

If you just want the important parts like bcc and bmk (no IDE), you can get them on your PATH with:
export PATH=$PATH:"~/Software/BlitzMax/bin"
in the terminal.

If you want that change applied permanently for every time that one user logs in, go to Places->Home Folder. View->Hidden Files. (Shudder at the lack of any organization with these per-user settings. On the bright side, though, they are all hidden and all in one place). Find .gnomerc (shortcut: just type that while the icon view is in the foreground and it should jump to it). If the file doesn't exist, right click in the icon view -> Create Document -> Empty file. Name that file .gnomerc, open it and add the line (assuming BlitzMax is in ~/Software/BlitzMax)
export PATH=$PATH:"~/Software/BlitzMax/bin";

( Or you could open that via the terminal with "gedit ~/.gnomerc" )

If you are just compiling modules, you don't really need to install a Linux distro. Ubuntu's desktop installer is a Live CD, which means you'll get a full OS session running off the disk. You will be a bit low on RAM, and it will be slower than with a proper install, but it should work.


Torrente(Posted 2007) [#5]
Is it recommended to get a separate hard drive to install Ubuntu on? I started following these instructions, but when I got to Ubuntu's partitioning setup, neither of the two options ("Guided - use entire hard drive", "Manual") seemed to be what I wanted.

There was originally a third option ("Guided - use part of hard drive"), but that disappeared from the list after failing miserably.


Picklesworth(Posted 2007) [#6]
I would recommend using a separate hard drive. Resizing partitions is scary stuff. (It is possible to shrink the Windows partition and put Ubuntu on the same drive, though).


LarsG(Posted 2007) [#7]
Picklesworth: :)
I wanted to show the userfriendly way... No (scary) terminal stuff on the first linux run..


Picklesworth(Posted 2007) [#8]
Ah, but the terminal is user-friendly, as far as one-time jobs described by tutorials are concerned. Two seconds and it's done!
I have a big rant on help files and how they guide users through convoluted menus telling them to push buttons, instead of the program just doing that for them via the help program, but I won't duplicate it here...

(Hm... speaking of duplicating effort... oops).

The real reason is that I had started writing that earlier, then put my computer in hibernate and didn't remember it until the next morning, by which time you'd already posted :)


Craig Watson(Posted 2007) [#9]
You should be able to resize using the Manual option. It's not as hard as it sounds.

If you don't want to do it that way, the Ubuntu LiveCD should have something called GParted on it.


Torrente(Posted 2007) [#10]
Awesome, thanks!


JoshK(Posted 2007) [#11]
I used the terminal, because "Install g++-3.3" is just gibberish. I don't know what that is or where to find it.

Then I clicked on MaxIDE.exe and it says:
Could not find BlitzMax compiler (bin/bcc), please Reinstall
appdir=cow/home/ubuntu/Desktop/BlitzMax


bcc.exe is located in the BlitzMax/bin directory, so I don't know why it can not find it.

I am running Ubuntu 7.0.4 off the CD drive.


Picklesworth(Posted 2007) [#12]
Weird! I'm running off a live cd, too, and getting the same error.
BlitzMax seems to determine that it is inside of a directory called /cow. (No other program seems to think this).
From the looks of it, that is the writable portion of the root file system in the live cd software, or something similarly weird. Why this couldn't just be exposed rather than hidden away is beyond me...


Here is a little band-aid fix:
Ignore this!


Now you can run the IDE.


JoshK(Posted 2007) [#13]
Is that something I am supposed to type in the terminal thing?


Picklesworth(Posted 2007) [#14]
Yep, those are terminal commands. (And I just made it less convoluted by finally figuring out the ln command. Yay!)

The better version of that:
sudo ln -s -T / /cow


Creates a symbolic link called /cow that points to /, so that /cow/foo (which BlitzMax is trying to read) is the same as /foo (which is what you are seeing).


JoshK(Posted 2007) [#15]
Now I can open the IDE. I synced modules and attempted to compile a GUI example. I got this error:
Building test
Compiling:PNGHeader.bmx
flat assembler  version 1.64
3 passes, 9330 bytes.
Compiling:TLauncher.bmx
flat assembler  version 1.64
4 passes, 35073 bytes.
Compiling:test.bmx
flat assembler  version 1.64
3 passes, 2363 bytes.
Linking:test.debug
Executing:test.debug
mode=2
/usr/bin/ld: warning: libstdc++.so.6, needed by /usr/lib/libGLU.so, may conflict with libstdc++.so.5
X Error of failed request:  GLXBadContext
  Major opcode of failed request:  142 (GLX)
  Minor opcode of failed request:  5 (X_GLXMakeCurrent)
  Serial number of failed request:  584
  Current serial number in output stream:  584

Process complete


I did manage to compile and run the following program:
Notify "HI"

How do I compile a module?


Winni(Posted 2007) [#16]
You should not use the Live CD for programming purposes, folks. You won't have a regular system environment when using a Live CD, and software installations will only be temporary and using some clever hacks like the one that you've just discovered. Sure, you can save your environment to a USB stick or something else, but it still won't be the real thing.

In Ubuntu, you don't have to use apt-get to install software. There is a GUI application for this in the System menu. (Yes, it is only a graphical frontend to apt-get, but much easier to use for newbies.)

I recommend that you get something like Parallels or VMWare and install Linux to a virtual machine for the first steps. You won't have to struggle with partitioning your hard disk and cannot hurt your system when installing it, but you would have a 'normal' system installed. You'd even have some basic 3D support with the current versions of VMWare and Parallels - but don't expect everything to work (it doesn't) or performance miracles. You can get Far Cry up and running in Parallels Desktop 3.0 for Mac, but it is painfully slow.

If you are serious about Linux, you should get yourself a good book about Debian Linux (Ubuntu -- is -- Debian Linux) and learn to use one of the many shells ("command prompts"). You cannot use Linux without a Terminal window, and you cannot fully configure the system through GUI apps. And don't waste your time playing with other Linux distributions -- Ubuntu Linux is the most user friendly version out there, especially for beginners. And from what I have seen, heard and read, it also is the version BlitzMax works best with.

To a certain extent, the same is true for Mac OS X, by the way. At its core, OS X is derived from FreeBSD 5, and at the Terminal level, both systems are real siblings. When you install Fink or Darwin Ports on OS X, you even have something similar to Debian's "apt-get".

It also only looks scary or uncomfortable in the beginning, but in the Open Source World those tools make perfect sense and become quite comfortable quickly. They resolve all the package dependencies for you and automagically download and install all the required libraries and other packages. So when you tell apt-get to install the GNU Compiler Collection for you, it'll make sure that you will have everything you need to run it. The BSD ports systems do the same job.


JoshK(Posted 2007) [#17]
So you really don't know, then?


Winni(Posted 2007) [#18]
Regarding above error: You --MUST-- install -- ALL -- of the packages mentioned in the sticky note written by Wellmt in this forum:

A) To get the IDE running:

Extract blitzmax tarball to your home directory

Install the following package (+ = will be auto installed as a result of dependency)
----------------------------------------------------
Libstdc++5
+gcc-3.3-base


B) To compile programs

Install the following packages (+ = will be auto installed as a result of dependency)
----------------------------------------------------
g++-3.3
+binutils
+cpp-3.3
+gcc-3.3
+libc6-dev
+libstdc++5.3.3-dev (may want 6)
+linux-headers

libasound2-dev

libglu1-mesa-dev
+libgl1-mesa-dev
+libx11-dev

x11proto-core-dev
x11proto-gl-dev
x11proto-kb-dev

libxxf86vm-dev
+x11proto-xf86vidmode-dev


Winni(Posted 2007) [#19]
I had it running in Parallels, once, including Brucey's GTK MaxGUI version and GTK-MaxIDE. However, it was not very stable and to be honest, I did not see much point in wrestling with Linux except for adventuring.


Picklesworth(Posted 2007) [#20]
Oh, yes, I may have missed a few necessary to compile modules when I gave you that command. I never tried doing that on the live cd.
The package build-essential might help, maybe? (Grasping at straws here)

As for that error message, it looks like one of those "forget about it!" types of errors. Installing somewhere is probably the best bet.

I know that Ubuntu is pretty cooperative with VMWare. You can get the vmware server straight from the package repositories! (By the way, Add / Remove Programs under Applications is yet another way to install stuff, but with a more pleasant to navigate listing).
The trouble with VMWare is finding a virtual machine, which is made difficult by design.


Winni(Posted 2007) [#21]
This site might be of some use (if you use torrents):
http://www.thoughtpolice.co.uk/vmware/


JoshK(Posted 2007) [#22]
I installed Ubuntu 7 on its own drive. I can build modules with the "Rebuild all modules" option in the IDE, but I don't know how to build a single module like I do in Windows with a .bat file.

Some modules are failing to compile, and I can not tell what is happening when I have to rebuild everything in one batch.

How do I compile a single module?


skidracer(Posted 2007) [#23]
Don't be overcome by the verbose nature of the error spill, just focus on the very first error, post here etc.

If you get frustrated, you could either edit your ~/.bashrc (like an autoexec.bat for exporting additional command paths but stupidly hidden cos it has a dot)

if you can find this file then you may be able to edit it adding ~/blitzmax/bin and ./ (so the terminal also searches current folder else you have to type ./exename everytime you want to invoke something)...,

if you want to write scripts, its .sh not .bat, I think also you usually have to flick the executable bit of the file properties manually so it lets you run it, i'm sure linux expert will be along shortly....

if you have installed nvidia-dev package correctly and you get your opengl compiling (fgs test gl with vanilla max2d b4 trying to build your own module set) you'll possibly be rewarded with quite a speed up over win32 blitzmax which might make the painful alien experience a little more worth it....


Brucey(Posted 2007) [#24]
sigh.....

The easy way to compile a single module from the command line in Linux (based on a module "ftpparser.mod" that exists in my "bah.mod" folder in the "BlitzMax/mod" folder) :

cd to the BlitzMax/bin directory.

type :
./bmk makemods bah.ftpparser

Results in
[brucey_PII-Fedora bin]$ ./bmk makemods bah.ftpparser
Compiling:common.bmx
flat assembler  version 1.64
3 passes, 4058 bytes.
Compiling:unixparser.bmx
flat assembler  version 1.64
3 passes, 768 bytes.
Compiling:ftpparser.bmx
flat assembler  version 1.64
3 passes, 8558 bytes.
Archiving:ftpparser.debug.linux.x86.a
ar: creating /home/brucey/programming/BlitzMax/mod/bah.mod/ftpparser.mod/ftpparser.debug.linux.x86.a
Compiling:common.bmx
flat assembler  version 1.64
3 passes, 2041 bytes.
Compiling:unixparser.bmx
flat assembler  version 1.64
3 passes, 570 bytes.
Compiling:ftpparser.bmx
flat assembler  version 1.64
3 passes, 4650 bytes.
Archiving:ftpparser.release.linux.x86.a
ar: creating /home/brucey/programming/BlitzMax/mod/bah.mod/ftpparser.mod/ftpparser.release.linux.x86.a

By default BOTH debug and release are built. You can use "-d" or "-r" to build one or the other...
./bmk makemods -d bah.ftpparser


Compiler output goes to console.

If the particular module has any other module dependencies it may also attempt to compile those.

HTH...


Brucey(Posted 2007) [#25]
As far as Skid's vague ;-) mention of paths goes...

Just like in the Windows Environment variables, you can define a PATH variable that the system will use to find executables, and thus saving you the trouble of going to a specific directory every time you want to run something.

In linux, the PATH may be defined in several places.
In your home directory, you can usually find it defined in files ".profile" or ".bashrc" ... and others.

The PATH itself is made up of colon (:) separated entries (whereas Windows uses semi-colon (;) to split the entries).

To define a new PATH you can use :
export PATH=/my/new/path/

Note there are no spaces before or after the "=" !

To append entries to an existing PATH, you need to reference the old PATH contents. You do this by prefixing dollar ($) to the variable name :
export PATH=$PATH:/my/new/path/entry/

which adds your new path to the END of the path list.

In the same way, you could add your new path to the front by doing :
export PATH=/my/new/path/entry/:$PATH


To allow you to run an executable from the "current" directory, PATH should also include the entry dot (.), which represents the current directory. You could add it to PATH like so:
export PATH=$PATH:.


This saves you having to add dot-slash (./) as a prefix to an executable in the current folder, in order to run it.

The keyword "export" is used to make the change global, rather than just for the current process. But there are lots of online resources for all this unixy malarky... which is your best bet if you really want to get to grips with the command-line.

Oh... and to find out the current contents of PATH...
echo $PATH



HTH...


JoshK(Posted 2007) [#26]
Can I make something like a .bat file? Tell me exactly what it needs to say.

I don't know how to use the Terminal:
josh@josh-desktop:~$ cd
josh@josh-desktop:~$ c
bash: c: command not found
josh@josh-desktop:~$ cd BlitzMax
bash: cd: BlitzMax: No such file or directory
josh@josh-desktop:~$ cd BlitzMax\
> cd bin\
> ./bmk makemods leadwerks.apptiming
bash: cd: BlitzMaxcd: No such file or directory
josh@josh-desktop:~$ cd BlitzMax\
> cd bin\
> ./bmk makemods leadwerks.apptiming
bash: cd: BlitzMaxcd: No such file or directory
josh@josh-desktop:~$


skidracer(Posted 2007) [#27]
1. I think \ means line continue, its certainly not a path separator.

2. cd ~/BlitzMax/bin

linux is case sensitive, hopefully you installed blitzmax in your home dir so th

3. try mastering 1 thing at a time, writing batch files before learning how to use bash is just silly thinking

4. take my advice and simply post the first few errors you get from maxide when building modules, flushing your preconceived notions that somehow linux should be just like dos and hence usable with out a decent whack of research and study


JoshK(Posted 2007) [#28]
Tilda? Wow, I never would have guessed that.

Sorry I am impatient with this. I have a lot of things going right now and learning Linux is not something I really want to get into more than necessary.


Winni(Posted 2007) [#29]
Geez, then don't waste your time with it at all. You CANNOT learn something as complex as Linux/Unix in a few hours. And you can certainly NOT write working code for it when you do not 'want to get into it more than necessary'.

Besides: Why the heck are you interested in Linux in the first place unless you want to GPL your code? There is no business value in Linux as a game/desktop platform unless you are IBM, Novell or Red Hat. Linux still is not a viable desktop platform and its users usually have an everything-has-to-be-for-free mindset. And that is exactly the #1 reason that you can read in interviews why so many companies have not ported their software to Linux yet.

You want to make money by supporting a second platform? Get a Max and spend your time with OS X instead. When small companies talk about OS X, you hear them say that it is a small, but financially very interesting market. Mac users expect higher quality, but they are willing to pay for it. There are enough indie developers out there who make at least as much money with the OS X versions of their products as they make with their Windows versions.

BUT exactly as with Linux, you cannot master that platform in a few hours. BlitzMax works great on the Mac, but you still have to invest a lot of time and ressources. It is a completely different world than Windows, and you have to fully embrace that platform in order to write good software for it. Nobody will give you money for something that looks and behaves like an ordinary Windows app.


Picklesworth(Posted 2007) [#30]
Hey, I'm a Linux user and that everything-free mindset drives me crazy! (That's why I like Gnome: It is much more friendly to people who don't use the GPL license).
The platform (particularly Ubuntu) is getting a lot of positive attention these days, and it may get an interesting market yet.
Some people just use Linux because the platform itself is free. (Or because it's faster, which is usually what happens if it is not a heck of a lot slower). I use it as my environment for programming now, so the more Linux-happy libraries the better.

Unfortunately, I lost my extensive post detailing Bash :(

The tilda character is just a shortcut for "your home directory". Instead of tilda, you can write /home/josh.

When it does the "<" thing in the input line, it is asking for more input. The apostrophe character (`) works like parentheses in an equation.
It calls the command within apostrophes first, passing its output to the next command in the list. For example, "kill `pidof aprogram` " gets the output of "pidof aprogram", then passes that to "kill" (which kills a process, passed to it by its process id).
This means it is always going to expect a closing apostrophe, so if you type "kill `", you will see the ">" again, asking for more content until you close that apostrophe (or hit Ctrl+C).

The continue line character you did by accident is a nice little way to spread stuff out over multiple lines. Continue line, and the new line, is both silent. (Just decorative).
If you want multiple commands called in order, end each one with a semicolon. That way, you can have some complex scripting going on.

Bash does some loops, logic and fun stuff like that, too, but I do not have much experience with them. (I also can't help you much with that script you want; I am used to another, less intelligent shell that has really horrible scripts).
Here is a big but quick guide, though:
http://www.panix.com/~elflord/unix/bash-tute.html


JoshK(Posted 2007) [#31]
I was able to compile one module, but when I tried to compile the problematic module, there is no output:

josh@josh-desktop:~/Desktop/BlitzMax/bin$ ./bmk makemods leadwerks.bankex
Archiving:bankex.debug.linux.x86.a
ar: creating /home/josh/Desktop/BlitzMax/mod/leadwerks.mod/bankex.mod/bankex.debug.linux.x86.a
Archiving:bankex.release.linux.x86.a
ar: creating /home/josh/Desktop/BlitzMax/mod/leadwerks.mod/bankex.mod/bankex.release.linux.x86.a
josh@josh-desktop:~/Desktop/BlitzMax/bin$ ./bmk makemods leadwerks.apptiming
josh@josh-desktop:~/Desktop/BlitzMax/bin$

Here is the source to leadwerks.apptiming:


I commented out the Module line and attempted to compile apptiming.bmx in the IDE, and received this error:
Building AppTiming
Compiling:AppTiming.bmx
flat assembler version 1.64
3 passes, 7193 bytes.
Linking:AppTiming.debug
/usr/bin/ld: warning: libstdc++.so.6, needed by /usr/lib/libGLU.so, may conflict with libstdc++.so.5

Process complete



Picklesworth(Posted 2007) [#32]
Is everything the right case in that module's folder?
I can get it to generate no output (and to not build the module) if I change the main file for that module to be a different case than the module's directory. (Odd that makemods wouldn't throw some kind of an error message).

Case sensitivity is fun!

The libsdc warning is just that: a warning. Hasn't hurt anyone so far (that I know of). You can safely ignore it.


Craig Watson(Posted 2007) [#33]
That's not an error, it's just a warning from the linker, because Max is still using GCC 3.3 on Linux, rather than 4, which is what everything else on Ubuntu is compiled with. It's not a problem though really.


JoshK(Posted 2007) [#34]
Okay, I finally compiled all the required modules for the main one, and now I get an "out of memory" error.

Building engine
Compiling:engine.bmx
flat assembler version 1.64
error: out of memory.
Build Error: Failed to assemble /home/josh/Desktop/BlitzMax/mod/leadwerks.mod/engine.mod/.bmx/engine.bmx.gui.debug.linux.x86.s
Process complete


I downloaded FASM from here:
http://flatassembler.net/download.php

I replaced the FASM file in BlitzMax/bin with the one from that package, but I still get the same error:

Building engine
Compiling:engine.bmx
flat assembler version 1.67.22 (16384 kilobytes memory)
error: out of memory.
Build Error: Failed to assemble /home/josh/Desktop/BlitzMax/mod/leadwerks.mod/engine.mod/.bmx/engine.bmx.gui.debug.linux.x86.s
Process complete


I made the changes to bmk_util.bmx and recompiled bmk.exe as explained here:
http://blitzmax.com/Community/posts.php?topic=67478

I was then able to successfully compile the module.

Maybe it will even work!


*(Posted 2007) [#35]
I get an internal error with that link, anyone post any fix for the 'out of memory' error.