Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.

Very First Try at C Compilation

Last updated on 6 days ago
N
NathanHMember
Posted 10 days ago
Hi,

Total noob. I compiled the 64bit linux cross-compilation tools and thought I'd give a go at compiling pForth 2.0.1 for AROS 64-bit. There is a makefile for Unix which works fine for linux 64- and 32-bit executables. I'm totally guessing, but I figured that if I put CC=x86_64-aros-gcc at the start of the file it would use the AROS rather than linux gcc. That seemed to work except I get the following errors right off the bat. It doesn't like "int" at all. Is there some sort of flag I should be using so it isn't so confused? Maybe __header_inline needs to be defined somewhere. Any help would be appreciated. pForth is supposed to be easy to compile so I figure if I can get this one under my belt I can try other things. Thanks.

NathanH

x86_64-aros-gcc -x c -O2 --std=c89 -fsigned-char -fno-builtin -fno-unroll-loops -pedantic -Wcast-qual -Wall -Wwrite-strings -Winline -Wmissing-prototypes -Wmissing-declarations -g -I. -DPF_SUPPORT_FP -D_DEFAULT_SOURCE -D_GNU_SOURCE -c -o pf_cglue.o ../../csrc/pf_cglue.c
In file included from ../../csrc/pf_inc1.h:34,
from ../../csrc/pf_all.h:48,
from ../../csrc/pf_cglue.c:22:
/home/nhesterm/sda7/myprojects/arosbuilds/core-linux-x86_64-d/bin/linux-x86_64/AROS/Development/include/aros/posixc/stdio.h:113:17: error: expected ',' or ';' before 'int'
113 | __header_inline int getw(FILE *stream)
| ^~~
/home/nhesterm/sda7/myprojects/arosbuilds/core-linux-x86_64-d/bin/linux-x86_64/AROS/Development/include/aros/posixc/stdio.h:119:17: error: expected ',' or ';' before 'int'
119 | __header_inline int putw(int word, FILE *stream)
| ^~~
In file included from ../../csrc/pf_inc1.h:38,
from ../../csrc/pf_all.h:48,
from ../../csrc/pf_cglue.c:22:
/home/nhesterm/sda7/myprojects/arosbuilds/core-linux-x86_64-d/bin/linux-x86_64/AROS/Development/include/aros/stdc/math.h:213:17: error: expected ',' or ';' before 'int'
213 | __header_inline int
| ^~~
/home/nhesterm/sda7/myprojects/arosbuilds/core-linux-x86_64-d/bin/linux-x86_64/AROS/Development/include/aros/stdc/math.h:219:17: error: expected ',' or ';' before 'int'
219 | __header_inline int
| ^~~
/home/nhesterm/sda7/myprojects/arosbuilds/core-linux-x86_64-d/bin/linux-x86_64/AROS/Development/include/aros/stdc/math.h:225:17: error: expected ',' or ';' before 'int'
225 | __header_inline int
| ^~~
make: *** [Makefile:77: pf_cglue.o] Error 1
D
deadwoodAROS Dev
Posted 9 days ago
My first guess is that your cross-compiler setup is a mix of old and new files (did you update your git tree recently?) I'd suggest doing a full rebuild of cross compiler and core targets at this point.
N
NathanHMember
Posted 9 days ago
@deadwood

Thanks, I rebuilt the toolchain to make sure that it wasn't the problem but get the same errors. Was able to successfully compile other stuff with it; just this pForth giving the errors.

NathanH
D
deadwoodAROS Dev
Posted 9 days ago
Hmm, then check in pForth sources itself whether it is not redefining/undefining __header_inline
D
deadwoodAROS Dev
Posted 9 days ago
Alternativelly add -DAROS_SAFE_HEADERINLINE to your compiler command line (for example after -D_GNU_SOURCE).
N
NathanHMember
Posted 9 days ago
@deadwood,

I added -DAROS_SAFE_HEADERINLINE but get the same error. I'll search the sources like you suggested. Thanks.

NathanH
N
NathanHMember
Posted 9 days ago
@deadwood,

A search for "__header_inline" in the source code turned up empty. Would it make a difference that I installed "myrepo" toolchain for 32bit compilation on the same partition right after I installed the 64bit toolchain in "myprojects"?

NathanH
D
deadwoodAROS Dev
Posted 9 days ago
Hmm the repo for 32-bit compilation needs to be a phisically separate one from the repo for 64-bit compilation. They are on different branches, so everything about them needs to be separate.
D
deadwoodAROS Dev
Posted 9 days ago
If you can give me a link to the source of pFort I can try to see if I get the same errors with my cross compiler setup.
N
NathanHMember
Posted 9 days ago
Sure, its at https://github.co...v2.0.1.zip

Nathan
F
FaroxMember
Posted 9 days ago
Hi NathanH
For the toolchains it's fine to have both on the same partition (but obviously on different directory).
Like you write the 32 bit is on "myrepo" dir and the 64bit is on "myprojects" dir, i have also this config and its fine.

Regarding PForth i think the makefile for the Unix version need more check and adjustment (not only adding CC=...).
I tried to build using CMAKE instead of MAKE but it stopped after building a lib...need more changes probably.

Attached is a shot
You do not have access to view attachments
N
NathanHMember
Posted 9 days ago
@Farox,

I was hoping I didn't make any silly errors simply building the compilers. Thanks for giving it a whirl. Its said to be very portable being all in C so I thought it would be a good target for my first try. Maybe not.

NathanH
N
NathanHMember
Posted 8 days ago
@Farox

Yes, once I got rid of the immediate errors that I was receiving with "int" I was going to work on the rest of the makefile. It does a lot of stuff that is unneeded that can easily be done in forth instead. The makefile creates a pforth_standalone executable all of which is unnecessary because it can be done in forth. All that is necessary is to get the pForth executable compiled so all of the stuff after that in the makefile can be removed.

NathanH
F
FaroxMember
Posted 8 days ago
@NathanH

I got managed to build pForth for Aros 64 bit. Smile
I built using CMAKE (with a modified CMakelists.txt) and some changes to the sources. Plus i had to use Aros to have some things created (as it's not possible to run pforth compiled for Aros under linux...and it needs to create the .dic and the pfdicdat.h file).
I was not able to create a valid Makefile for Aros...sorry

I attach here a shot of the program running on a shell of Aros.

For the moment don't want to share my build...as i think you would try to build for yourself, as a learning experience.
If you are in trouble feel free to ask.
If you don't want to try to build...i share my build and the sources...but i prefer you try it first.Smile
You do not have access to view attachments
N
NathanHMember
Posted 8 days ago
@Farox,

Very cool. I'll continue to try. Thanks.

NathanH
N
NathanHMember
Posted 8 days ago
@Farox,

Did you get the same error I was getting (1st message in thread) when trying make with the makefile? If so, how did you get around it? If not, when did you create your x64 toolchain? Deadwood seemed to think thought that my build system was corrupted somehow. If you didn't get that error then there is something wrong with my compiler. I've made it from scratch three times now so not certain how a problem could have slipped in.

NathanH
AMIGASYSTEMAMIGASYSTEMDistro Maintainer
Posted 7 days ago
NathanH, congratulations, excellent work!
F
FaroxMember
Posted 7 days ago

NathanH wrote:

@NathanH - @Farox,

Did you get the same error I was getting (1st message in thread) when trying make with the makefile? If so, how did you get around it ?

NathanH

Yeah i was getting the same error using the Makefile, probably it needs to be rewritten for Aros, your toolchain is most probably perfectly working if you already compiled some other project.
As i write before i was not able to use/modify the Makefile to build.
I have used a different method (that is already supported by the program) to build, it's using CMakelists.txt.
To use it (after you have adapted it for Aros) you have to make a new dir called "build" (for example).
Go the new created build dir and open here a new shell/terminal.
Type "cmake .." or "ccmake .." if you want to use the ncurses gui on the terminal.
And if all goes well...without errors...you can now type "make" to build the program.
Remember that i needed to adapt the CMakeLists.txt (in the main directory and the other in /csrc dir, plus i needed to copy a function from "posix/pf_io_posix.c" to "stdio/pf_io_stdio.c" (the function sdSleepMillis needed to build).

Let me know if you need more help or want the sources modified to build with CMake.
D
deadwoodAROS Dev
Posted 7 days ago
It's a long shot but maybe commenting out -std=c89 in the Makefile will resolve this __header_inline error?
F
FaroxMember
Posted 7 days ago
@deadwood
As allways you are right...it was so simple.

@NathanH
Forget all i was writing and follow what real developer suggest...take the original code and comment out -std=c89 in the Makefile.
All compile fine without any changes.
You can view all discussion threads in this forum.
You cannot start a new discussion thread in this forum.
You cannot reply in this discussion thread.
You cannot start on a poll in this forum.
You cannot upload attachments in this forum.
You cannot download attachments in this forum.
Users who participated in discussion: deadwood, AMIGASYSTEM, NathanH, Farox