bebbo / amiga-gcc

The GNU C-Compiler with Binutils and other useful tools for cross development for Amiga
GNU General Public License v2.0
312 stars 66 forks source link

Download aside, what’s needed for NDK3.2 support #222

Closed acf closed 3 years ago

acf commented 3 years ago

I was wondering if there’s been any investigation into what would required to install the new NDK3.2 alongside NDK13 and NDK39 ?

I realise there isn’t anywhere to directly downlad it from so it’s not going to part of the Makefile for a while, even if the rest is easy.

I had thought I might start playing and running the same FD tools over the new NDK as you do in the Makefile but I’ve been reading stuff from gulliver and boemann that seems to suggest it should work out of the box and the protos are ready to go.

Anyway, figured I’d ask here rather than just another EAB thread.

(unlike an apple M1 this is an issue where I can buy you what you need if you don’t have it already) :)

bebbo commented 3 years ago

thanks - I have no need for another NDK3.2 or any apples... ... at least the CONST APTR are gone.

Maybe a requester please insert disk AmigaOS3.2CD should pop up during the build? ^^

... once I find the time I'll take care of it

acf commented 3 years ago

Good to know, and hope it didn’t come across as impatient, I was actually hoping to see if I could help 😂

could be as simple as a requester just asking for a folder containing the NDK (in case it’s already installed). This is what VBCC does on the Amiga.

encelo commented 3 years ago

I subscribed to the issue as I'm interested in its progress as well. I just got my Amiga OS 3.2 CD and I'm eager to try the new NDK. :wink:

acf commented 3 years ago

FWIW I got it working in SAS/C on the amiga with little trouble if you're eager and can't wait :-). I understand there are Things That Happen(*) in the amiga-gcc makefile after downloading NDK39 and I'm not sure if they also Need To Happen to 3.2. I might try just replacing the lib and headers in the 3.9 folders and see what happens.

(*) patches and then fd2pragma

encelo commented 3 years ago

I might try just replacing the lib and headers in the 3.9 folders and see what happens.

That's what I tried to do yesterday but it seems it is not enough: the compiler complains about missing files. 😢 I suspected those are created by the sfdc tool when it is invoked by the Makefile,

bebbo commented 3 years ago

I looked into the new SDK and there's only few new stuff.

=> I can live with the (yet) free downloadable NDK3.9...

acf commented 3 years ago

For anyone else interested, the 3.2 NDK is now freely available here https://www.hyperion-entertainment.com/index.php/downloads?view=files&parent=40. I'll see how far I can get cloning the NDK39 make process and substituting the 32. If I get it working I'll try submitting a patch.

bebbo commented 3 years ago

For anyone else interested, the 3.2 NDK is now freely available here https://www.hyperion-entertainment.com/index.php/downloads?view=files&parent=40. I'll see how far I can get cloning the NDK39 make process and substituting the 32. If I get it working I'll try submitting a patch.

These are good news!

Once working forec the patches to be added into the original NDK^^

acf commented 3 years ago

Hah. The download is a weird javascript link from hyperion to the lha file, so there's the first hurdle in an automatic download. Anyhoo, I'm still bashing on.

acf commented 3 years ago

Just an update that I haven't been able to look at this at all, sorry :-(. There are still changes happening to the 3.2NDK so its probably worth waiting a bit.

RasmusEdgar commented 3 years ago

It seems to be more freely available now: http://aminet.net/package/dev/misc/NDK3.2R3

chris-y commented 3 years ago

It's also on Hyperion's website and has been for a while. I can't get it to work with GCC (or vbcc), there seems to be issues with the included inlines. Here at the linking stage it fails to find any of the OS symbols.

(vbcc isn't particularly relevant here, but if I generate my own inlines they work, the ones in the archive don't - suspect the same for GCC but haven't tried)

bebbo commented 3 years ago

It's also on Hyperion's website and has been for a while. I can't get it to work with GCC (or vbcc), there seems to be issues with the included inlines. Here at the linking stage it fails to find any of the OS symbols.

(vbcc isn't particularly relevant here, but if I generate my own inlines they work, the ones in the archive don't - suspect the same for GCC but haven't tried)

there is a thread on eab - it seems that only the fd files are correct and the sfd aren't

acf commented 3 years ago

Small update. I took NDK3.2R3 and copied the various headers, libs, FD and SFD files into the ndk-include and ndk/lib/* and all seems well. I had to define __USE_NEW_TIMEVAL__ to use -mcrt=nix20 because of what you can see in the 3.2 device/timer.h

Now happily building with NDK3.2 instead of 3.9

acf commented 3 years ago

Oh and additionally I know work is ongoing with the 3.2 team and Frank Wille to better support vbcc.

encelo commented 3 years ago

@acf Thanks for the updates! 🙏🏻 Do you already have a PR or a custom script that installs the latest NDK 3.2 to be used with GCC? 😉

acf commented 3 years ago

No I'm afraid not :-) But it's literally emptying out and refilling the following folders:

/opt/amiga/m68k-amigaos/ndk-include (copy from NDK3.2R3/Include_H) /opt/amiga/m68k-amigaos/ndk/fd (copy from NDK3.2R3/FD) /opt/amiga/m68k-amigaos/ndk/sfd (copy from NDK3.2R3/SFD) /opt/amiga/m68k-amigaos/ndk/linker_libs (copy from NDK3.2R3/lib)

There's no replacement for linker_libs/reaction.lib in 3.2R3 just now but since the 3.9 one only worked with SAS its no great loss in terms of just keeping on doing whatever you were doing before.

I'll stress again loudly, I am far from experienced here and I don't know if that might break something else, but I can say for sure the couple of little amiga projects I've been working on (a minimal git client and a teach-myself-intuition-and-gadtools toy project) both compiled and linked and ran fine on 3.2

Its worth noting the __USE_NEW_TIMEVAL__ define as well if you run into an error with timeval defined twice (see device/timer.h in the 3.2 NDK for comments).

bebbo commented 3 years ago

make all NDK=3.2

acf commented 3 years ago

Thank you :-)

acf commented 3 years ago

Worth adding this to the README.md ?

bebbo commented 3 years ago

who can read, can read

acf commented 3 years ago

I just did a clean and clean-prefix, then update and all with NDK=3.2 and got an error

Screenshot 2021-08-11 at 17 16 43
acf commented 3 years ago

(I removed the [...] from the various struct Bitmap* bm2 in the file and everything proceeding as normal).

Update: spoke too soon. errors now from the inlines,

Screenshot 2021-08-11 at 17 37 25
bebbo commented 3 years ago

your sfdc is not current - did you run make update?

acf commented 3 years ago

I did gmake clean clean-prefix update all just to make sure. Perhaps I'll delete the whole thing and start with a fresh clone just to make sure

bebbo commented 3 years ago

so something like this:

git pull
make update
make clean clean-prefix
make all NDK=3.2 -j12
acf commented 3 years ago

yup that's what I did, only all on the same line (and no -j12). Just did a fresh clone and will try the steps separately.

bebbo commented 3 years ago

so, that's not what you did^^ it makes a difference if used together or not. it's make.

acf commented 3 years ago

a fair and valid point :-) 🤦

acf commented 3 years ago

Fresh clone, steps performed as you specified (except its gmake cause I'm using homebrew on my Mac)

acf commented 3 years ago

inline headers say automatically generated by sfdc 1.11 if that's relevant

bebbo commented 3 years ago

what's the result of which sfdc ?

acf commented 3 years ago
acf@Touchbook16 amiga-gcc % which sfdc
/opt/amiga/bin/sfdc
acf@Touchbook16 amiga-gcc % sfdc -v
sfdc 1.11 (2019-03-07)
Copyright (C) 2003-2016 Martin Blom <martin@blom.org>
This is free software; see the source for copying conditions.
acf commented 3 years ago

So I went into my clone of amiga-gcc and then projects/sfdc and git remote shows that its come from the original adtools/sfdc not your bebbo/sfdc which I see has additional commits for 3.2.

When I look at amiga-gcc/Makefile it does indeed have GIT_SFDC := https://github.com/adtools/sfdc.

https://github.com/bebbo/amiga-gcc/blob/master/Makefile#L41

Does that need to be pointing to your fork?

acf commented 3 years ago

ok, made that change and tried again. Still lots of mv: .state0: No such file or directory but no complaints about the layers_lib.sfd ... still building so we'll see if the inlines compile ok :-)

acf commented 3 years ago

failed building libnix now. in ndk-13/clib these protos (in the screenshot) all contain only the following

#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif

the other proto files in there seem ok.

Screenshot 2021-08-12 at 00 13 20
acf commented 3 years ago

copied those 9 files from a backed up copy of /opt/amiga/m68k-amigaos/ndk13-include/clib from before and ran make all again.

Getting further each time.

acf commented 3 years ago

...and DONE. 🎉

So,

1/ Makefile needs sfdc updated to point to your fork https://github.com/bebbo/amiga-gcc/blob/master/Makefile#L41 2/ that fork /seems/ to generate 9 bad files in ndk13-include/clib

bebbo commented 3 years ago

thanks for pointing to what i forgot

acf commented 3 years ago

Thanks for doing an incredible amount of complex fiddly work on our behalf. :-). Any thoughts on the bad ndk13 files ?

bebbo commented 3 years ago

Thanks for doing an incredible amount of complex fiddly work on our behalf. :-). Any thoughts on the bad ndk13 files ?

no bad files here... what am I missing?

acf commented 3 years ago

you didnt see this happen ? https://github.com/bebbo/amiga-gcc/issues/222#issuecomment-897222034. Interesting. I shall, again, do a fresh clone and start from scratch.

bebbo commented 3 years ago

no need to clone - the steps from above are fine.

maybe it's a general sed issue and it's not related to NDK3.2?

acf commented 3 years ago

Could be, but curious you are not seeing the same issues.

acf commented 3 years ago

I think the 3.9 URL is wrong in the Makefile and was giving me a 404.

https://github.com/bebbo/amiga-gcc/blob/master/Makefile#L57

should be (no _ or . )

http://haage-partner.de/download/AmigaOS/NDK39.lha

acf commented 3 years ago

I'm mostly talking to myself now I see the text I'm seeing in the "bad files" is generated there, not by sfdc.

https://github.com/bebbo/amiga-gcc/blob/master/Makefile#L748-L751

That was changed in the 3.2 commit so Maybe something gone wrong there ?

https://github.com/bebbo/amiga-gcc/commit/e7d9d3418b8f46ef205f6a8e90937767454b277e#diff-76ed074a9305c04054cdebb9e9aad2d818052b07091de1f20cad0bbac34ffb52L727-R749

I get the same "bad files" in ndk13 with both 3.9 and 3.2

acf commented 3 years ago

OK reverted that change in the sed line and now can build with NDK39 again. Still get a few Warning: XXX has no prototype messages but far fewer than before.

If I make it to the end with 39 I'll try again with 3.2

acf commented 3 years ago

reverted change https://github.com/bebbo/amiga-gcc/commit/e7d9d3418b8f46ef205f6a8e90937767454b277e#diff-76ed074a9305c04054cdebb9e9aad2d818052b07091de1f20cad0bbac34ffb52L727-R749 worked for 39 again, but not for 3.2, so indeed some change in that regex is needed for 3.2, but the change as it exists broke both 39 and 32 as far as I can tell.

bebbo commented 3 years ago

you need a better sed it's working fine here

bebbo commented 3 years ago

I think the 3.9 URL is wrong in the Makefile and was giving me a 404.

https://github.com/bebbo/amiga-gcc/blob/master/Makefile#L57

should be (no _ or . )

http://haage-partner.de/download/AmigaOS/NDK39.lha

thanks, fixed it