Amiga.org

Operating System Specific Discussions => Amiga OS => Amiga OS -- Development => Topic started by: Matt_H on October 28, 2008, 04:17:32 AM

Title: Probably a very simple development question...
Post by: Matt_H on October 28, 2008, 04:17:32 AM
Partially an exercise in teaching myself about (re)compiling and the GCC environment, I'm trying to fix a very simple bug in the Amiga port of Duke Nukem. Obviously, I've hit a snag.

After all the object code compiles and the compiler moves on to creating the executable, I get this error:
Code: [Select]
Engine/amiga_display.o(.text+0xb0e): undefined reference to `GetCyberIDAttr'
Engine/amiga_display.o(.text+0x3c4): undefined reference to `BestCModeIDTags'
Engine/amiga_display.o(.text+0x47a): undefined reference to `GetCyberIDAttr'
Engine/amiga_display.o(.text+0xaf8): undefined reference to `IsCyberModeID'
Engine/amiga_display.o(.text+0xf06): undefined reference to `LockBitMapTags'
Engine/amiga_display.o(.text+0xf46): undefined reference to `UnLockBitMap'
collect2: ld returned 1 exit status
make: *** [AmigaDuke3D_C] Error 1

Those all seem to be functions from cybergraphics.library. I'm sure the solution is something incredibly basic, but I don't (yet) know enough to figure it out.

The code should supposedly compile out of the box, but it doesn't, so I'm assuming the problem is with my development environment. The only "weird" thing I've done is used an included makefile that works only from C code, rather than the mix of C and Assembler - I'm having a hard enough time with C alone, so I don't want to deal with them both.

I'm using a basic (read: extracted everything and ran the GG-Startup script at boot) Geek Gadgets install from the ~1998 snapshot at Back2Roots with the gcc-2.95.3-4 from the FTP's alpha directory tacked on.

The os-includes were copied over from my Geek Gadgets 2 CD. I also installed the CGX and AHI devkits in gg:include.

Any hints greatly appreciated.
Title: Re: Probably a very simple development question...
Post by: HellCoder on October 28, 2008, 06:36:30 AM
It looks like the compiler cannot find the library(s) from cybergraphics. Normally all libraries you want to link with the executable should be mentioned somewere in the makefile. (a reference)


Title: Re: Probably a very simple development question...
Post by: Crumb on October 28, 2008, 08:37:20 AM
C includes must be adapted to work on all compilers or at least the compiler you are using.

You'll need to use fd2pragma or a similar tool.

Perhaps you'll find aweb includes useful (AFAIK they are already adapted for GCC and OS4/OS3/MOS): http://aweb.sunsite.dk/



if your includes are already adapted that errors may have appeared because you haven't included the function prototypes.

You may have to add a:
#include
or even a
#include

you should never have to add:
#include
and you should never have to add
#include
as proto/cybergraphx.h should already choose that files. if you use inline or clib headers instead of proto ones your code won't be directly portable to other compilers (gcc uses "inline/" directory but other compilers don't.

good luck!
Title: Re: Probably a very simple development question...
Post by: Matt_H on October 28, 2008, 03:42:11 PM
@ Crumb

Yes! The GCC-adapted includes were the solution. Thanks.

I guess this explains why the Geek Gadgets documentation said that if you use includes that aren't from the Geek Gadgets CD that they need to have patches applied.

I was wondering if you could explain a little bit more on the conceptual level. What are FD files? I've seen them in devkits before, but they don't come installed with Geek Gadgets, SAS/C, or StormC v3. Is there a compiler that uses them, or is their only purpose to be converted into pragma files?

Similarly, the AWeb includes had both "pragma" and "pragmas" subdirectories. What's the difference? GG and SAS both have only a pragmas subdirectory, but StormC has both. Is this also a compiler-specific thing?

Thanks again.
Title: Re: Probably a very simple development question...
Post by: Kronos on October 28, 2008, 04:12:38 PM
Pragmas are compiler-specific.

FD-files are basic files defining function-names offsets and paramaters for a library, and can be used to generate not just pragmas but binding for all languages (starting with AmugaBasic if you like).
Title: Re: Probably a very simple development question...
Post by: Crumb on October 28, 2008, 04:22:47 PM
As Kronos explained it correctly I'll just add that GCC uses the inline/ directory instead of "pragma"/"Pragmas" and that OS4 uses different directories like "inline4/".

I created this small script to create 68k headers for gcc with fd2pragma: http://cuaz.sourceforge.net/cuaz/files/AAT_Create_includes

and this one for MorphOS:
http://cuaz.sourceforge.net/cuaz/files/AAT_Create_includes_MOS
Title: Re: Probably a very simple development question...
Post by: Matt_H on October 28, 2008, 07:01:57 PM
So is it correct to say that FDs are a kind of "raw" data that get processed into protos/pragmas/inlines/etc? I.E., if I have the FD files but nothing else, I can get everything else from them (apart from the main includes, obviously)?
Title: Re: Probably a very simple development question...
Post by: asymetrix on November 04, 2008, 07:40:07 PM

Thanks for the info.

So the GCC 68k fd2pragma link is same as for MorphOS, meaning same fd2pragma commands ?

Is geek gadgets still the prefered programming suite for developing on OS3 ?

Or is geek gadgets to old ?

Where can I get latest GCC 4.3.2 for AmigaOS 3 ?

Can one simply compile GCC 4.3.2 source for Amiga ?

What are the issues involved ?

cheers
Title: Re: Probably a very simple development question...
Post by: SamuraiCrow on November 05, 2008, 04:36:12 PM
@asymetrix

Don't waste your time with the GCC 4.3.2 sources.  They only have a 68k code generator for embedded systems and would need you to adapt the Geek Gadgets binutils sources to run it at all.  I think the last GCC for 68k processors on the Amiga was version 3.4.0.  You can get it on the Back to the Roots website (http://www.back2roots.org/).  Look in the Geek Gadgets archive.
Title: Re: Probably a very simple development question...
Post by: Minuous on July 15, 2010, 12:20:58 AM
Quote from: asymetrix;425872
Is geek gadgets still the prefered programming suite for developing on OS3 ?


When was it ever?
Title: Re: Probably a very simple development question...
Post by: DBAlex on July 15, 2010, 01:26:02 AM
Quote from: Minuous;570424
When was it ever?


Epic bump, amigo!