possible gcc4.x fix

Archives Forums/Linux Discussion/possible gcc4.x fix

skidracer(Posted 2008) [#1]
haven't tested much, but I think I've got gcc4.3 working nicely with blitzmax with this fix:

blitz.mod/blitz_app.c[188]
#if __APPLE__
	bbGCStartup( &argc );
#elif __linux
	bbGCStartup( &argc );
#else
	bbGCStartup( &app_file+2 );
#endif



dawlane(Posted 2008) [#2]
Just modified blitz.mod/blitz_app.c, rebuilt the modules, modified bmk to use g++/gcc 4.3 and rebuilt it then rebuilt the mods again.
Tried all the BMax samples and so far it work a treat.
You wouldn't have thought that the gcc problem was so simple.


skidracer(Posted 2008) [#3]
I'm not having much luck still with MaxIDE, so not entirely convinced...


dawlane(Posted 2008) [#4]
Same here, MaxIDE builds and runs but as soon as you try and enter any thing in the editor it eats memory like a pig. But I haven't seen any thing else yet doing this (yet).


skidracer(Posted 2008) [#5]
fltk itself feels strangely broken in the selection, cursorposition in status, etc. departments but I would imagine gc is to blame...


Warpy(Posted 2008) [#6]
skidracer, is there much of a will to fix all these linux problems that have emerged with ubuntu 8.10, or is this it for bmax on linux for a while? It seems an awful lot of things need changing or updating to provide a pleasant environment, like gcc, fltk, etc.


Brucey(Posted 2008) [#7]
I think I've got gcc4.3 working nicely with blitzmax

Hey, it looks like that's sorted it for me too! Thanks :-)

Apps are running as expected. Even the IDE is running properly now. Cool...


markcw(Posted 2008) [#8]
What about gcc-3.4? Why does it not work?


Warpy(Posted 2008) [#9]
it still works, but it's not in the ubuntu 8.10 repositories, so you can't automatically download it any more, you have to either go with gcc4.3 or download the package manually from the old repository.


Firstdeathmaker(Posted 2008) [#10]
Hmm, I've got the problem that my MaxIde is not starting anymore. The original Ide tells me:

Unable to determine BlitzMax Version.
Please reinstall BlitzMax to repair this problem.

If I try to run ./bcc it tells me:

./bcc: error while loading shared libraries: libstdc++.so.5: cannot open shared object file: No such file or directory


dawlane(Posted 2008) [#11]
@Firstdeathmaker
The original IDE use libstc++5. It doesn't hurt to install it as some printer drivers still use it.


skidracer(Posted 2008) [#12]
more good news, after upgrading yesterday from a p3 500mhz to a coreduo E2200 (yes i'm cheap) i thought it was time to have another crack at compiling on ubu64,

the first thing is a small mod to bmk so it searches $blitzmax/lib then /usr/lib32 for libs, the original code I think wasn't searching any paths than the standard due to the order of things,

bmk_util.bmx[323]:
	cmd="g++"
	cmd:+" -m32 -s -Os --eh-frame-hdr -pthread"

	cmd:+" -L"+CQuote(BlitzMaxPath()+"/lib")
	cmd:+" -L/usr/lib32"
	cmd:+" -L/usr/X11R6/lib"
	cmd:+" -L/usr/lib"

'	...seems to work OK - no more 'lib.5.so may conflict with lib.6.so...	

	cmd:+" -o "+CQuote(path)
	cmd:+" "+CQuote(tmpfile)


on a fresh install of Ubuntu64 8.10, with the new bmk and the usual bmx packages including

sudo apt-get install ia32-libs
sudo apt-get install libc6-dev-i386

and a few soft links until ubuntu get their act together...

/usr/lib32/libGL.so.1.2 to ~/blitzmax/lib/libGL.so
/usr/lib32/libGLU.so.1.3.070200 to ~blitzmax/lib/libGLU.so
/usr/lib32/libX11.so.6.2.0 to ~/blitzmax/lib/libX11.so
/usr/lib32/libXxf86vm.so.1.0.0 to ~/blitzmax/lib/libXxf86vm.so

tada!

finally blitzmax running nice on ubuntu64


Firstdeathmaker(Posted 2008) [#13]
one question: how can you rebuild the modules when you can't compile cause of the error?


skidracer(Posted 2008) [#14]
The only error I had with current bmx-svn binaries is at link time when bmk needs to find the 32 bit .so files, and yes I used a 32 bit install to rebuild bmk, hopefully not required soon.

What OS?


dawlane(Posted 2008) [#15]
one question: how can you rebuild the modules when you can't compile cause of the error?

What errors are you getting?


Matthew Smith(Posted 2008) [#16]
I would assume it relates to still trying to compile with the old libraries - this is the error for me:

sh: g++-3.3: not found
Build Error: Failed to link /home/msmith/BlitzMax/src/bmk/bmk

Simon, how do you setup soft-links?

Update:
To setup soft-links type:

ln -s <info>

at the terminal (just looked it up myself). The file name for the first link is a little different, but the other 3 were the same.


dawlane(Posted 2008) [#17]
Well I hope I got this right I have managed to get Blitz Max to work on Ubuntu64 using the original BlitzMax 1.30 archive (but it wouldn't surprise me if I screwed up the steps I took so let me know).

EDIT: Downloaded the svn version and rebuilt the job lot so far so good (the sound was playing up but it must have been something else eating CPU cycles as its ok now). It's nice to have a almost working FLTK-IDE but the text on the HTML/TEXT is a bit gray and HTML-hyperlinks cause it to lockup any hints on sovling this? (works ok on ubuntu32).....Correction I must be tired the links work and the gray html/text is to do with the desktop-theme doh!.

First job was to install the libraries.

Sudo apt-get install libglu1-mesa-dev x11proto-core-dev x11proto-gl-dev x11proto-kb-dev libxxf86vm-dev libasound2-dev build-essential libidn11-dev

The next was to install the gcc/g++ multilibs and some 32bit libs.

sudo apt-get install gcc-multilib g++-multilib ia32-lib

This should install the current version of the 32/64bit gcc/g++ libs and addition 32bit libs. If not the they are gcc-4.3-multilib g++-4.3-multilib.

Next was to add couple of symbolic links named gcc-3.3/g++-3.3 to link to gcc-4.3/g++-4.3

sudo ln -s /usr/bin/gcc-4.3 /usr/bin/gcc-3.3
sudo ln -s /usr/bin/g++-4.3 /usr/bin/g++-3.3

Next was to use skidraces code update on blitz.mod/blitz_app.c

#if __APPLE__ /Look for this it should be around line 166
bbGCStartup( &argc );
#elif __linux //This line
bbGCStartup( &argc ); //And this line
#else
bbGCStartup( &app_file+2 );
#endif

Next was to modify the bmk_util.bmx by adding the line cmd:+" -L/usr/lib32" (skidracer) in the linux section of the function LinkApp like so.

?Linux
cmd$="g++ -m32 -s -Os --eh-frame-hdr -pthread -static-libgcc"
cmd:+" -o "+CQuote( path )
cmd:+" "+CQuote( tmpfile )
cmd:+" -L/usr/lib32" ' New line
cmd:+" -L/usr/X11R6/lib"
cmd:+" -L/usr/lib"
cmd:+" -L"+CQuote( BlitzMaxPath()+"/lib" )

Note I changed g++-3.3 to g++ and also changed gcc-3.3 in the linux section of the function CompileC to gcc so I could remove the links gcc-3.3/g++-3.3 later.

I then compiled the bmk.bmx file renamed the old bmk in the BlitzMax/bin folder to bmk.old, then moved the new bmk executable from the src/bmk over to BlitzmMax/bin

Then I did the symbolic links (skidracer) in the BlitzMax/lib directory (replace the ~/blitzmax with your BlitzMax path)

ln -s /usr/lib32/libGL.so.1.2 ~/blitzmax/lib/libGL.so
ln -s /usr/lib32/libGLU.so.1.3.070200 ~/blitzmax/lib/libGLU.so
ln -s /usr/lib32/libX11.so.6.2.0 ~/blitzmax/lib/libX11.so
ln -s /usr/lib32/libXxf86vm.so.1.0.0 ~/blitzmax/lib/libXxf86vm.so

Then I rebuilt the modules.

Then tried some of the samples. And they seem to work ok so far.

UPDATE: Next problem to solve getting MaxGTK apps to link.


Tachyon(Posted 2008) [#18]
Okay, I've been trying to get BlitzMax working with Ubuntu 8.10 all morning. I now regret upgrading to 8.10. I have been following dawlane's instructions above but have run into a "Command Line Error" when trying to compile bmk.bmx. Since I rarely dabble within the bowels of BlitzMax, I do not know what the problem is.

Question to BRL: when is BlitzMax 1.32 due out, and will we ever see the day that BlitzMax will work on Linux without all these tweaks and hacks?? I mean, I don't mind installing a few libraries to get things to compile, but with every new release of Linux it gets worse and worse trying to keep BlitzMax functioning.

I can assure everyone that it is worth the effort to keep BlitzMax and Linux working together harmoniously. You can make money with Linux games! Please, BRL- get BlitzMax up-to-date with the latest Linux libraries so that these hacks are not needed. At the very least, a compiled BlitzMax application should be able to run on a vanilla installation of the latest version of 32-bit Ubuntu (no additional libraries required). As I said, I understand the need for additional libraries to get the IDE and compiler working, but all these hacks are just ridiculous.


plash(Posted 2008) [#19]
I fully agree Tachyon, but you probably shouldn't bet on it.


Brucey(Posted 2008) [#20]
There are some updates in the BlitzMax SVN which purport to fix the runtime issues on gcc4.x.
I've not yet updated my Ubuntu to 8.10, so can't comment on that atm.

A compiled app should indeed run fine without any extra user installs - depending on what libs you are using. For example, if you app used the GTK mods (but not the firefox htmlview), I would expect it to "just work" on most distros.
If you are using graphics, then obviously the user would require some mesa/gl runtime shared objects to be installed on their system.

For *compiling*, the very nature of the unix-style system requires gcc to link to specifically named shared objects, (and perhaps headers in certain cases). These shared objects are not present in a "runtime" release, which is why you need to download developer releases. (that's why you generally have two sets of releases per library -> runtime and dev).


Of course, running/building 32-bit software on a 64-bit system is something entirely different... although dawlane seems to be most of the way there ;-)
Maybe I should upgrade to 64-bit... then at least I could use *all* of the 4gig I've got installed...


Tachyon(Posted 2008) [#21]
Thanks Brucey- after reading your post I decided to do a clean install of BlitzMax and then update to the latest development version. BlitzMax loaded and compiled flawlessly the first time.

I have tried to stay away from the SVN version simply because it is not supposed to be as stable as the official release, but this is the second time I've been proven wrong. Can we please get more frequent official updates?


dawlane(Posted 2008) [#22]
Brucey there is a one small problem using MaxGtk.mod on a 64bit system and that is not all the 32bit libs that are needed are installed or are in the repository. Looks like it would involve manually installing the libs and their dependencies (big head ache).
I haven't tried wxMax yet but I would guess that you would have to down load the wxWidgets source and re-build with a few arguments added to the command line.


ragtag(Posted 2008) [#23]
I was planing to update my old game over the holidays, and doing a linux version. Any chance of a quick how to on using BlitzMax in Ubuntu 8.10?

Like required libraries and how to build the different parts needed.

I know Linux tends to be a figure it out yourself or with the help of the community, but BlitzMax seems to be harder than most to get working. :)


dawlane(Posted 2008) [#24]
The libs to use are the same as for 8.04 don't forget it enable the restricted graphic drives (if any).

Sudo apt-get install libglu1-mesa-dev x11proto-core-dev x11proto-gl-dev x11proto-kb-dev libxxf86vm-dev libasound2-dev build-essential libidn11-dev

As g++-3.3 is no longer in the repositories you have to install g++-4.3
Then you have two choices: download the svn (I believe it's been fix for gcc-4.3. I haven't played with Linux for a while as I've been working/learnig with Cinema 4D R10.5) or use BlitzMax 1.30 with skidraces fix above and a couple of system links to redirect BlitzMax to use 4.3 instead of 3.3

sudo ln -s /usr/bin/gcc-4.3 /usr/bin/gcc-3.3
sudo ln -s /usr/bin/g++-4.3 /usr/bin/g++-3.3

Then rebuild all modules.
And all should be well