Setup Gendev linux [Solved]

SGDK only sub forum

Moderator: Stef

Post Reply
Montserrat
Very interested
Posts: 115
Joined: Fri Sep 18, 2015 2:56 pm

Setup Gendev linux [Solved]

Post by Montserrat » Fri Jan 15, 2016 11:33 pm

CRAP! continue reading:

[SOLVED]

Just stick to the instructions.
Last edited by Montserrat on Wed Jan 20, 2016 4:01 pm, edited 2 times in total.

cero
Very interested
Posts: 338
Joined: Mon Nov 30, 2015 1:55 pm

Re: Setup Gendev + Codeblocks in debian, compiling problem.

Post by cero » Sat Jan 16, 2016 9:59 am

make.exe is a Windows binary. You are on Linux.

Montserrat
Very interested
Posts: 115
Joined: Fri Sep 18, 2015 2:56 pm

Re: Setup Gendev + Codeblocks in debian, compiling problem.

Post by Montserrat » Sun Jan 17, 2016 9:58 am

cero wrote:make.exe is a Windows binary. You are on Linux.
Sure, obviously.

This is what Gendev builds for me, windows executables in a linux package. I only followed the instructables.

How do you configure codeblocks (or any other ide) to compile from linux? i've used "make" in project's directory terminal, it does generate a output .bin rom, but it does not work. (windows done this great).

btw i am compiling the Hello world example.

Grind
Very interested
Posts: 69
Joined: Fri Jun 13, 2014 1:26 pm
Location: US
Contact:

Re: Setup Gendev + Codeblocks in debian, compiling problem.

Post by Grind » Sun Jan 17, 2016 7:08 pm

Wrong makefile. You want gendev/sgdk/skeleton/Makefile

EDIT: It also appears your Code::Blocks projects is configured to use "make.exe" explicitly so you will probably want to change that as well. I don't use that IDE so I can't tell you where that is configured though.

Montserrat
Very interested
Posts: 115
Joined: Fri Sep 18, 2015 2:56 pm

Re: Setup Gendev + Codeblocks in debian, compiling problem.

Post by Montserrat » Sun Jan 17, 2016 11:15 pm

Grind wrote:Wrong makefile. You want gendev/sgdk/skeleton/Makefile

EDIT: It also appears your Code::Blocks projects is configured to use "make.exe" explicitly so you will probably want to change that as well. I don't use that IDE so I can't tell you where that is configured though.
seems you have a working linux sgdk enviorment....can i ask you for a little tutorial for dummies PLEAAASEEE??? :D :D :D

Grind
Very interested
Posts: 69
Joined: Fri Jun 13, 2014 1:26 pm
Location: US
Contact:

Re: Setup Gendev + Codeblocks in debian, compiling problem.

Post by Grind » Mon Jan 18, 2016 5:29 am

I'm not very good at tutorials but maybe this will explain it

Build Gendev

Code: Select all

sudo apt-get install build-essential texinfo
cd
git clone https://github.com/kubilus1/gendev
cd gendev
sudo make
Hello World program

Code: Select all

cd
cp gendev/sgdk/skeleton .
cd skeleton
mkdir src
cat <<EOF > src/main.c
#include <genesis.h>
void main() {
	VDP_init();
	VDP_drawText("Hello World!", 2, 2);
	while(1) {
		VDP_waitVSync();
	}
	return 0;
}
EOF
make
If something breaks that's probably because it is 12 AM and I didn't test these commands. Where are you stuck at the moment? Does "make" give you an error when you use the gendev makefile?

Montserrat
Very interested
Posts: 115
Joined: Fri Sep 18, 2015 2:56 pm

Re: Setup Gendev + Codeblocks in debian, compiling problem.

Post by Montserrat » Mon Jan 18, 2016 11:09 am

Thanks grind. That is what i previusly did, except for using cat to create a .c file i've used gedit...may be its the encoding?? i just moved to linux mint now because got problems to build gendev in debian, gonna start over again then ill tell you.

Montserrat
Very interested
Posts: 115
Joined: Fri Sep 18, 2015 2:56 pm

Re: Setup Gendev + Codeblocks in debian, compiling problem.

Post by Montserrat » Mon Jan 18, 2016 11:59 am

Got same results, a out.bin (and temp.bin) i load them into umdk but got blackscreen. Thats the terminal output:

Code: Select all

fran@fran-System-Product-Name ~/sk_test $ make
/opt/toolchains/gen//m68k-elf/bin/m68k-elf-as -m68000 --register-prefix-optional boot/sega.s -o boot/sega.o
/opt/toolchains/gen//m68k-elf/bin/m68k-elf-gcc   -m68000 -Wall -O2 -c -fomit-frame-pointer -I. -I/opt/toolchains/gen//m68k-elf/include -I/opt/toolchains/gen//m68k-elf/m68k-elf/include -Isrc -Ires -c src/main.c -o src/main.o
In file included from /opt/toolchains/gen//m68k-elf/include/genesis.h:11:0,
                 from src/main.c:1:
/opt/toolchains/gen//m68k-elf/include/memory.h:199:6: aviso: tipos en conflicto para la función interna ‘memset’ [activado por defecto]
 void memset(void *to, u8 value, u16 len);
      ^
/opt/toolchains/gen//m68k-elf/include/memory.h:242:6: aviso: tipos en conflicto para la función interna ‘memcpy’ [activado por defecto]
 void memcpy(void *to, const void *from, u16 len);
      ^
In file included from /opt/toolchains/gen//m68k-elf/include/genesis.h:15:0,
                 from src/main.c:1:
/opt/toolchains/gen//m68k-elf/include/string.h:83:5: aviso: tipos en conflicto para la función interna ‘strcmp’ [activado por defecto]
 s16 strcmp(const char *str1, const char *str2);
     ^
/opt/toolchains/gen//m68k-elf/include/string.h:237:5: aviso: tipos en conflicto para la función interna ‘sprintf’ [activado por defecto]
 u16 sprintf(char *buffer,const char *fmt, ...);
     ^
src/main.c:2:6: aviso: el tipo de devolución de ‘main’ no es ‘int’ [-Wmain]
 void main() {
      ^
src/main.c: En la función ‘main’:
src/main.c:8:4: aviso: ‘return’ con valor, en una función que devuelve void [activado por defecto]
    return 0;
    ^
/opt/toolchains/gen//m68k-elf/bin/m68k-elf-gcc  -o out.elf -T /opt/toolchains/gen//ldscripts/sgdk.ld -nostdlib   boot/sega.o /opt/toolchains/gen//m68k-elf/lib/libmd.a  /opt/toolchains/gen//m68k-elf/lib/gcc/m68k-elf/4.8.2/libgcc.a    src/main.o   -L/opt/toolchains/gen//m68k-elf/lib -L/opt/toolchains/gen//m68k-elf/lib/gcc/m68k-elf/* -L/opt/toolchains/gen//m68k-elf/m68k-elf/lib -lmd -lnosys 
/opt/toolchains/gen//m68k-elf/bin/m68k-elf-objcopy  -O binary out.elf temp.bin
dd if=temp.bin of=out.bin bs=8K conv=sync
10+1 registros leídos
11+0 registros escritos
90112 bytes (90 kB) copiados, 0,0004133 s, 218 MB/s
rm src/main.o out.elf
also changed void man for int main (i think the compiler expected int), bug got similar results...

The log warns about some functions conflict memset, memcpy, strcmp and sprintf any ideas?

Grind
Very interested
Posts: 69
Joined: Fri Jun 13, 2014 1:26 pm
Location: US
Contact:

Re: Setup Gendev + Codeblocks in debian, compiling problem.

Post by Grind » Mon Jan 18, 2016 2:50 pm

Did you only try UMDK or an emulator also? It has been some time since I last set up Gendev so I will try it again tonight or tomorrow in Ubuntu.

You can add an option to the compiler line "-nostdlib" or "-nobuiltin" don't quite remember which. That should get rid of the warnings.


As a bit of a side note, in the future it may be better to use Chris's cross compiler setup from UMDK to create our games. Problem is the makefiles are completely different than Gendev and the version of SGDK is old. When I have a solid free weekend I would like to come up with an example/instructions for updating SGDK in his environment as well as compiling a game with debugging. Second part should be easy basing it off the menu.

Montserrat
Very interested
Posts: 115
Joined: Fri Sep 18, 2015 2:56 pm

Re: Setup Gendev + Codeblocks in debian, compiling problem.

Post by Montserrat » Mon Jan 18, 2016 8:43 pm

Only tried UMDK, since the rom i compiled in the sgdk windows version worked fine in the umdk i suposse there is no problem with the cart.

Also gonna ask Gendev creator aswell...

kubilus1
Very interested
Posts: 237
Joined: Thu Aug 16, 2012 2:25 am
Contact:

Re: Setup Gendev + Codeblocks in debian, compiling problem.

Post by kubilus1 » Mon Jan 18, 2016 11:38 pm

cd
cp gendev/sgdk/skeleton .
... should be cp -r gendev/sgdk/skeleton .

This means the boot dir wasn't copies and is likely wrong. I don't have a convenient way to verify this on real hardware ATM, but I could see this leading to a blank screen. First step would be to verify on emulator perhaps.

Fyi, take a look here for some very basic instructions: https://github.com/kubilus1/gendev/
This is what Gendev builds for me, windows executables in a linux package. I only followed the instructables.
Nope. No windows executables here at all. Gendev is 100% pureish *nix. :wink:

Don't know about IDEs, I never use them. Unless vim is considered an IDE.

Good luck and don't get discouraged. Getting a decent workflow that works for YOU is probably one of the most difficult parts of this stuff!

Montserrat
Very interested
Posts: 115
Joined: Fri Sep 18, 2015 2:56 pm

Re: Setup Gendev + Codeblocks in debian, compiling problem.

Post by Montserrat » Tue Jan 19, 2016 9:37 am

kubilus1 wrote:
cd
cp gendev/sgdk/skeleton .


... should be cp -r gendev/sgdk/skeleton .

Fyi, take a look here for some very basic instructions: https://github.com/kubilus1/gendev/
This is what Gendev builds for me, windows executables in a linux package. I only followed the instructables.
Nope. No windows executables here at all. Gendev is 100% pureish *nix. :wink:
Yup thanks for reply, about the skeleton directory, yes i copied recursively. Also followed the official intructions with same results i did:

Code: Select all

sudo apt-get install build-essential texinfo git

git clone https://github.com/kubilus1/gendev.git

cd gendev

make

....building process.


 cp -r /opt/toolchains/gen/skeleton myfolder (also tried to copy cp -r gendev/sgdk/skeleton)
 cd myfolder

*type type type the hello world example from sgdk wiki* 

  make
It makes a rom.bin and a temp.bin, but with errors, pasted the terminal log above. i am missing something?

kubilus1
Very interested
Posts: 237
Joined: Thu Aug 16, 2012 2:25 am
Contact:

Re: Setup Gendev + Codeblocks in debian, compiling problem.

Post by kubilus1 » Tue Jan 19, 2016 10:01 pm

What about running the out.bin in an emulator? Does that work?

Montserrat
Very interested
Posts: 115
Joined: Fri Sep 18, 2015 2:56 pm

Re: Setup Gendev + Codeblocks in debian, compiling problem.

Post by Montserrat » Wed Jan 20, 2016 3:59 pm

:? ....done a fresh install on mint, now it works....i've done this 1000 times without results i dont know wtf has happened but...

... problem solved, it works now both emulator and UMDK.

Thanks for your time!

PD: mod can you close this thread?

Post Reply