CLIB2 failures

Have a question about our Software Developer Kit? Ask them here.
xenic
Posts: 1185
Joined: Sun Jun 19, 2011 12:06 am

Re: CLIB2 failures

Post by xenic »

broadblues wrote:@xenic
but if you look at the commit logs on the github site you'll see Olaf added that header.

Could be it doesn't get included inot that one particular file somehow.

Just grab the source and build yourself a new copy.
O.K. I see that the "obsolete.h" header is included in clib2 stdio_headers.h that is included by the stdio files but it's not included by clib2 stdlib_headers.h that is included by the stdlib files.

I reported the problem so it could be fixed and have a clib2 update made available in Amiupdate. I'm not actually using clib2 in my program. I just got tired of entering a long command line to compile a program I'm working on and borrowed an old makefile to compile it with the make command instead. I forgot to remove the -mcrt=clib2 from the borrowed makefile and discovered the problem.
AmigaOne X1000 with 2GB memory - OS4.1 FE
xenic
Posts: 1185
Joined: Sun Jun 19, 2011 12:06 am

Re: CLIB2 failures

Post by xenic »

salass00 wrote:Compiling with -Werror as well as -Wall would have stopped this accident from happening.

With only -Wall gcc would have produced an "implicit declaration of function" warning but because it's not treated as an error it can be really easy to miss in a project with lots of files to compile such as clib2.
While that sounds like a good idea, the clib2 sources are full of deprecated functions which might also be flagged as errors. It would appear that many parts of clib2 need to be rewritten to use current OS4 functions. Additionally, clib2 needs to be compiled with gcc 4.0.2 in order for the baserel code to be produced.

I added a define to fix the "GetProgramName" link failure, modified the makefile to compile on my X1000 and compiled clib2 with gcc 4.0.2 to get the baserel files. I seems to work so far. After examing the clib2 code, I have to wonder if all the deprecated functions and old names have been replaced in newlib.
AmigaOne X1000 with 2GB memory - OS4.1 FE
User avatar
ssolie
Beta Tester
Beta Tester
Posts: 1010
Joined: Mon Dec 20, 2010 8:51 pm
Location: Canada
Contact:

Re: CLIB2 failures

Post by ssolie »

xenic wrote:I added a define to fix the "GetProgramName" link failure, modified the makefile to compile on my X1000 and compiled clib2 with gcc 4.0.2 to get the baserel files. I seems to work so far.
Can you show us here exactly what you changed?

I don't care about the baserel stuff. Just whatever that define was you were messing with.
ExecSG Team Lead
User avatar
salass00
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 530
Joined: Sat Jun 18, 2011 3:12 pm
Location: Finland
Contact:

Re: CLIB2 failures

Post by salass00 »

xenic wrote: While that sounds like a good idea, the clib2 sources are full of deprecated functions which might also be flagged as errors.
Just add -Wno-deprecated-declarations until those are fixed.

It is also possible to set exceptions to the -Werror rule although I don't remember the exact details of how to do this off hand.
xenic
Posts: 1185
Joined: Sun Jun 19, 2011 12:06 am

Re: CLIB2 failures

Post by xenic »

ssolie wrote: Can you show us here exactly what you changed?

I don't care about the baserel stuff. Just whatever that define was you were messing with.
Olaf responded quickly to my bug report and added the inclusion of <dos/obsolete> in the stdlib_headers.h file. I downloaded the zip archive of clib2 sources from https://github.com/adtools/clib2 and was able to compile a working clib2 with the current SDK (with SDK:clib2/lib/libc.a from the previous SDK).

The GNUmakefile.os4 makefile cross-compiles by default but you need to make this change:
Change "COMPILER_VERSION := -V4.0.2" to "COMPILER_VERSION := -V4.2.4"

In order to compile clib2 (with Olaf's latest change) natively on my X1000 I had to make the following changes to GNUmakefile.os4:
Commented out lines 24 through 37.
Uncommented lines 42 through 51 (commands for OS4 native compile).
Changed line 50 from "COMPILER_VERSION := -V4.0.2" to "COMPILER_VERSION := -V4.2.4"
Changed line 51 from "LOG_COMMAND := *>< | tee >>compiler.log" LOG_COMMAND := *>< | tee >>ram:compiler.log (might not be necessary).
Removed "distcc" from line 44.

Although the gcc v4.2.4 compile produces baserel files, they may not actually be base relative. According to Olaf's notes in the makefile, gcc v4.0.2 or lower must be used to get real base relative code.
AmigaOne X1000 with 2GB memory - OS4.1 FE
User avatar
ssolie
Beta Tester
Beta Tester
Posts: 1010
Joined: Mon Dec 20, 2010 8:51 pm
Location: Canada
Contact:

Re: CLIB2 failures

Post by ssolie »

xenic wrote:Olaf responded quickly to my bug report and added the inclusion of <dos/obsolete> in the stdlib_headers.h file. I downloaded the zip archive of clib2 sources from https://github.com/adtools/clib2 and was able to compile a working clib2 with the current SDK (with SDK:clib2/lib/libc.a from the previous SDK).
Ah, good. I will prepare an SDK update with this important fix.
ExecSG Team Lead
User avatar
tonyw
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 1479
Joined: Wed Mar 09, 2011 1:36 pm
Location: Sydney, Australia

Re: CLIB2 failures

Post by tonyw »

Well done, xenic !
cheers
tony
User avatar
salass00
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 530
Joined: Sat Jun 18, 2011 3:12 pm
Location: Finland
Contact:

Re: CLIB2 failures

Post by salass00 »

xenic wrote: Additionally, clib2 needs to be compiled with gcc 4.0.2 in order for the baserel code to be produced.
If the gcc 4.2.4 that's included with the SDK can't generate baserel binaries then there seems to be absolutely no reason to include any baserel libraries in the SDK.
xenic
Posts: 1185
Joined: Sun Jun 19, 2011 12:06 am

Re: CLIB2 failures

Post by xenic »

salass00 wrote:
xenic wrote: Additionally, clib2 needs to be compiled with gcc 4.0.2 in order for the baserel code to be produced.
If the gcc 4.2.4 that's included with the SDK can't generate baserel binaries then there seems to be absolutely no reason to include any baserel libraries in the SDK.
I just mentioned baserel because of the note about it in the clib2 makefile. Personally, I don't know anything about the issue.
AmigaOne X1000 with 2GB memory - OS4.1 FE
User avatar
salass00
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 530
Joined: Sat Jun 18, 2011 3:12 pm
Location: Finland
Contact:

Re: CLIB2 failures

Post by salass00 »

An updated build of clib2 is available on OS4Depot:

http://os4depot.net/index.php?function= ... /clib2.lha
Post Reply