Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up --- Bug Reports --- Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: using different gcc compilers in Linux  (Read 4359 times)

0 Members and 1 Guest are viewing this topic.

MotorHedJr

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 46
  • Last login:October 06, 2015, 06:25:45 am
  • Christmas everyday!!!
using different gcc compilers in Linux
« on: December 15, 2005, 10:43:35 am »
Hello all:

Sorry, I originally put this post on the end of the d9200 and matrox g400 thread -- It is more appropriate here -- apologies to all for my oversight...)

Anyway, excellent work.  I have been trying to duplicate that matrox d9200 linux setup.  I am using Gentoo 2005.1 w/ KDE and ALSA.  I am having a problem compling SVGAlib 1.9.19.

It complies using 'make install' - however the svgalib_helper module is not listed.  Therefore, as per the Easy MAMEcab website, I must re-compile it being sure to use the same compiler that I complied my kernel with (2.6.12-gentoo-r6).

So I type:
[gcc --version]

This results in:

gcc (GCC) 3.3.5-20050130 (Gentoo 3.3.5.20050130-r1, ssp-3.3.5.20050130-1, pie-8.7.7.1)
Copyright (C) 2003 Free Software Foundation, Inc.

So then I enter:
[make CC=/opt/gcc-3.3.5/bin/gcc install]

This starts the build but always fails and ends up with following error:

make[1]: /opt/gcc-3.3.5/bin/gcc: Command not found
make[1]: *** [vga.o] Error 127
make[1]: Leaving directory `/usr/src/svgalib-1.9.19/sharedlib'
make: *** [sharedlib/libvga.so.1.9.19] Error 2
acm-wkockitidq3 svgalib-1.9.19 #

Yes I am a linux noob -- but I did some research to try to figure out the problem before posting it on the forum.

First, there is nothing in the /opt/ folder -- I guess there should be...

Second, this leads me to believe I need to install gcc --(specifically gcc 3.3.5).  Is this really necessary?  If so where do I put it?

Third, (at the risk of sounding ignorant) this confuses me.  If this gcc was the compiler used to compile my kernel then it exists somewhere in my Linux environment...  right?  Why is it not recognized in the 'make cc=/opt/gcc-3.3.5....' command line?

Thanks for looking at my post, any help would be greatly appreciated.

Happy Holidays to all.

-MH Jr.

Major Rock Hardy

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 261
  • Last login:April 29, 2013, 06:51:45 pm
  • xybots rocks!
Re: using different gcc compilers in Linux
« Reply #1 on: December 15, 2005, 03:34:17 pm »
yo-

I will try to help you...

So then I enter:
[make CC=/opt/gcc-3.3.5/bin/gcc install]

This starts the build but always fails and ends up with following error:

make[1]: /opt/gcc-3.3.5/bin/gcc: Command not found
make[1]: *** [vga.o] Error 127
make[1]: Leaving directory `/usr/src/svgalib-1.9.19/sharedlib'
make: *** [sharedlib/libvga.so.1.9.19] Error 2
acm-wkockitidq3 svgalib-1.9.19 #


now here's the quote from desmatic's Easy MAME Cab site where I think you are going wrong:
Quote
Note, you must build SVGAlib with the same compiler used to build your kernel. Type gcc --version; cat /proc/version at a command prompt if unsure. So, on an LFS build with gcc-2.95.3 you would use make CC=/opt/gcc-2.95.3/bin/gcc install, not just make install.

First off, if you are using gentoo linux, you should have a gcc installed already.  Also likely is that the gcc you already have installed is the one you used to compile your kernel (part of the gentoo install process).

do a:
cat /proc/version
(you may need to run this as root - I didn't)
... then do a:
gcc --version

you want the gcc version #s to match.  Let me know if they mismatch.  You might just post the results of each of these commands.

Desmatic was just giving an example of how you'd handle it if you needed to use a different version of gcc when you issue the make command.  Also, his example is for LFS (www.linuxfromscratch.org) - which uses /opt/gcc-version/bin/gcc as the gcc binary location in his case - perhaps he installed it there.  I'm not familiar w/ LFS so I'm not sure.  Gentoo's default location is /usr/bin/gcc.  You can find out where gcc is on a linux machine by typing:
which gcc

Rock

MotorHedJr

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 46
  • Last login:October 06, 2015, 06:25:45 am
  • Christmas everyday!!!
Re: using different gcc compilers in Linux
« Reply #2 on: December 16, 2005, 06:16:18 am »
Hi Rock,

Thanks.

Here are the results of those commands:

acm-wkockitidq3 motorhed_jr # cat /proc/version
Linux version 2.6.12-gentoo-r6 (root@acm-wkockitidq3) (gcc version 3.3.5-20050130 (Gentoo 3.3.5.20050130-r1, ssp-3.3.5.20050130-1, pie-8.7.7.1)) #7 SMP Fri Dec 2 14:45:43 EST 2005
acm-wkockitidq3 motorhed_jr # gcc --version
gcc (GCC) 3.3.5-20050130 (Gentoo 3.3.5.20050130-r1, ssp-3.3.5.20050130-1, pie-8.7.7.1)
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.

Major Rock Hardy

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 261
  • Last login:April 29, 2013, 06:51:45 pm
  • xybots rocks!
Re: using different gcc compilers in Linux
« Reply #3 on: December 16, 2005, 02:22:54 pm »
So then I did:

make CC=usr/bin/gcc install

This resulted in a successful build! -- Thank You!

So then I did:

acm-wkockitidq3 svgalib-1.9.19 # insmod kernel/svgalib_helper/svgalib_helper.ko
insmod: error inserting 'kernel/svgalib_helper/svgalib_helper.ko': -1 Unknown symbol in module

This is the same error I got when I did just a 'make install' -- so I guess gcc was compling it correctly the whole time -- now I understand.

So I looked at the svgalib_helper.ko file.  It is a binary file -- I do not know how to edit out this Unknown symbol...  Have you seen anything like this before?

Thanks again for your help.

-MH Jr.


MH, I think we are fighting similar fires on this one... see my thread at:

http://forum.arcadecontrols.com/index.php?topic=46747.0

Rock

p.s. for the record, I think if your gcc --version resolves to the same version as your kernel was built with, then the "CC=usr/bin/gcc" portion of the make install command is redundant, as verified by your comment that the error messages are the same as the "make install" command.  However I don't believe this is a make or gcc version issue - it's an svga-libs code vs. kernel code (and perhaps gentoo specific) issue.  I'm looking into it but see my thread for my progress, it will probably help you out.

MotorHedJr

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 46
  • Last login:October 06, 2015, 06:25:45 am
  • Christmas everyday!!!
Re: using different gcc compilers in Linux
« Reply #4 on: December 17, 2005, 09:19:32 am »
Hi Rock,

Congratulations!  I will study the entire thread and try it today/tomorrow on my setup.

Thanks again for your help.

MH Jr.

elvis

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1154
  • Last login:May 07, 2019, 09:23:10 pm
  • penguin poker
    • StickFreaks
Re: using different gcc compilers in Linux
« Reply #5 on: December 18, 2005, 02:33:24 am »
Just an FYI, under gentoo you can type:

gcc-config -l

to list all of the available compilers to the system.  Each compiler will have a number beside it.  For instance, on my system it reports:

Quote
elvis ~ # gcc-config -l
 [1] i686-pc-linux-gnu-3.3.6
 [2] i686-pc-linux-gnu-3.3.6-hardened
 [3] i686-pc-linux-gnu-3.3.6-hardenednopie
 [4] i686-pc-linux-gnu-3.3.6-hardenednopiessp
 [5] i686-pc-linux-gnu-3.3.6-hardenednossp
 [6] i686-pc-linux-gnu-3.4.4 *
 [7] i686-pc-linux-gnu-3.4.4-hardened
 [8] i686-pc-linux-gnu-3.4.4-hardenednopie
 [9] i686-pc-linux-gnu-3.4.4-hardenednopiessp
 [10] i686-pc-linux-gnu-3.4.4-hardenednossp

with the default being gcc-3.4.4 (marked with an asterisk (*))

Say I want to change the default compiler to an older one like 3.3.6 (marked as number 1 in the list above), I'd type:

gcc-config 1
env-update
source /etc/profile

This would change the default compiler, and then refresh all my environment information so that the current console is ready to go with the new compiler.  No need to force "CC=" command line arguments.

Gentoo is a source-based distro, and has a lot of neat tools like this built in to make compiling easier on the end user, both for novices and for experts who want to save time.

MotorHedJr

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 46
  • Last login:October 06, 2015, 06:25:45 am
  • Christmas everyday!!!
Re: using different gcc compilers in Linux
« Reply #6 on: December 19, 2005, 05:35:24 pm »
Hi elvis, Major Rock,

Major Rock - following your link to your thread I got it working -- Thank You!!!

One question:

elvis

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1154
  • Last login:May 07, 2019, 09:23:10 pm
  • penguin poker
    • StickFreaks
Re: using different gcc compilers in Linux
« Reply #7 on: December 19, 2005, 06:15:43 pm »
Quote from: MotorHed
[color=Beige
elvis[/color] - thanks for the info.  How do you guys learn all these tricks?  I have tried to find a decent Linux book for beginners, but they either suk (only show how to work in a desktop environment) or are specific to a distro.  Do you know of a decent gentoo linux book?

"Linux" is a kernel.  Finding generic books on "Linux" won't help you, as they all cover very general kernel and GNU stuff.

Each distribution often contains a lot of customisations, particularly when it comes to package managment.  Upgrading old packages and getting new packages onto a system are generally fairly unique things distro to distro, and the best resource is always the website of the distro itself.  Likewise system-sepcific configuration (Gentoo has some amazing tools to manage system config and startup rc scripts).  Basic skills such a file manipulation, scritping, etc will translate easily between distros.

If you're a Gentoo user, then you absolutely *must* read the Gentoo handbook from start to finish.  Yes, a lot of it is boring and obvious, but tucked away inside it are great tips and tricks like the ones I posted above:
http://www.gentoo.org/doc/en/handbook/handbook-x86.xml

Other languages, viewing formats and architectures available here:
http://www.gentoo.org/doc/en/handbook/index.xml

Even seasoned old fogeys like myself should re-read these things from time to time to refresh our skills.  There is no such thing as "good" or "bad" Linux users.  There are only users who either have or haven't RTFM. :)

Outside of that, the Gentoo forums are incredible.  They are simply some of the best Linux forums I've ever had the pleasure of subscribing to, and full of ultra-friendly people.  If you've ever got a drama, post something there and you'll be bound to have a detailed and helpful response within a day or so.

Major Rock Hardy

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 261
  • Last login:April 29, 2013, 06:51:45 pm
  • xybots rocks!
Re: using different gcc compilers in Linux
« Reply #8 on: December 20, 2005, 01:03:10 pm »
I agree with elvis about the gentoo handbooks!  However, I highly recommend O'Reilly books - the one that I keep around is "Running Linux".  You can find info here:

http://www.oreilly.com/catalog/runux4/

however, most distributions of Linux have slightly different variations on how they do things - for that - enter the gentoo handbooks.

Hi elvis, Major Rock,

Major Rock - following your link to your thread I got it working -- Thank You!!!

One question:  How do you permanently insert the svgalib_helper module?  Whammoed's site says:

[add svgalib_helper to the /etc/modules/.autoload.d/<kernel_version> to load the module at boot time]

Do you mind listing the command line you used to do this? (I would hate to screw up my kernel at this point...)

Again, thanks!!!


I'm glad you got it working - that one was a pain.  I had to dip back to my C programming knowledge a bit to resolve that one.  As far as your autoload kernel module question, whammoed's guide was for his linux distro (I believe LFS) - for gentoo, it's different.  This is one of those places where things diverge a bit based on the distro.  For gentoo, you're going to modify /etc/modules.autoload.d/kernel-2.6 (assuming you are using a 2.6 kernel (which you should be - you chose to do this during gentoo install).

I use VI to edit files - but I use that for work every day so I am used to it.  Actually I use vim which is vi- improved.  It is not user-friendly for the beginner user.  But it is very powerful if you learn it.  If you just want to get by with a windows-notepad-style editor, gentoo includes one called nano.  To use this, just type:
nano <name of file>

also under most Unixes, to find out how to use a command, type:
man <command>

which will bring up the manual for that software.  So you should do a man nano before using nano, so that you know how to exit the program once you're done using it, etc.

if you are interested in vim (my favorite), you can get it by doing
emerge vim

so, in summary, to change my autoload configuration, I used the command:
vim /etc/modules.autoload.d/kernel-2.6

and I think the O'Reilly book Running Linux has a brief intro to vi in there.  They also publish a vi book.  But there are numerous vi/vim beginner pages out there - just google for them.

Hope this helps,
Rock

Major Rock Hardy

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 261
  • Last login:April 29, 2013, 06:51:45 pm
  • xybots rocks!
Re: using different gcc compilers in Linux
« Reply #9 on: December 20, 2005, 01:19:22 pm »
Oh, it looks like they have a 5th edition coming out:

http://www.oreilly.com/catalog/runlinux5/

click on the 'Table of Contents' link to get a preview... looks like just what you are looking for.

Rock

whammoed

  • Trade Count: (+4)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2284
  • Last login:Today at 12:38:21 pm
  • Crack don't smoke itself
    • NiceMite
Re: using different gcc compilers in Linux
« Reply #10 on: December 20, 2005, 07:04:39 pm »
I'm glad you got it working - that one was a pain.

whammoed

  • Trade Count: (+4)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2284
  • Last login:Today at 12:38:21 pm
  • Crack don't smoke itself
    • NiceMite

MotorHedJr

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 46
  • Last login:October 06, 2015, 06:25:45 am
  • Christmas everyday!!!
Re: using different gcc compilers in Linux
« Reply #12 on: December 20, 2005, 07:12:48 pm »
Hi Rock,

OK, I got the svgalib_helper module to autoload (I just used nano - that's what I used to build my gentoo-2005.1) -- Many thanks!!!

After some more tinkering today, I need to ask just a couple more questions (thanks for your help and patience...)

Many, many, games run flawlessly...

Major Rock Hardy

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 261
  • Last login:April 29, 2013, 06:51:45 pm
  • xybots rocks!
Re: using different gcc compilers in Linux
« Reply #13 on: December 21, 2005, 12:51:39 pm »
wait, its not a typo, here is what i have:
add svgalib_helper to /etc/modules.autoload.d/<kernel_version> to load the module at boot time

you just need to replace <kernel_version> with the kernel you are using

oops, yes you are right.  It must be desmatic who uses LFS... anyway I was confused by:
Whammoed's site says:

[add svgalib_helper to the /etc/modules/.autoload.d/<kernel_version> to load the module at boot time]


... which was a typo (stray "/" )

OK anyway...
Hi Rock,

OK, I got the svgalib_helper module to autoload (I just used nano - that's what I used to build my gentoo-2005.1) -- Many thanks!!!

great...

After some more tinkering today, I need to ask just a couple more questions (thanks for your help and patience...)

Many, many, games run flawlessly... 

However, a few (especially older ones, i.e. pacman, galaga, 1941... )give the following error on my test setup (2.6.12-gentoo-r6/matrox G400/standard VGA PC monitor):

svgalib: Failed to initialize mouse.
Function vga_hasmode() failed. Have you adjusted
the HorizSync and VertRefresh in /etc/vga/libvga.config ?
Unable to start video emulation
Error process exited with status 1.


well, like it says, Have you adjusted the HorizSync and VertRefresh in /etc/vga/libvga.config ?  Do you remember doing this?  From whammoed's site: "Once installed you need to edit /etc/vga/libvga.conf and modify the HorizSync and VertRefresh so that it matches your monitors capabilities."  It seems that your defaults in /etc/vga/libvga.config might be limiting advmame.  If you did do this - perhaps your monitor can't handle low horizontal sync or something similar.

Again, this is only for certain games -- I'm still using my PC VGA monitor.  In my old setup (win98) every game worked once everything was setup using the VGA monitor -- it seems weird that some games do not work.

I feel like I've learned enough to say this is like comparing apples (mame) and oranges (advmame).  I assume your old setup was standard windows mame.exe and not advance mame for windows?  I believe the difference is in how the two programs try to tackle video modes by default.  Advancemame goes for "authentic", whereas mame.exe goes for "make it work".  Perhaps others could comment if I'm wrong.

Anyway, I tried to first tackle the mouse problem by studying Desmatics and Whammoed's 'd9200 and matrox g400' post.  Seems like a permission issue with the /dev/ folder and the /dev/input device

so when in as root and typed:

chmod 777 dev

and

chmod 777 dev/input/mouse(0-3)

Rock, this had no results.  Did you encounter an issue like this?

Again thanks for all your help -- I could not have done this w/ out your help...

-MH Jr.

No problem.  Well, you apparently have more time to tinker than I have - I got svgalib working but didn't go much futher (been busy) - so I haven't had any time to debug the mouse error message.

Rock

elvis

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1154
  • Last login:May 07, 2019, 09:23:10 pm
  • penguin poker
    • StickFreaks
Re: using different gcc compilers in Linux
« Reply #14 on: December 21, 2005, 07:44:43 pm »
I feel like I've learned enough to say this is like comparing apples (mame) and oranges (advmame).  I assume your old setup was standard windows mame.exe and not advance mame for windows?  I believe the difference is in how the two programs try to tackle video modes by default.  Advancemame goes for "authentic", whereas mame.exe goes for "make it work".  Perhaps others could comment if I'm wrong.

AdvanceMAME can be configured to use SDL ontop of X, and thus simply spit out stretched fullscreen video via SDL just like you would in MAME on Windows with DirectX.  So in a sense, AdvanceMAME can be "dumbed down" to act just like Windows MAME.  Likewise Windows MAME can draw to real arcade resultions, supposing you have the software loaded (either via video drivers, or custom via PowerStrip etc).  So with a bit of effort, it can work similarly to AdvanceMAME and the associated tools.

So there's a bit of overlap there, if you work it in.  But generally speaking on default installs, yes you're right. :)

MotorHedJr

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 46
  • Last login:October 06, 2015, 06:25:45 am
  • Christmas everyday!!!
Re: using different gcc compilers in Linux
« Reply #15 on: December 22, 2005, 06:27:15 pm »
Hi Elvis, Rock,

You are both correct -- I was wrong.

whammoed

  • Trade Count: (+4)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2284
  • Last login:Today at 12:38:21 pm
  • Crack don't smoke itself
    • NiceMite
Re: using different gcc compilers in Linux
« Reply #16 on: December 22, 2005, 08:11:27 pm »
Excellent.  I actually use the event type for mice now though.  It works in the most recent builds of advmame and according to Andrea it is the preferred choice for Linux. (the raw type would be a little quirky on occassion)

MotorHedJr

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 46
  • Last login:October 06, 2015, 06:25:45 am
  • Christmas everyday!!!
Re: using different gcc compilers in Linux
« Reply #17 on: December 22, 2005, 08:54:08 pm »
Hello All,

Correction to my post:

First in my advmame.rc (from Whammoed's site)
----snip----
device_raw_mousedev[0] /dev/input/mouse0
device_raw_mousedev[1] none
device_raw_mousedev[2] none
device_raw_mousedev[3] none
device_raw_mousetype[0] imps2
device_raw_mousetype[1] none
device_raw_mousetype[2] none
device_raw_mousetype[3] none
device_mouse svgalib

---snip---

The following lines should have been listed as commented out:

#device_raw_mousetype[1] none
#device_raw_mousetype[2] none
#device_raw_mousetype[3] none


Otherwise, AdvMAME will not launch...

MotorHedJr

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 46
  • Last login:October 06, 2015, 06:25:45 am
  • Christmas everyday!!!
Re: using different gcc compilers in Linux
« Reply #18 on: December 23, 2005, 08:40:40 am »
SUCCESS!!!

After thinking about it -- it occurred that it must be a advMAME parameter issue if the driver (raw) is working in the advm utility...

So I changed the AdvMAME parameter:

device_mouse raw

and it worked!

whammoed

  • Trade Count: (+4)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2284
  • Last login:Today at 12:38:21 pm
  • Crack don't smoke itself
    • NiceMite
Re: using different gcc compilers in Linux
« Reply #19 on: December 23, 2005, 09:41:09 am »
if you want to try event just use

device_mouse event

there are no other setting like there are for raw

i can't remember exactly what I type to change permissions but I did use chmod
the settings stuck after reboot

MotorHedJr

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 46
  • Last login:October 06, 2015, 06:25:45 am
  • Christmas everyday!!!
Re: using different gcc compilers in Linux
« Reply #20 on: December 24, 2005, 10:14:17 am »
hi Whammoed,

Tried some other stuff last night:

chmod 777 -R /dev

chown motorhed_jr /dev


Nothing stays after a re-boot.

Major Rock Hardy

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 261
  • Last login:April 29, 2013, 06:51:45 pm
  • xybots rocks!
Re: using different gcc compilers in Linux
« Reply #21 on: January 10, 2006, 07:28:08 pm »
Motorhed-

are you still having ownership/permissions issues with your /dev stuff?

I would start looking through this:
http://www.reactivated.net/writing_udev_rules.html

...specifically #13. Controlling ownership and permissions

I believe though since you're using a pretty new kernel on a Gentoo system, that udev and probably hotplug are already installed, so keep that in mind as you read...

another resource:
http://www.gentoo.org/doc/en/udev-guide.xml

Cheers,
Rock

MotorHedJr

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 46
  • Last login:October 06, 2015, 06:25:45 am
  • Christmas everyday!!!
Re: using different gcc compilers in Linux
« Reply #22 on: January 14, 2006, 05:22:04 pm »
Hi Rock,

I checked out the first link and that worked...

THANKS!!!!!!!!

(just a matter of making your own rules file, and using the MODE=0777 option for the mouse kernel).

Again thanks!

-MH Jr.