19 May 2017, 14:09 | #1 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
|
compile problems (vbcc)
Three problems occured to me while compiling some project :
- There is no strdup function. It's not in string.h as should be, and no .lib contains it. - Assembler says unknown mnemonic for <inline> and <einline>. New to 0.9f ; version 0.905 did not have this issue. - Linker complains about missing _nearbyintf symbol. It's available in some fpu libs (like m040.lib), but that does not look like a proper way for building a nofpu version... |
19 May 2017, 14:42 | #2 |
Registered User
Join Date: May 2010
Location: Helsinki, Finland
Posts: 1,341
|
I don't think strdup() is a standard function. POSIX maybe?
|
19 May 2017, 14:56 | #3 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,476
|
Posix
|
19 May 2017, 15:20 | #4 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
|
So only thing i can do is to find some C implementation of it and add that to the program ?
|
19 May 2017, 15:29 | #5 |
Registered User
Join Date: May 2010
Location: Helsinki, Finland
Posts: 1,341
|
That's probably easiest. It should only be a few lines of code. Someone on StackOverflow suggest this:
Code:
char *strdup (const char *s) { char *d = malloc (strlen (s) + 1); // Allocate memory if (d != NULL) strcpy (d,s); // Copy string if okay return d; // Return new memory } |
19 May 2017, 15:52 | #6 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
|
Ok, done. Now what for the next two problems ?
|
19 May 2017, 17:23 | #7 | ||
Banned
Join Date: Jan 2010
Location: Kansas
Posts: 1,284
|
Quote:
http://aminet.net/package/dev/c/vbcc_PosixLib Quote:
Which floating point math lib did you compile/link with? The behavior should be the same for -lm881, -lm040 and -lm060. The -lmieee option uses the C= libraries and is limited by the support they give. The nearbyintf() function/macro uses "fint fp0" using the current rounding mode but the C= ieee libraries have no concept of a rounding mode. Frank was looking into adding a different but better soft floating point library at one point. I also considered creating an Amiga c99fps.library and c99fpd.library as more modern ieee library replacements at one time. The current fp support provides what most people would use as is and there might not even be enough users of a better soft float option to properly test and debug the code. |
||
19 May 2017, 17:52 | #8 | |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
|
Quote:
As it appears to rely heavily on C99 it seems only VBCC will do it - GCC does not work on my setup and is asm unfriendly anyway (no option to output proper amiga asm source). I wanted to use -lmieee only. Then the linker complained about nearbyintf (without that function being called explicitly anywhere). I added -lm040 as the function is there. Noticed -lmieee was still needed so both got linked in. Then it could finally be built. However it now needs fpu. I started uae in 040 mode to test results and found out the program does not work anymore (same source code works fine with VS2015). Currently trying to debug the bloody thing to discover what went wrong (no crash, just bogus data output). If you tell me i can't have proper nearbyintf implementation without fpu then so be it - better than not compiling at all. |
|
19 May 2017, 18:49 | #9 | |
Banned
Join Date: Jan 2010
Location: Kansas
Posts: 1,284
|
Quote:
o link code compiled with different math libs (e.g. -lmieee and -lm040) o specify -fpu=68xxx with -lmieee There probably should be more tests and error messages for these conditions as the result can compile fine but crash. As far as I know, nearbyintf() can not be supported as is by the Amiga ieee libraries. It should be possible for a soft float implementation to support nearbyintf() but I do not believe there is any vbcc support for the 68k AmigaOS target at this time. |
|
19 May 2017, 18:58 | #10 | |||
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
|
Quote:
Errors should appear if the same function name occurs several times, shouldn't they ? I didn't specify -fpu... So it's needed even for 040 ? Quote:
Quote:
I replaced it with normal cast and it now works. I don't really need "proper" rounding anyway. |
|||
19 May 2017, 20:04 | #11 | ||
Banned
Join Date: Jan 2010
Location: Kansas
Posts: 1,284
|
Quote:
In my experience, -fpu=68040 and -lm040 should be added together. The program is still broken and I believe crashes are possible with what you did. Quote:
I believe C casting defaults to round toward zero which would be like the FINTRZ instruction. Last edited by matthey; 19 May 2017 at 20:46. |
||
19 May 2017, 20:33 | #12 | |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
|
Quote:
A crash would probably have been easier to debug... |
|
20 May 2017, 19:01 | #13 | |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,500
|
Quote:
As matthey already mentioned the implementation of nearbyintf(), which is called for lrintf(), is quite simple and only works for floats between -2147483648 and 2147483647. Matthey implemented many new C99 math functions and improved present ones, but unfortunately for FPU only (I certainly won't blame him). So I tried to implement a few new C99 functions for softfloat (mieee.lib), but I didn't find the time for all. You can blame me! |
|
20 May 2017, 19:10 | #14 |
Banned
Join Date: Sep 2016
Location: UK
Posts: 2,917
|
I love vbcc and vasm. But compiling a hello world style C file seems to eat my 4mb of ram up quickly. Any way to make it use temp disk space rather than ram: for temp files?
|
20 May 2017, 20:15 | #15 | ||
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
|
Quote:
Quote:
|
||
21 May 2017, 21:12 | #16 | |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,500
|
Quote:
Any old vasm version somewhere in your path? When the problem persists, please send me something to reproduce it. (Although I'm currently on holiday in Greece, so I probably can't tackle the problem in the next 6 days). |
|
22 May 2017, 07:48 | #17 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
|
Somewhere on my normal path no, but it's possible some assign leading to 1.7e was still there. If this was the case then it was using the old compiler as well.
|
22 May 2017, 11:42 | #18 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
|
I have found the sources of vbcc itself but not the sources of the .lib. Where can i find sources for all these .lib (amigaos target) ?
A .s (including compiler output) is more manageable for me than a .lib. |
22 May 2017, 16:22 | #19 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,500
|
The linker libraries are the only parts which are not open source. Volker Barthelmann has no intention to change that, for various reasons.
If you have a specific problem or want to work on parts of the library source, then contact me privately. Maybe we can find a solution. |
22 May 2017, 18:33 | #20 |
Computer Nerd
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,766
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Help with compile | JimDrew | Coders. Language | 23 | 30 October 2014 22:42 |
Compile problems with VBCC | Yesideez | Coders. C/C++ | 9 | 18 October 2014 23:38 |
How compile WinUAE... | WCoder | support.WinUAE | 57 | 17 April 2014 17:42 |
GFA compile | xc8 | Coders. General | 31 | 19 May 2009 18:21 |
Compile WinUAE ????? | Myriel | support.WinUAE | 14 | 10 January 2004 17:06 |
|
|