English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. C/C++

 
 
Thread Tools
Old 30 June 2024, 15:09   #1
Nightfox
Registered User
 
Nightfox's Avatar
 
Join Date: Apr 2016
Location: Perth, Australia
Posts: 408
Need help compiling my first MUI app

Hi all

Due to the wishes of the Amiga community, I have started the process of rewriting my AmigaGPT app from ReAction to MUI but I can't get it to successfully compile when adding some basic MUI code. It gives me a linker error saying the MUI library has an undefined reference to MUIMasterBase.

I define this in the file that I am using the MUI library in.


/opt/m68k-amigaos/lib/gcc/m68k-amigaos/6.5.0b/../../../../m68k-amigaos/bin/ld: /opt/m68k-amigaos/m68k-amigaos/lib//libmui.a(libmui.o): in function `MUI_NewObject':
libmui.c:60: undefined reference to `MUIMasterBase'
/opt/m68k-amigaos/lib/gcc/m68k-amigaos/6.5.0b/../../../../m68k-amigaos/bin/ld: /opt/m68k-amigaos/m68k-amigaos/lib//libmui.a(libmui.o): in function `MUI_MakeObject':
libmui.c:62: undefined reference to `MUIMasterBase'
/opt/m68k-amigaos/lib/gcc/m68k-amigaos/6.5.0b/../../../../m68k-amigaos/bin/ld: /opt/m68k-amigaos/m68k-amigaos/lib//libmui.a(libmui.o): in function `MUI_Request':
libmui.c:64: undefined reference to `MUIMasterBase'
/opt/m68k-amigaos/lib/gcc/m68k-amigaos/6.5.0b/../../../../m68k-amigaos/bin/ld: /opt/m68k-amigaos/m68k-amigaos/lib//libmui.a(libmui.o): in function `MUI_AllocAslRequestTags':
libmui.c:66: undefined reference to `MUIMasterBase'
/opt/m68k-amigaos/lib/gcc/m68k-amigaos/6.5.0b/../../../../m68k-amigaos/bin/ld: /opt/m68k-amigaos/m68k-amigaos/lib//libmui.a(libmui.o): in function `MUI_AslRequestTags':
libmui.c:68: undefined reference to `MUIMasterBase'
collect2: fatal error: ld returned 1 exit status
compilation terminated.


I am compiling this with my Dockerised Amiga dev environment based on Bebbo's amiga-gcc toolchain. So all I have to do to compile it is just run the "build_os3.sh" script.

All this work is living in a branch called ""mui" on my repo here https://github.com/sacredbanana/AmigaGPT/tree/mui

The relevant files with mui changes are Makefile and src/gui.c

If you want to build the project with my exact dev environment just install Docker and then run the "build_os3.sh" script

I've been trying all sorts of things to get that linking error fixed but after several hours I'm starting to get disheartened. I'm guessing there must be something wrong in the Makefile.

Thank you so much <3
Nightfox is offline  
Old 30 June 2024, 16:16   #2
a/b
Registered User
 
Join Date: Jun 2016
Location: europe
Posts: 1,068
Declare a global variable MUIMasterBase (of type Library*)? And eventually initialize it via OpenLibrary()...
a/b is offline  
Old 30 June 2024, 16:18   #3
Nightfox
Registered User
 
Nightfox's Avatar
 
Join Date: Apr 2016
Location: Perth, Australia
Posts: 408
I already do that in gui.c

https://github.com/sacredbanana/Amig.../mui/src/gui.c
Nightfox is offline  
Old 30 June 2024, 16:53   #4
a/b
Registered User
 
Join Date: Jun 2016
Location: europe
Posts: 1,068
Hmmm, ok. Thinking...
1. Did you dump the symbols in libmui.a (on UX I use nm, ar might be helpful too but less user friendly output iirc, not sure what you have available on amiga) and mui.o and check that they match (this is pure c, no c++ obfuscation, but maybe naming/calling convention or something. no underscores but, just in case...).
2. Once upon a time, back in the '90, I was working on a project that was ported to 30+ platforms, and some of the c compilers were stupid, very sensitive to lib/obj order. Maybe have that declaration in a separate .c/.o file and when linking put it before all the libs (-l's).

Last edited by a/b; 30 June 2024 at 17:19. Reason: added ar
a/b is offline  
Old 30 June 2024, 18:26   #5
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,551
Where did you get that libmui.a from? Was it part of the gcc installation or is it from a different source (Aminet)?
MUIMasterBase
without leading underscore seems strange. Looks like ELF-ABI, but last time I checked Bebbo's linker libraries used hunk-format objects, although confusingly they have an .a suffix (for ar) instead of .lib. So I'm not sure if ar or nm would help.

You can also check if you can get rid of libmui completely and use inlines to call the library functions (including
<proto/muimaster.h>
might already do that).
phx is offline  
Old 01 July 2024, 04:15   #6
Nightfox
Registered User
 
Nightfox's Avatar
 
Join Date: Apr 2016
Location: Perth, Australia
Posts: 408
I got the latest from 2021 here https://github.com/amiga-mui/muidev/...I-5.0-20210831
Nightfox is offline  
Old 01 July 2024, 04:17   #7
Nightfox
Registered User
 
Nightfox's Avatar
 
Join Date: Apr 2016
Location: Perth, Australia
Posts: 408
Quote:
Originally Posted by a/b View Post
Hmmm, ok. Thinking...
1. Did you dump the symbols in libmui.a (on UX I use nm, ar might be helpful too but less user friendly output iirc, not sure what you have available on amiga) and mui.o and check that they match (this is pure c, no c++ obfuscation, but maybe naming/calling convention or something. no underscores but, just in case...).
2. Once upon a time, back in the '90, I was working on a project that was ported to 30+ platforms, and some of the c compilers were stupid, very sensitive to lib/obj order. Maybe have that declaration in a separate .c/.o file and when linking put it before all the libs (-l's).
Ill try dumping the symbols and report back
Nightfox is offline  
Old 01 July 2024, 21:01   #8
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,551
Quote:
Originally Posted by Nightfox View Post
The SDK contains a libmui.a in a.out format (with a single object file!). And MUIMasterBase has a leading underscore. So now you have to check and compare what your compiler generates, when you define
MUIMasterBase
.
phx is offline  
Old Yesterday, 02:57   #9
Minuous
Coder/webmaster/gamer
 
Minuous's Avatar
 
Join Date: Oct 2001
Location: Canberra/Australia
Posts: 2,683
I don't understand why you don't just use the official Amiga GUI and avoid all this?
Minuous is offline  
Old Yesterday, 07:59   #10
jPV
Registered User
 
jPV's Avatar
 
Join Date: Feb 2008
Location: RNO
Posts: 1,009
Quote:
Originally Posted by Minuous View Post
I don't understand why you don't just use the official Amiga GUI and avoid all this?
Maybe because ReAction hasn't been the official GUI toolkit that long and feels quite alien for many, and MUI has been the de facto toolkit for ages. And older solutions are more limited...
jPV is offline  
Old Yesterday, 09:03   #11
Minuous
Coder/webmaster/gamer
 
Minuous's Avatar
 
Join Date: Oct 2001
Location: Canberra/Australia
Posts: 2,683
A quarter of a century is not long enough!?
Minuous is offline  
Old Yesterday, 11:04   #12
jPV
Registered User
 
jPV's Avatar
 
Join Date: Feb 2008
Location: RNO
Posts: 1,009
Well, maybe I put it in a bit wrong way, but if we look at versions and amount of use instead of time. It was introduced in H&P's OS 3.5/9, which were released at the very late days when Amiga was still somehow popular, and they were a bit controversial updates and weren't adapted by all users, because they felt more like 3rd party collections than real official OS updates. In practise most programs were still made to run on OS 3.1 with other toolkits, and actual use of ReAction has been very minimal, not even all programs in 3.5/9 were converted to use it. So it's been difficult to take it seriously as the official path until very recently. Hyperion's recent OS releases make it feel more like an official solution, and might make it somehow more popular, but still many programmers want to use toolkits that have been more widely used for longer time and don't require these exact OS versions (or ripping components of them).
jPV is offline  
 


Currently Active Users Viewing This Thread: 2 (0 members and 2 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Running an MUI app on its own screen. Hercules support.Apps 4 06 May 2021 21:23
Horizontal Group Has Content Partially Hidden in MUI v4, Not MUI v3.8a tygre support.Apps 6 29 February 2016 03:27
Building dev versions on OS X -- creating Launcher.app & how to link to FSUAE.app jrodman support.FS-UAE 6 07 December 2013 20:24
Compiling Dopus5. Thorham Coders. C/C++ 0 29 September 2013 04:40
Compiling 1.3.4 rotacak support.WinUAE 70 22 January 2007 08:13

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 01:22.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.08879 seconds with 15 queries