problems compiling from source
- Inicie sesión o regístrese para enviar comentarios
hello
i am trying to create a libre version of this program:
http://gbdk.sourceforge.net/
the majority of the program is licensed under the gpl
so it should not be too hard to make a replacements for the programs
the have no license or are under the lcc license which permits commercial redistribution
the problem is i cant get started as i keep getting errors in the source code when compiling
its the gnu/linux version and i have tried on 64 and 32-bit machines with the same results
and i have tried with multiple version of the program
the command i run is make
and this is the error i get:
SDCC.y: In function ‘yyparse’:
SDCC.y:1004:4: error: label at end of compound statement
default:
^
make[2]: *** [SDCCy.o] Error 1
make[2]: Leaving directory `/home/tom/gbdk/sdcc/src'
make[1]: *** [sdcc-cc] Error 2
make[1]: Leaving directory `/home/tom/gbdk/sdcc'
make: *** [sdcc-build] Error 2
dose anyone know why this may happen and/or what the solution would be?
i think the devs would be able to compile the program before releasing it?
also i think the last update of the program was in 2002
dose old c code not compile on modern compilers?
also before it was giving me errors that i had not install some dependency’s
these were
bison
jlex
so if anyone is trying to do this make sure to run this command:
sudo apt-get install bison jlex
the os i was using is trisquel 7 64-bit and i also tried it on a 32-bit trisquel install
Adjunto | Tamaño |
---|---|
gbdk-2.96a.tar.gz | 1.97 MB |
that some nice project tomlukey - keep it up!
:)
thanks but i cant even start unless i can compile this program from source
also just to let you know i didn’t down vote you
tomlukey- my knowledge of gnu is very very basic. I'm a newb, so I cannot certainly help you with this - I just wanted to say that your project is good and that you should persist until you make it!
cheers bro
you need install Bison
if dont work
install old bison
i did install bison with
sudo apt-get install bison
and it didnt give a error that the version of bison was wrong
hi
nao I test the sors
the error in line 1006 in file SDCC.y
// werror(W_PTR_TYPE_INVALID);
it would be
werror(W_PTR_TYPE_INVALID);
the compiler was complaining that it needed
a program called lex
a program called flex seems to be the same
thing
so i installed the program flex
with sudo apt-get install flex
and it solved that problem
but now when it tries to compile
it gives lots of undefined references
gcc -o ../bin/sdcc SDCCerr.o NewAlloc.o MySystem.o BuildCmd.o SDCCy.o SDCChasht.o SDCCmain.o SDCCsymt.o SDCCopt.o SDCCast.o SDCCmem.o SDCCval.o SDCCicode.o SDCCbitv.o SDCCset.o SDCClabel.o SDCCBBlock.o SDCCloop.o SDCCcse.o SDCCcflow.o SDCCdflow.o SDCClrange.o SDCCptropt.o SDCCpeeph.o SDCCglue.o spawn.o asm.o SDCCmacro.o SDCCutil.o SDCClex.o z80/port.a -lm
SDCCglue.o: In function `tempfilename':
/home/tom/gbdk/sdcc/src/SDCCglue.c:1573: warning: the use of `tmpnam' is dangerous, better use `mkstemp'
/home/tom/gbdk/sdcc/src/SDCCglue.c:1566: warning: the use of `tempnam' is dangerous, better use `mkstemp'
SDCCmain.o: In function `preProcess':
/home/tom/gbdk/sdcc/src/SDCCmain.c:1311: undefined reference to `yyin'
SDCCmain.o: In function `main':
/home/tom/gbdk/sdcc/src/SDCCmain.c:1553: undefined reference to `yyin'
/home/tom/gbdk/sdcc/src/SDCCmain.c:1610: undefined reference to `yyin'
SDCCy.o: In function `yyparse':
/home/tom/gbdk/sdcc/src/SDCCy.c:4001: undefined reference to `yyerror'
/home/tom/gbdk/sdcc/src/SDCCy.c:1986: undefined reference to `yylex'
SDCCy.o: In function `yyparse':
/home/tom/gbdk/sdcc/src/SDCC.y:499: undefined reference to `yytext'
/home/tom/gbdk/sdcc/src/SDCC.y:485: undefined reference to `yytext'
SDCCy.o: In function `yyparse':
/home/tom/gbdk/sdcc/src/SDCCy.c:4145: undefined reference to `yyerror'
SDCCy.o: In function `yyparse':
/home/tom/gbdk/sdcc/src/SDCC.y:503: undefined reference to `yytext'
/home/tom/gbdk/sdcc/src/SDCC.y:489: undefined reference to `yytext'
SDCCsymt.o: In function `newSymbol':
/home/tom/gbdk/sdcc/src/SDCCsymt.c:293: undefined reference to `yylineno'
SDCCsymt.o: In function `mergeSpec':
/home/tom/gbdk/sdcc/src/SDCCsymt.c:567: undefined reference to `yytext'
SDCCast.o: In function `newAst_':
/home/tom/gbdk/sdcc/src/SDCCast.c:116: undefined reference to `yylineno'
/home/tom/gbdk/sdcc/src/SDCCast.c:117: undefined reference to `currFname'
SDCCast.o: In function `createFunction':
/home/tom/gbdk/sdcc/src/SDCCast.c:4142: undefined reference to `yylineno'
SDCCval.o: In function `newiList':
/home/tom/gbdk/sdcc/src/SDCCval.c:59: undefined reference to `yylineno'
collect2: error: ld returned 1 exit status
make[2]: *** [../bin/sdcc] Error 1
make[2]: Leaving directory `/home/tom/gbdk/sdcc/src'
make[1]: *** [sdcc-cc] Error 2
make[1]: Leaving directory `/home/tom/gbdk/sdcc'
make: *** [sdcc-build] Error 2
i noticed one of the lines mentions lex:
/home/tom/gbdk/sdcc/src/SDCCy.c:1986: undefined reference to `yylex'
could this be caused by missing library’s or is this just a bug in the program i need to try and fix?
Yeah, that sounds about right. Either libraries missing or flags not included in the compile command.
It could be other things, like bad includes and other pre-processor tasks, but less likely and harder to fix, if you are not familiar with the code and there are some bad practices in the code as reported by another user-
Those are linkage errors.Try to erase the .o file ('make clean' probably does the work) and recompile. If the problem persists, then you are missing libraries.
In fact, the program contains thousands of errors
Errors in the writing of the names and a lot of mistakes
I Surprised that the programmer did not notice its
the libre part of the dev kit sdcc was actually in the trisquel repository’s
i just used apt-get source sdcc
so it was very easy to compile
now i just need to find a replacement for the other
parts of the dev kit
also i discovered a command in the trisquel sdcc
that recommends non-free software:
sdcc --use-non-free
in sddc --help this is what it said:
--use-non-free Search / include non-free licensed libraries and header files
if there are any trisquel devs looking at this
i have made a modified version of the SDCC code so it dose not include the non-free option:
http://92.19.232.58:82/files/sdcc-3.3.0+dfsg.tar.bz2
the source was to big to upload to trisquel.info
so i hosted it on my own website
to install run
./configure and then
sudo make install
or if you just want the binary’s and don’t want to install
just run make
and the binary’s should be in the bin directory
so now i just need to work out how sdcc compiles gameboy programs
I'd recommend making a Gitorious repository so you can keep everything better organized than having a bunch of archives on your web server. :-)
https://gitorious.org/
i created a account and its asking me for a public ssh key
what is this?
i have never used git before
A public SSH key is what you use to identify yourself to the server. I don't remember if Gitorious has a guide to setting them up, but you can generate your public key with ssh-keygen.
when i ran
ssh-keygen it asks for a password
why dose it need a password?
are the files hosted on the gitorios server or are they decentralized and stored on individual computers?
am i meant to be hosting my own ssh server for this to work?
1. The password is optional. It's for encryption, I'd guess.
2. Once the code is pushed to the Gitorious repository, it is hosted on their server. The difference between GitHub and Gitorious is the software running Gitorious is free (Affero GPL,) while the software running GitHub is not.
3. You don't have to run an ssh server to generate a ssh key.
You don't need to have an SSH server, you're just using an SSH client to connect to Gitorious's SSH server. It's used for authentication (more secure than passwords).
thanks that explained alot!
but i am trying to create the project on github and
its wanting me to enter a slug??
what exactly is this?
i attached a screenshot
(I'm sure you meant Gitorious...)
A slug shows in the URL, https://gitorious.org/mediagoblin for example.
yes i did mean gitorious
i typed it without thinking!
thanks for the info
its now on Gitorious!
https://gitorious.org/sdcc-without-non-free
its gpl v2 becuase thats what sdcc is licensed under
i would pick gpl v3 if i could
but how do you upload the source code?
Create a Git repository, and push your source code into it.
Git has a really steep learning curve, but Gitorious tells you how to get started when you try to browse an empty repository, at least.
i have found tutorials of how to upload to git hub i assume its the same for gitorios
and i have got to this point
git remote add origin http://gitorious.org/sdcc-without-non-free/
git push -u origin master
the problem is all the tutorials tell me to do this
with the url being where the git repo is
but i dont have one yet
how do you create a blank git repo in gitorios?
i have found tutorials of how to upload to git hub i assume its the same for gitorios
and i have got to this point
git remote add origin http://gitorious.org/progject_name.git
git push -u origin master
the problem is all the tutorials tell me to do this
with the url being where the git repo is
but i dont have one yet
how do you create a blank git repo in gitorios?
On the project page there is a blue "Add new" button on the mid-right of the screen. There is a guide on the new repository page on how to push code to it.
You need to be logged in.
thanks for some reason when i logged in in icecat
it would not keep me logged it i then used abrowser and it now works fine!
here is the gitorios repo:
https://gitorious.org/sdcc-without-non-free/sdcc-without-non-free
i ran make clean
and nothing changed so i am probably missing some library's
i got a more modern version of sdcc(libre)
it is a small device c compiler
with no standard library
and from reading its manual(http://sdcc.sourceforge.net/doc/sdccman.pdf) you should be able to compile
a gameboy application like this:
sdcc -mgbz80 main.c
but when i do i dont get a executable
i just get lots of text files
including a .asm file
i have included them as a attachment
so the compiler seems to only translate the c code
into assembly but not turn it into a executable program
this is confusing as the gbdk has lcc and sdcc
why would it need 2 compilers?
dose sdcc only assemble the program and lcc compile it?
the main.c file is this:
/*this program has not purpose
its just a test
*/
unsigned char i = 3;
int main(){
i++;
i = 110;
i = 0;
i = 8;
return 0;
}
dose anyone know how to compile for the gameboy with sdcc
if you can?
Adjunto | Tamaño |
---|---|
files.tar.bz2 | 2.72 KB |
I don't think sdcc works with binary files. I think you are supposed to use the ".ihx" (intel hex) file with the device you want. This file contains binary code translated into hex format.
The documentation seems to confirm this (http://sdcc.sourceforge.net/doc/sdccman.pdf).In this document you will also find what each output file contains.
Edit: Comment on the file spec
so how do i make this run on a gameboy?
i tried renaming it to a .gb file and running it in a emulator but it gave me a error
i assume this was becuase the file was in the ASCII format
if the file was pure hex would it run?
You'll probably need to invoke the assembler separately from the C compiler in your Makefile. Package srecord handles the Intel Hex which will be output but depending on the emulator you will likely need to cook it in other ways too (e.g. add ROM reader info to the image).
Lastly, in future please file Issues / Bugs when you have a GNU FSDG patch. Trisquel has two devs and a handfull of apprentice devs like myself, with such limited resources it's simply not humanly possible to cover the whole of the forum's content for potential bug fixes.
i will do this in the future
tomlukey - try on irc freenode gitoriuos
- Inicie sesión o regístrese para enviar comentarios