Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AMIGAOS4: undefined reference on linking #241

Closed
raziel- opened this issue Jan 15, 2023 · 9 comments
Closed

AMIGAOS4: undefined reference on linking #241

raziel- opened this issue Jan 15, 2023 · 9 comments

Comments

@raziel-
Copy link
Contributor

raziel- commented Jan 15, 2023

gmake amigaos4
Building for ppc-amigaos4
gmake AOS4=1
gmake[1]: Entering directory /Development/Porting/wildmidi-wildmidi-0.4.5/amiga
gcc -o wildmidi getopt_long.o wm_tty.o amiga.o wildmidi.o -L. -lWildMidi -mcrt=newlib -
/SDK/local/newlib/lib/libWildMidi.a(file_io.o): In function _WM_BufferFileImpl':
file_io.c:(.text+0xac): undefined reference to ExamineFH'
[1]: *** [wildmidi] Error 1
[1]: Leaving directory /Development/Porting/wildmidi-wildmidi-0.4.5/amiga'
: *** [amigaos4] Error 2

libwildmidi.a is the one from the latest package

help?

@sezero
Copy link
Contributor

sezero commented Jan 15, 2023

Amiga code hasn't changed and it links for me, but I'm using an older sdk.
Does the following patch help?

diff --git a/src/file_io.c b/src/file_io.c
index 07ea500..1edcb21 100644
--- a/src/file_io.c
+++ b/src/file_io.c
@@ -56,6 +56,9 @@
 #elif defined(WILDMIDI_AMIGA)
 #include <proto/exec.h>
 #include <proto/dos.h>
+#ifdef __amigaos4__
+#include <dos/obsolete.h>
+#endif
 #else
 #if defined(__unix) || defined(__unix__) || defined(__APPLE__)
 #include <pwd.h>

@raziel-
Copy link
Contributor Author

raziel- commented Jan 15, 2023

Unfortunately no.

Building for ppc-amigaos4
gmake AOS4=1
gmake[1]: Entering directory `/Development/Porting/wildmidi-wildmidi-0.4.5/amiga'
gcc -c -I. -I../include -Wall -W -fno-common -O2 -mcrt=newlib -DWORDS_BIGENDIAN=1 -D__USE_INLINE__ -D__USE_OLD_TIMEVAL__ -o file_io.o ../src/file_io.c
../src/file_io.c: In function 'AMIGA_filesize':
../src/file_io.c:90:13: warning: 'OBSOLETEExamineFH' is deprecated [-Wdeprecated-declarations]
   90 |             if (ExamineFH(fh, fib))
      |             ^~
In file included from /SDK/include/include_h/proto/dos.h:80,
                 from ../src/file_io.c:58:
/SDK/include/include_h/interfaces/dos.h:149:35: note: declared here
  149 |         DEPRECATED LONG APICALL (*OBSOLETEExamineFH)(struct DOSIFace *Self, BPTR fh, struct FileInfoBlock * fib);
      |                                   ^~~~~~~~~~~~~~~~~
ar cr libWildMidi.a wm_error.o file_io.o lock.o wildmidi_lib.o reverb.o gus_pat.o f_xmidi.o f_mus.o f_hmp.o f_midi.o f_hmi.o mus2mid.o xmi2mid.o internal_midi.o patches.o sample.o
ranlib libWildMidi.a
gcc -o wildmidi getopt_long.o wm_tty.o amiga.o wildmidi.o -L. -lWildMidi -mcrt=newlib -lm
/SDK/local/newlib/lib/libWildMidi.a(file_io.o): In function `_WM_BufferFileImpl':
file_io.c:(.text+0xac): undefined reference to `ExamineFH'
gmake[1]: *** [wildmidi] Error 1
gmake[1]: Leaving directory `/Development/Porting/wildmidi-wildmidi-0.4.5/amiga'
gmake: *** [amigaos4] Error 2

@raziel-
Copy link
Contributor Author

raziel- commented Jan 15, 2023

sorry for the mess...amiga browser is...old

@sezero
Copy link
Contributor

sezero commented Jan 15, 2023

Well, I'm stumped.. It reports 'OBSOLETEExamineFH' is deprecated
and link fails with undefined reference to ExamineFH' -- notice that it
doesn't say OBSOLETEExamineFH ...

Everything is built cleanly yes? (make sure to do a make distclean )

@raziel-
Copy link
Contributor Author

raziel- commented Jan 15, 2023

yes, clean build.

I'm not good with that stuff, but maybe it links with ExamineFH from the .a library and there it picks up ExamineFH instead of OBSOLETEExamineFH from the local file?

@sezero
Copy link
Contributor

sezero commented Jan 15, 2023

yes, clean build.

I don't think so (see below)

I'm not good with that stuff, but maybe it links with ExamineFH from the .a library

Where does it find that *.a library? Installed somewhere under system directories?
If that really is the case, remove that one and replace it with the one built with the new
patch.

@raziel-
Copy link
Contributor Author

raziel- commented Jan 15, 2023

Right, i was mixing library files.

WITH your fix it works now, working binary compiled, thank you very much

@sezero sezero closed this as completed in 4b65a50 Jan 15, 2023
@sezero
Copy link
Contributor

sezero commented Jan 15, 2023

OK, patch applied to git. Thank you for all the testing and feedback!

@raziel-
Copy link
Contributor Author

raziel- commented Jan 15, 2023

@sezero

I thank YOU, sir :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants