Click Here
home features news forums classifieds faqs links search
6155 members 
Amiga Q&A /  Free for All /  Emulation /  Gaming / (Latest Posts)
Login

Nickname

Password

Lost Password?

Don't have an account yet?
Register now!

Support Amigaworld.net
Your support is needed and is appreciated as Amigaworld.net is primarily dependent upon the support of its users.
Donate

Menu
Main sections
» Home
» Features
» News
» Forums
» Classifieds
» Links
» Downloads
Extras
» OS4 Zone
» IRC Network
» AmigaWorld Radio
» Newsfeed
» Top Members
» Amiga Dealers
Information
» About Us
» FAQs
» Advertise
» Polls
» Terms of Service
» Search

IRC Channel
Server: irc.amigaworld.net
Ports: 1024,5555, 6665-6669
SSL port: 6697
Channel: #Amigaworld
Channel Policy and Guidelines

Who's Online
22 crawler(s) on-line.
 95 guest(s) on-line.
 0 member(s) on-line.



You are an anonymous user.
Register Now!

/  Forum Index
   /  Amiga Development
      /  Compiling/Linking Shared Library
Register To Post

Goto page ( 1 | 2 Next Page )
PosterThread
Wanderer 
Compiling/Linking Shared Library
Posted on 22-Apr-2013 9:22:58
#1 ]
Cult Member
Joined: 16-Aug-2008
Posts: 654
From: Germany

Needless to say that compiling an Amiga Shared Library is hell.

However, I managed to compile one, but got into trouble linking it.

I dont use a MakeFile (I know, how lame!), but the project is rather simple. I want to make a clean port of the zlib.library.

I call the following three command lines to compile it:

gcc -c -noixemul -m68040 src/#?.c
gcc -c -noixemul -m68040 #?.c
gcc -noixemul -nostartfiles -o zlib.library #?.o src/#?.o

First line compiles the zlib. I put the sources to src/
Second line compiles my amiga specific mumbo jumbo for the library interface.
Third line should link the stuff together.

1+2 works fine without errors and warnings.
3. fails and tells me the symbole "exit" and "_WBenchMsg" are missing but referenced in libnix.a(open.o and raise.o).

Any idea how to get rid of these? Actually, I dont want WBenchMsg to be evaluated at all, its a library that can be called from shell programs too.

_________________
--
Author of
HD-Rec, Sweeper, Samplemanager, ArTKanoid, Monkeyscript, Toadies, AsteroidsTR, TuiTED, PosTED, TKPlayer, AudioConverter, ScreenCam, PerlinFX, MapEdit, AB3 Includes and many more...
Homepage: http://www.hd-rec.de

 Status: Offline
Profile     Report this post  
afxgroup 
Re: Compiling/Linking Shared Library
Posted on 22-Apr-2013 11:34:44
#2 ]
Super Member
Joined: 8-Mar-2004
Posts: 1968
From: Taranto, Italy

@Wanderer

exit is a fuction present in the standard c library. Which C library are you using? clib2? newlib?
Is this library for os3? or os4?

_________________
http://www.amigasoft.net

 Status: Offline
Profile     Report this post  
Wanderer 
Re: Compiling/Linking Shared Library
Posted on 22-Apr-2013 11:42:21
#3 ]
Cult Member
Joined: 16-Aug-2008
Posts: 654
From: Germany

@afxgroup

Sorry for leaving this important detail out.

It is WinUAE/AmigaOS3.9+AfA, using GCC 2.95.3 linking against gg:lib/libnix.a (78.630 bytes), no version strings. There is also a libc.a (244.068 bytes), dont know if this is used.

Here is the error report:
/gg/lib/libnix/libnix.a(open.o)(.text+0x26c): undefined reference to `_WBenchMsg'
/gg/lib/libnix/libnix.a(open.o)(.text+0x234): undefined reference to `exit'
/gg/lib/libnix/libnix.a(raise.o)(.text+0x82): undefined reference to `exit'
collect2: ld returned 1 exit status

_________________
--
Author of
HD-Rec, Sweeper, Samplemanager, ArTKanoid, Monkeyscript, Toadies, AsteroidsTR, TuiTED, PosTED, TKPlayer, AudioConverter, ScreenCam, PerlinFX, MapEdit, AB3 Includes and many more...
Homepage: http://www.hd-rec.de

 Status: Offline
Profile     Report this post  
afxgroup 
Re: Compiling/Linking Shared Library
Posted on 22-Apr-2013 11:53:00
#4 ]
Super Member
Joined: 8-Mar-2004
Posts: 1968
From: Taranto, Italy

@Wanderer

you should add -lc at the end of the link command

_________________
http://www.amigasoft.net

 Status: Offline
Profile     Report this post  
Wanderer 
Re: Compiling/Linking Shared Library
Posted on 22-Apr-2013 11:57:19
#5 ]
Cult Member
Joined: 16-Aug-2008
Posts: 654
From: Germany

@afxgroup

"-lc", got it. But then, this arises:

/gg/lib/libc.a(memset.o)(.text+0x2): undefined reference to `ixemulbase'
/gg/lib/libc.a(memcpy.o)(.text+0x2): undefined reference to `ixemulbase'
/gg/lib/libc.a(malloc.o)(.text+0x2): undefined reference to `ixemulbase'
/gg/lib/libc.a(free.o)(.text+0x2): undefined reference to `ixemulbase'
/gg/lib/libc.a(strlen.o)(.text+0x2): undefined reference to `ixemulbase'
/gg/lib/libc.a(strcpy.o)(.text+0x2): more undefined references to `ixemulbase' follow

I guess because there is no libnix?

_________________
--
Author of
HD-Rec, Sweeper, Samplemanager, ArTKanoid, Monkeyscript, Toadies, AsteroidsTR, TuiTED, PosTED, TKPlayer, AudioConverter, ScreenCam, PerlinFX, MapEdit, AB3 Includes and many more...
Homepage: http://www.hd-rec.de

 Status: Offline
Profile     Report this post  
afxgroup 
Re: Compiling/Linking Shared Library
Posted on 22-Apr-2013 12:01:42
#6 ]
Super Member
Joined: 8-Mar-2004
Posts: 1968
From: Taranto, Italy

@Wanderer

but why are you using noixemul? it seems that ixemul is needed and so you should add also -lixemul

_________________
http://www.amigasoft.net

 Status: Offline
Profile     Report this post  
afxgroup 
Re: Compiling/Linking Shared Library
Posted on 22-Apr-2013 12:30:33
#7 ]
Super Member
Joined: 8-Mar-2004
Posts: 1968
From: Taranto, Italy

otherwise you can always compile using clib2 for 68k

_________________
http://www.amigasoft.net

 Status: Offline
Profile     Report this post  
Wanderer 
Re: Compiling/Linking Shared Library
Posted on 22-Apr-2013 12:52:28
#8 ]
Cult Member
Joined: 16-Aug-2008
Posts: 654
From: Germany

@afxgroup

I cant find any ixeml.a. Where can I get it, and where can I get clib2?

I checked aminet, of course, but didnt find it.

_________________
--
Author of
HD-Rec, Sweeper, Samplemanager, ArTKanoid, Monkeyscript, Toadies, AsteroidsTR, TuiTED, PosTED, TKPlayer, AudioConverter, ScreenCam, PerlinFX, MapEdit, AB3 Includes and many more...
Homepage: http://www.hd-rec.de

 Status: Offline
Profile     Report this post  
broadblues 
Re: Compiling/Linking Shared Library
Posted on 22-Apr-2013 12:53:13
#9 ]
Amiga Developer Team
Joined: 20-Jul-2004
Posts: 4456
From: Portsmouth England

@afxgroup

Quote:

but why are you using noixemul? it seems that ixemul is needed and so you should add also -lixemul

Because he's building an Amiga Shared library?

Ixemul shouldn't be involved at all! libnix should be used in this case.



_________________
BroadBlues On Blues BroadBlues On Amiga Walker Broad

 Status: Offline
Profile     Report this post  
broadblues 
Re: Compiling/Linking Shared Library
Posted on 22-Apr-2013 13:01:03
#10 ]
Amiga Developer Team
Joined: 20-Jul-2004
Posts: 4456
From: Portsmouth England

@Wanderer

I was going to look up the solution we used for AWeb but I can't find the 68k parts of the AWeb library source (I only have the newlib module init on my OS4 machine, 68k is on my a1200, which needs rewiring) but IIRC we provided dummies for these symbols to get arround this issue.

They are never called because the startup code is not included, but are still needed as the libnix clib contains references to them.

exit() should be function that does nothing (if your zlib code calls raise() you are int trouble inside an amiga.library so that will need fixing)

set the _WBStartup to NULL.

_________________
BroadBlues On Blues BroadBlues On Amiga Walker Broad

 Status: Offline
Profile     Report this post  
Wanderer 
Re: Compiling/Linking Shared Library
Posted on 22-Apr-2013 13:09:55
#11 ]
Cult Member
Joined: 16-Aug-2008
Posts: 654
From: Germany

@broadblues

Thanks. Yes, I had in mind that ixemul is not allowed in libraries because of threading issues. That's why I used -noixemul in my other libraries.

I had already dummy "exit" and "WBenchMsg" defined, but still gave me an error. Didnt realize that WBenchMsg has acutally an underscore in fron. Now it works. Well, at least I can bake a zlib.library. Lets see if it actually does what it promises.

_________________
--
Author of
HD-Rec, Sweeper, Samplemanager, ArTKanoid, Monkeyscript, Toadies, AsteroidsTR, TuiTED, PosTED, TKPlayer, AudioConverter, ScreenCam, PerlinFX, MapEdit, AB3 Includes and many more...
Homepage: http://www.hd-rec.de

 Status: Offline
Profile     Report this post  
OlafS25 
Re: Compiling/Linking Shared Library
Posted on 22-Apr-2013 13:15:31
#12 ]
Elite Member
Joined: 12-May-2010
Posts: 6573
From: Unknown

@Wanderer

great

 Status: Offline
Profile     Report this post  
Wanderer 
Re: Compiling/Linking Shared Library
Posted on 22-Apr-2013 13:54:50
#13 ]
Cult Member
Joined: 16-Aug-2008
Posts: 654
From: Germany

Work fine. Thanks to you all guys!

_________________
--
Author of
HD-Rec, Sweeper, Samplemanager, ArTKanoid, Monkeyscript, Toadies, AsteroidsTR, TuiTED, PosTED, TKPlayer, AudioConverter, ScreenCam, PerlinFX, MapEdit, AB3 Includes and many more...
Homepage: http://www.hd-rec.de

 Status: Offline
Profile     Report this post  
OlafS25 
Re: Compiling/Linking Shared Library
Posted on 22-Apr-2013 13:56:17
#14 ]
Elite Member
Joined: 12-May-2010
Posts: 6573
From: Unknown

@Wanderer

great

can I download it somewhere to test it on my configuration?

 Status: Offline
Profile     Report this post  
Wanderer 
Re: Compiling/Linking Shared Library
Posted on 22-Apr-2013 14:07:48
#15 ]
Cult Member
Joined: 16-Aug-2008
Posts: 654
From: Germany

@OlafS25

it is not a replacement for zlib.library, since I defined a different API. I am still unsure if I should replace the zlib.library or make a "zlib2.library".
Not many people actually use the original zlib.library. Most C programmers statically link it, or use z.library, which is good but not available for 68k(?) and doesnt offer setting the compression level easily. It's a shame that such basic things are not better coordinated on Amiga, looking for zlib in Aminet brought up tonns of different ports, all do the same, but all have different interfaces. Waste of time for developers of the libs and developers of Apps.


Last edited by Wanderer on 22-Apr-2013 at 02:11 PM.

_________________
--
Author of
HD-Rec, Sweeper, Samplemanager, ArTKanoid, Monkeyscript, Toadies, AsteroidsTR, TuiTED, PosTED, TKPlayer, AudioConverter, ScreenCam, PerlinFX, MapEdit, AB3 Includes and many more...
Homepage: http://www.hd-rec.de

 Status: Offline
Profile     Report this post  
OlafS25 
Re: Compiling/Linking Shared Library
Posted on 22-Apr-2013 14:16:40
#16 ]
Elite Member
Joined: 12-May-2010
Posts: 6573
From: Unknown

@Wanderer

z.library is available for 68k. I only know of Amiblitz and propably HD-Rec using the zlib library (and of course other software written with Amiblitz). So if you have a solution how I can integrate it without Aros 68k crashing anymore.

 Status: Offline
Profile     Report this post  
Wanderer 
Re: Compiling/Linking Shared Library
Posted on 22-Apr-2013 14:19:08
#17 ]
Cult Member
Joined: 16-Aug-2008
Posts: 654
From: Germany

@OlafS25

I think I will do a z.library compatible lib, that adds one more function, "compress2", which is needed if you want to control the compression level, which is required for Amiblitz3 internal Image saver.

_________________
--
Author of
HD-Rec, Sweeper, Samplemanager, ArTKanoid, Monkeyscript, Toadies, AsteroidsTR, TuiTED, PosTED, TKPlayer, AudioConverter, ScreenCam, PerlinFX, MapEdit, AB3 Includes and many more...
Homepage: http://www.hd-rec.de

 Status: Offline
Profile     Report this post  
OlafS25 
Re: Compiling/Linking Shared Library
Posted on 22-Apr-2013 14:23:11
#18 ]
Elite Member
Joined: 12-May-2010
Posts: 6573
From: Unknown

@Wanderer

thank you very much. I really appreciate your help.

 Status: Offline
Profile     Report this post  
Wanderer 
Re: Compiling/Linking Shared Library
Posted on 22-Apr-2013 14:24:16
#19 ]
Cult Member
Joined: 16-Aug-2008
Posts: 654
From: Germany

@OlafS25

Stimmt habe ich jetzt auch gesehen, es gibt eine 68k Version von 1998. Mir würde aber immer noch eine Funktion fehlen.

Last edited by Wanderer on 22-Apr-2013 at 02:24 PM.

_________________
--
Author of
HD-Rec, Sweeper, Samplemanager, ArTKanoid, Monkeyscript, Toadies, AsteroidsTR, TuiTED, PosTED, TKPlayer, AudioConverter, ScreenCam, PerlinFX, MapEdit, AB3 Includes and many more...
Homepage: http://www.hd-rec.de

 Status: Offline
Profile     Report this post  
itix 
Re: Compiling/Linking Shared Library
Posted on 22-Apr-2013 16:19:44
#20 ]
Elite Member
Joined: 22-Dec-2004
Posts: 3398
From: Freedom world

@Wanderer

Quote:

I think I will do a z.library compatible lib, that adds one more function, "compress2", which is needed if you want to control the compression level, which is required for Amiblitz3 internal Image saver.


I still wish you choose different name than z.library. There is already z.library in MorphOS system libraries.

Quote:

Here is the error report:
/gg/lib/libnix/libnix.a(open.o)(.text+0x26c): undefined reference to `_WBenchMsg'
/gg/lib/libnix/libnix.a(open.o)(.text+0x234): undefined reference to `exit'
/gg/lib/libnix/libnix.a(raise.o)(.text+0x82): undefined reference to `exit'
collect2: ld returned 1 exit status


Btw did you remember to execute constructors?

Last edited by itix on 22-Apr-2013 at 04:24 PM.

_________________
Amiga Developer
Amiga 500, Efika, Mac Mini and PowerBook

 Status: Offline
Profile     Report this post  
Goto page ( 1 | 2 Next Page )

[ home ][ about us ][ privacy ] [ forums ][ classifieds ] [ links ][ news archive ] [ link to us ][ user account ]
Copyright (C) 2000 - 2019 Amigaworld.net.
Amigaworld.net was originally founded by David Doyle