Page 1 of 1

Problem with SGDK via command line

Posted: Sat Jul 14, 2012 9:28 am
by zedman3d
Hello. Im new to mega drive dev.

Im sure its something simple but im getting errors when following these steps in the SGDK command line tutorial
http://code.google.com/p/sgdk/wiki/HowToUseSGDK

Heres a screenshot of the command window to make things easier, 'compile the library command' and 'compile project command' are outlined in red for readability.

http://i50.tinypic.com/23mv6dw.png

Im thinking its to do with the warning in the wiki:
"Be careful, if you have another GCC installation you can have some conflicts when cc1 command will be called... " I did have codeblocks and codelite installed before trying (wanted to use command line though), i uninstalled to see if that made a difference but it didnt. Environment variables are set up correctly.

Any advice would help. Thank you.

EDIT: Problem is the same on my laptop. Both PC's run Windows 7 64bit...

Posted: Sat Jul 14, 2012 9:39 am
by greatkreator
You should add the sgdk bin directory to your PATH variable.

Posted: Sat Jul 14, 2012 9:52 am
by zedman3d
I went to control panel -> advanced system settings -> environment variables

then appeneded ;%GDK_WIN%\bin to the end of the systems 'Path' variable and my own users 'PATH' variable too. Same result.

EDIT: Ive even changed the PATH variable temporarily in CMD using
PATH=%PATH%;%GDK_WIN%\bin

Posted: Sat Jul 14, 2012 10:30 am
by greatkreator
When you type gcc in cmd do you see gcc's output?

Posted: Sat Jul 14, 2012 10:33 am
by zedman3d
Typing in just gcc gives:

gcc: no input files

Posted: Sat Jul 14, 2012 11:57 am
by greatkreator
Strange.
You should retry carefully all the steps in the tutorial.
It has been used by a lot of people and should work.
It is very likely you made a mistake.

Posted: Sat Jul 14, 2012 12:05 pm
by zedman3d
Oh yeh for sure. I know the tut is all good.
Ill keep at it.

Posted: Sat Jul 14, 2012 12:47 pm
by greatkreator
Or you have some strange system settings or name/executables clashes.

Posted: Sat Jul 14, 2012 1:45 pm
by zedman3d
^ Thats what im thinking.

Posted: Sat Jul 14, 2012 3:02 pm
by greatkreator
I had the same problem when I had few GCCs installed on the same system.

Posted: Sat Jul 14, 2012 4:47 pm
by Chilly Willy
Instead of putting it at the END of the PATH env variable, try it at the START. If there's another version of gcc interfering, having it at the start would give it priority where having it at the end would make it useless.

Posted: Sat Jul 14, 2012 7:34 pm
by Stef
The 'cc1' error as the makefile problems are typical of severals GCC installations conflicting. I'm pretty sure the make as the gcc compiler called aren't the good one.
If you type "gcc --version" what is displayed ?

Posted: Sun Jul 15, 2012 1:12 am
by zedman3d
Thanks guys its all working now.

So the problem was in fact the placement of the directory in the path variable at the end. So placing at the front solved the conflict. A note in the tutorial about this may help others. Also if putting it at the front causes problems with other programs now, it might be a good idea to suggest in the tutorial alternatively temporarily setting the path variable for the opened cmd window.

Thanks.

Posted: Sun Jul 15, 2012 5:00 am
by Chilly Willy
I have enough cross-compilers on my system that I now never put the compiler bin path in the path envvar. Instead, I write the makefiles to use the proper path to the appropriate cross-compiler. It's less hassle that way. A makefile would typically start like this (for the 32X)

Code: Select all

ifdef $(GENDEV)
ROOTDIR = $(GENDEV)
else
ROOTDIR = /opt/toolchains/sega
endif

LDSCRIPTSDIR = $(ROOTDIR)/ldscripts

LIBPATH = -L$(ROOTDIR)/sh-elf/lib -L$(ROOTDIR)/sh-elf/lib/gcc/sh-elf/4.6.2 -L$(ROOTDIR)/sh-elf/sh-elf/lib
INCPATH = -I. -I$(ROOTDIR)/sh-elf/include -I$(ROOTDIR)/sh-elf/sh-elf/include
That allows me to have an envvar with a path, or to use a set path. In either case, I don't use the system PATH envvar.