Page 2 of 2

Re: CLIB2 failures

PostPosted: Wed Sep 30, 2015 4:23 pm
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.

Re: CLIB2 failures

PostPosted: Wed Sep 30, 2015 11:41 pm
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.

Re: CLIB2 failures

PostPosted: Thu Oct 01, 2015 12:21 am
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.

Re: CLIB2 failures

PostPosted: Thu Oct 01, 2015 10:48 am
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.

Re: CLIB2 failures

PostPosted: Thu Oct 01, 2015 7:02 pm
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.

Re: CLIB2 failures

PostPosted: Thu Oct 01, 2015 9:38 pm
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.

Re: CLIB2 failures

PostPosted: Fri Oct 02, 2015 1:16 am
by tonyw
Well done, xenic !

Re: CLIB2 failures

PostPosted: Fri Oct 02, 2015 10:15 am
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.

Re: CLIB2 failures

PostPosted: Fri Oct 02, 2015 6:40 pm
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.

Re: CLIB2 failures

PostPosted: Sat Jul 29, 2017 10:04 pm
by salass00
An updated build of clib2 is available on OS4Depot:

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