English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. C/C++

 
 
Thread Tools
Old 24 March 2018, 00:08   #1
Crank
Registered User

 
Join Date: Mar 2018
Location: Prague
Posts: 31
VBCC problem with standard variable types

Hi!

I'm trying to get cross compiler / VBCC working on Mac. My intention is to write code for A500.

If I compile a very simple C program which simply displays text with printf(), everything seems to compile and run just fine. But if I try to use any of the standard variable types (char/short/int, signed or unsigned), I get the following warnings and errors:

vc +kick13 -o hello hello.c
> int
warning 216 in line 7 of "hello.c": illegal use of keyword <int>
> int a
warning 216 in line 7 of "hello.c": illegal use of keyword <int>
> int a
error 82 in line 7 of "hello.c": unknown identifier <int>
> int a
warning 54 in line 7 of "hello.c": ; expected
> int a = 6;
error 82 in line 7 of "hello.c": unknown identifier <a>
2 errors found!
vbccm68k -quiet -hunkdebug "hello.c" -o= "/var/tmp/tmp.0.asm" -O=1 -I$VBCC/targets/m68k-kick13/include failed


Here's the whole code:

#include <stdio.h>

int main()
{
printf("Testing...\n");

int a = 6;

return 0;
}


Any ideas what went wrong with the installation process?
I followed (more or less accurately) these instructions:
https://blitterstudio.com/setting-up...ross-compiler/

I got the latest target and unix config files from here:
http://server.owl.de/~frank/vbcc/2017-08-14/


Some extra information:

1. I had to modify the kick13 file by removing the "-no-cpp-warn". The compiler didn't recognise this flag for some reason.

2. I got lots of warnings but no errors while compiling the VBCC. I got warnings when the makefile asked all about little/big endianess and during actual compilation.

3. For the makefile's "questionnaire" I tried using default answers, big endianness and little endianness. All gave the same results.


A little help would be much appreciated!
Crank is offline  
AdSense AdSense  
Old 24 March 2018, 00:16   #2
Leffmann
 
Join Date: Jul 2008
Location: Sweden
Posts: 2,112
VBCC defaults to C89, compile it as C99 with the -c99 argument.
Leffmann is offline  
Old 24 March 2018, 01:11   #3
Crank
Registered User

 
Join Date: Mar 2018
Location: Prague
Posts: 31
Hey, now it works. Thanks!
Crank is offline  
Old 24 March 2018, 10:37   #4
Crank
Registered User

 
Join Date: Mar 2018
Location: Prague
Posts: 31
I still seem to have one more mystery to solve:

By default, the compiler doesn't find the following include files:

#include <proto/dos.h>
#include <proto/exec.h>

I assume I need to either add the target's include and lib directories to some environment variable or add some extra flag for the compiler. I can't seem to find an answer from the internet.

Last edited by Crank; 24 March 2018 at 10:51.
Crank is offline  
Old 24 March 2018, 13:51   #5
Leffmann
 
Join Date: Jul 2008
Location: Sweden
Posts: 2,112
The VBCC environment variable is probably not set, try running
launchctl setenv VBCC /path/to/vbcc
on the command line.
Leffmann is offline  
Old 24 March 2018, 22:46   #6
phx
Natteravn

phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 1,116
Quote:
Originally Posted by Crank View Post
1. I had to modify the kick13 file by removing the "-no-cpp-warn". The compiler didn't recognise this flag for some reason.
Then you didn't compile the latest vbcc source. -no-cpp-warn was introduced in January 2017, long before the V0.9f release. You can download the V0.9f-patch1 source here:
http://server.owl.de/~frank/tags/vbcc0_9fP1.tar.gz

IIRC, -no-cpp-warn is needed for many of Commodore's Kickstart 1.x headers, which were probably K&R C and not even compatible to C89 standards.

Quote:
2. I got lots of warnings but no errors while compiling the VBCC.
Might be a result of your compiler and settings. There is not a single warning when compiling with gcc 4.5.3 under NetBSD/amd64, using the standard Makefile (which includes -std=c9x).

Quote:
3. For the makefile's "questionnaire" I tried using default answers, big endianness and little endianness. All gave the same results.
Assuming you are running a x86-based Mac, you are building a cross-compiler which has to convert data types between big- and little-endian.

So when being asked if your system/compiler implements a big-endian type you will reply 'n' and then 'y' for the little-endian types. Usually you just have to press enter and take the default for all questions, as dtgen is smart enough to determine all types correctly.
phx is offline  
Old 25 March 2018, 13:38   #7
Crank
Registered User

 
Join Date: Mar 2018
Location: Prague
Posts: 31
Quote:
Originally Posted by Leffmann View Post
The VBCC environment variable is probably not set, try running
launchctl setenv VBCC /path/to/vbcc
on the command line.
Checking the variable with printenv VBCC gives the following result:
/opt/vbcc

That is where I have the following folders with no other files/folders:
bin/
config/
targets/
Crank is offline  
Old 25 March 2018, 13:48   #8
Crank
Registered User

 
Join Date: Mar 2018
Location: Prague
Posts: 31
Quote:
Originally Posted by phx View Post
Then you didn't compile the latest vbcc source. -no-cpp-warn was introduced in January 2017, long before the V0.9f release. You can download the V0.9f-patch1 source here:
http://server.owl.de/~frank/tags/vbcc0_9fP1.tar.gz
This solved the flag issue. Now also the compiler seems to find "proto/exec.h", but complains about file included from inside the "proto/exec.h":

vc +kick13 -o hello hello.c
>#include <exec/types.h>
error 248 in line 5 of "proto/exec.h": file 'exec/types.h' not found
included from file "hello.c":1
1 error found!
vbccm68k -quiet -c99 -no-cpp-warn -hunkdebug "hello.c" -o= "/var/tmp/tmp.0.asm" -O=1 -I$VBCC/targets/m68k-kick13/include failed


Quote:
Originally Posted by phx View Post
Might be a result of your compiler and settings. There is not a single warning when compiling with gcc 4.5.3 under NetBSD/amd64, using the standard Makefile (which includes -std=c9x).

Assuming you are running a x86-based Mac, you are building a cross-compiler which has to convert data types between big- and little-endian.

So when being asked if your system/compiler implements a big-endian type you will reply 'n' and then 'y' for the little-endian types. Usually you just have to press enter and take the default for all questions, as dtgen is smart enough to determine all types correctly.
It seems Mac's Xcode installs LLVM based compiler and makes the system believe it's actually GCC This seems to be the source of the warnings when compiling the VBCC. I hope this doesn't affect VBCC's functionality.
Crank is offline  
Old 25 March 2018, 16:42   #9
Leffmann
 
Join Date: Jul 2008
Location: Sweden
Posts: 2,112
Quote:
Originally Posted by Crank View Post
Checking the variable with printenv VBCC gives the following result:
/opt/vbcc
You're probably missing the AmigaOS NDKs then:

https://www.dropbox.com/s/5kougfenyw...ndk13.lha?dl=1
https://www.dropbox.com/s/2moala3whq...NDK39.lha?dl=1

Add the include_h path to your config files with
-I"$VBCC/ndk1.3/Includes1.3/include_h/"
or similar, after the argument that points to
$VBCC/targets/m68k-kick13/


Use the 3.9 NDK for the other configs.
Leffmann is offline  
Old 26 March 2018, 18:36   #10
Crank
Registered User

 
Join Date: Mar 2018
Location: Prague
Posts: 31
Ah, for some reason I was under the impression that NDK was only for the more modern Amigas. After installing NDK things started working fine

Now I have a hybrid C & ASM project going and basic initializations done (copied shamelessly the init code from other sources to get going as soon as possible).

Many thanks to everyone for helping me get started!
Crank is offline  
Old 01 April 2018, 10:00   #11
phx
Natteravn

phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 1,116
Make sure to use the 1.3 NDK with the kick13 config and the 3.9 or 3.1 NDK with aos68k. Do not use the latest NDK for both!
phx is offline  
Old 01 April 2018, 19:31   #12
Crank
Registered User

 
Join Date: Mar 2018
Location: Prague
Posts: 31
Yep, got 1.3 NDK installed. Seems to work fine now
Crank is offline  
AdSense AdSense  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
vbcc bind a variable to a register iliak Coders. Asm / Hardware 6 31 July 2016 12:29
Join variable and string in scripts. olesio support.Apps 3 31 January 2013 11:44
Speedy. The variable speed accellerator. DDNI Hardware mods 9 18 June 2012 21:33
NTSC variable-length scanlines TheDarkCoder Coders. Asm / Hardware 3 23 November 2011 15:51
Variable Master Clock wiltshireguyuk request.UAE Wishlist 0 13 December 2004 16:40

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 13:09.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.
Page generated in 0.07587 seconds with 15 queries