CLIB2 failures

Have a question about our Software Developer Kit? Ask them here.

CLIB2 failures

Postby xenic » Mon Sep 28, 2015 8:09 pm

Although the Final Edition SDK announcement at the Hyperion web site claims that the SDK includes an "Updated clib2 alternative C standard library", it apparently wasn't updated to use renamed AmigaDOS functions. Here is an example of the link failures I'm getting:

/SDK/clib2/lib/libc.a(stdlib_program_name.o): In function `stdlib_program_name_init_ctor':
stdlib_program_name.c:(.text+0xe4): undefined reference to `GetProgramName'
make: *** [usbsnd] Error 1

GetProgramName() was renamed to GetCliProgramName() and including "dos/obsolete.h" in a program has no effect on a precompiled library like libc.a which contains obsolete function names. Unless someone has a fix for this problem, could we please get a new clib2 for the new SDK in AmiUpdate or uploaded to OS4Depot??
AmigaOne X1000 with 2GB memory - OS4.1 FE
xenic
 
Posts: 1047
Joined: Sun Jun 19, 2011 1:06 am

Re: CLIB2 failures

Postby chris » Mon Sep 28, 2015 8:59 pm

You are best off posting this bug to the clib2 project: http://sourceforge.net/p/clib2/bugs/
The SDK simply provides a pre-compiled version.
chris
 
Posts: 548
Joined: Sat Jun 18, 2011 12:05 pm

Re: CLIB2 failures

Postby xenic » Mon Sep 28, 2015 11:39 pm

chris wrote:You are best off posting this bug to the clib2 project: http://sourceforge.net/p/clib2/bugs/
The SDK simply provides a pre-compiled version.

I'm not sure if that is the right place to look anymore. Various people have moved the project to at least 3 different repositories at Github. After checking out all the clib2 repositories at Github, it looks like adtools/clib2 is the right one. Olaf Barthel made some changes there in July. Personally, I think that if clib2 is going to be included in the SDK then one of the OS4 devs should join the project, keep it up-to-date for OS4 and compile it for any SDK releases.

I guess I'll just look for a workaround.
AmigaOne X1000 with 2GB memory - OS4.1 FE
xenic
 
Posts: 1047
Joined: Sun Jun 19, 2011 1:06 am

Re: CLIB2 failures

Postby tonyw » Tue Sep 29, 2015 3:13 am

Perhaps create a small object file with a few stubs?
cheers
tony
User avatar
tonyw
AmigaOS Core Developer
AmigaOS Core Developer
 
Posts: 1248
Joined: Wed Mar 09, 2011 2:36 pm
Location: Sydney, Australia

Re: CLIB2 failures

Postby broadblues » Tue Sep 29, 2015 12:12 pm

@xenic

clib2 itself is easy to build, IIRC, perhaps you could fix it an provide a patch.
User avatar
broadblues
AmigaOS Core Developer
AmigaOS Core Developer
 
Posts: 478
Joined: Sat Jun 18, 2011 3:40 am
Location: Portsmouth, UK

Re: CLIB2 failures

Postby xenic » Tue Sep 29, 2015 8:03 pm

@all
Actually, my workaround is to compile with the previous SDK. Whoever added clib2 to the previous SDK must have compiled it themselves (probably including <dos/obsolete.h>). The clib2 changes log indicates "tfrieden" made some of the original changes for OS4. I guess none of the other OS4 devs stepped in to keep it updated. I filed bug reports at the sf.net clib2 repository and the Github clib2 repository but that doesn't mean it will get fixed.
AmigaOne X1000 with 2GB memory - OS4.1 FE
xenic
 
Posts: 1047
Joined: Sun Jun 19, 2011 1:06 am

Re: CLIB2 failures

Postby ssolie » Tue Sep 29, 2015 11:39 pm

xenic wrote:GetProgramName() was renamed to GetCliProgramName() and including "dos/obsolete.h" in a program has no effect on a precompiled library like libc.a which contains obsolete function names. Unless someone has a fix for this problem, could we please get a new clib2 for the new SDK in AmiUpdate or uploaded to OS4Depot??

I don't understand why this is a problem because we don't link by name.

What is really going on here? Can you provide a full explanation with example?

Here is where clib2 lives now -> https://github.com/adtools/clib2

Can somebody tell us what is broken?
AmigaOS Development Team Lead
Be authentic. Get AmigaOS.
User avatar
ssolie
AmigaOS Core Developer
AmigaOS Core Developer
 
Posts: 1000
Joined: Mon Dec 20, 2010 9:51 pm
Location: Canada

Re: CLIB2 failures

Postby xenic » Wed Sep 30, 2015 2:37 am

ssolie wrote:I don't understand why this is a problem because we don't link by name.

It's a problem because when I compile this:

Code: Select all
/* gcc -mcrt=clib2 test.c -o test */

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

int main(int argc, char **argv)
{

   IDOS->Printf("Hello World\n");

   return 0;
}

I get this link error:

    /SDK/clib2/lib/libc.a(stdlib_program_name.o): In function `stdlib_program_name_init_ctor':
    stdlib_program_name.c:(.text+0xe4): undefined reference to `GetProgramName'

What is really going on here? Can you provide a full explanation with example?

Here is where clib2 lives now -> https://github.com/adtools/clib2

Can somebody tell us what is broken?


I don't know anything about how we link but when I examined the file "stdlib_program_name.c" in the clib2 sourcecode at https://github.com/adtools/clib2, it contains the a call to the function "GetProgramName()" which is no longer present in "SDK:Include/include_h/interfaces/dos.h". It was replaced with "GetCliProgramName()". I could be wrong but I suspect that clib2 needs to be compiled with the SDK:Include/include_h/dos/obsolete.h" header file included.

If I replace the new "libc.a" with libc.a from the previous SDK I don't get a link error with the above example source.
AmigaOne X1000 with 2GB memory - OS4.1 FE
xenic
 
Posts: 1047
Joined: Sun Jun 19, 2011 1:06 am

Re: CLIB2 failures

Postby broadblues » Wed Sep 30, 2015 4:43 am

@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.
User avatar
broadblues
AmigaOS Core Developer
AmigaOS Core Developer
 
Posts: 478
Joined: Sat Jun 18, 2011 3:40 am
Location: Portsmouth, UK

Re: CLIB2 failures

Postby salass00 » Wed Sep 30, 2015 12:00 pm

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.
User avatar
salass00
AmigaOS Core Developer
AmigaOS Core Developer
 
Posts: 481
Joined: Sat Jun 18, 2011 4:12 pm
Location: Finland

Next

Return to SDK Support

Who is online

Users browsing this forum: No registered users and 1 guest