Okay, so here is the update:
======Update======
So, the issue regarding gethostname is solved by using -D__NO_NET_API, and Olaf uses this regularly in his other projects.
This means that it should be:
./configure --host=ppc-amigaos CFLAGS="-mcrt=clib2 -D__NO_NET_API"
Getting us further to:
CC lib/gettime.o
lib/gettime.c: In function 'gettime':
lib/gettime.c:43: error: 'struct rpl_timespec' has no member named 'tv_secs'
We still have this issue regarding "tv_secs" to solve.
Quote:
PRESUMPTION: I got help looking at Olafs Makefile.os4 from his SMBFS project. I should continue to look at what other options he is using for that project (as an idea)
*** TODO: Figure out the issue with 'tv_secs'.
*** __USE_OLD_TIMEVAL__ is used in a lot of Amiga projects I can see on GitHub. Look at
https://wiki.amigaos.net/wiki/Programm ... _-_The_Data_Administrator and search for OLD_TIME - You can see that the Amiga is incompatible. Again, somewhere in the configuration I need to sort something out!
---> Okay, I noticed that at some point (2017-ish) struct timespec was added to CLIB2 include/time.h. I decided to keep the old clib2 as it was and just copy over that particular change to the time.h file. So, at this point we have solved the gethostname and the tv_secs issue. (Hack NUMBER -1)
Clearly, some version of something is incompatible. After that, I received an error about the usage of C99 type of for loop, this can be corrected. But, if the compiler is not C99 then surely coreutils was not built with 4.2.4!
So, I will hack in the pre c-99 change to the for loop in: lib/secure_getenv.c:87 (Hack always needed NUMBER 0)
Now we get the error:
CC lib/time_rz.o
In file included from lib/time_rz.c:30:
/opt/ppc-amigaos/ppc-amigaos/SDK/clib2/include/stdbool.h:58:2: warning: #warning C99 header file used by non-C99 compliant compiler.
lib/time_rz.c:39: error: static declaration of 'rpl_tzset' follows non-static declaration
/opt/ppc-amigaos/ppc-amigaos/SDK/clib2/include/time.h:126: error: previous declaration of 'rpl_tzset' was here
Makefile:7666: recipe for target 'lib/time_rz.o' failed
To get around that, I just defined TZSET in or around 30 of time_rz. (Hack always needed NUMBER 1).
Then,
undefined referenced to some wide char function. This confirms that you really do need to link with libwide.a as specified in the readme file.
***Currently trying to add -lwide to the LIBS passed to ./configure.
So, this gets passed the error regarding strings, but the WIDE library relies on 'strnlen' which is not even included in the generated SDK version created via the X-compile tool chain build! This means that we have to update the version of the SDK/clib2 library since newer version include 'strnlen'.
*** So, we will no longer need hack NUMBER -1 since a newer clib2 will also include a definition for struct timespec (something that was added to clib2 also). AND SO, we end up going back to the fact of the bottom of README.os4 for CoreUtils which says: you need libwide and the "latest" clib2 version on github [although, the latest version at the time of that writing for 2017].
==So, let's use the latest clib2 - this may include compiling it===
NOTE: Even the latest clib2 from 53.34 (latest SDK) does not include strnlen. But, the git-hub master version does.
***TODO: Compile the latest clib2 from the git-hub master as referenced in the readme guide. Expect to fix NUMBER 0 and perhaps NUMBER 1 and then rebuild and see what happens. [[[DONE]]]
***** It is clear that this was never compiled with GCC 4.2.4 and since the wide library (libwide.a) uses strnlen it is also clear that we need the non-official clib2 included in even the latest SDK. clib2 on the github does include strnlen. Fact is, when you put the pieces together, I have realised that you need 1. a newer compiler with c99 and 2. the github version of CLIB2 3. yeah, libwide.a also.
So now: let's compile the latest CLIB2 (github), with the old 4.2.4 GCC compiler (we need to remove force aggressive loop option) and see what happens when we just drop the newly compiled CLIB2 into the older SDK location in /opt/ppc-amigaos. This will not result in not needing to do all of the hacks since, at the very least, we are using a non-c99 compiler!
===Compiling new Clib2 from GitHub===
This seemed to compile, but I am using the old 4.2.4 compiler which I should not! Anyway, it just compiled and I can see the libraries
***TODO: Put the built clib2 into the ppc-amigaos directory in chroot /opt/ppc* and see what the hell happens! I am only replacing the clib2 within the SDK directory, that may be an issue ... ? If that does not work, then put the latest SDK in there as well.
==> And so, this seems to have improved things. But there are more undefined references requiring the addition of "-lnet -lunix" so far. Also, using the latest clib2 resulted in me not needing to worry about non-C99 compliancy.
But this leads to: __huge_val being undefined. I think we are missing "-lm" also. So, let's try that...
===SUMMARY===
So, I finally got CoreUtils to compile. I wanted to do that because I noticed that with the latest CoreUtils.lha from OS4Depot RM -RF was not working. I would like someone else to confirm this though. So, if anyone can just create a directory and touch a file in that directory and then run RM -RF on that directory, can you confirm that this does not work. It was not for me; see also (
https://github.com/adtools/coreutils/issues/1). What I wanted to do was to fix this issue. Since this required the source code I set about finding the CoreUtils source code and I found it on GitHub. At this point I was under the niave assumption that downloading the latest SDK would be enough, but I was quite wrong! During this experiment, I have realised that people are using a version of CLIB2 that is not within the latest SDK. I have also noticed that people are not using the version of GCC provided with the latest SDK; so, I ask myself, should I have known about this already? For someone new coming to the Amiga scene (niche, I know) would they know that the latest SDK is not really enough? If not, how would they know other than doing what I have done which is to ask on the forums? Further, the reason I want to fix CoreUtils for native usage on the AmigaOne is because I like to do everything on my Amiga. I have since heard that people are happy to develop for the Amiga using alternative machine and are happy to X-Compile. Maybe I am just insane, but I like the idea that if I only ever had one computer remaining after a nuclear apocolypse and it was my AmigaOne X1000: I would have the resources to develop to new software for it!
When I noticed that RM -RF was not working, I tried to just download CoreUtils and build it on my Amiga. But, the very use of RM -RF in the Makefile itself caused issues.
So, what did I do?
- I said, let's use my Linux system which already has the tools on it (albeit, a very slow machine)
- Downloaded CoreUtils from
https://github.com/adtools/coreutils/- Used the README.os4 in there and took inspiration from the last entry which said:
Quote:
6-08-2017 - Version 54.1
Coreutils 8.29 source used for the port
The sourcecode for Sort and Split have been replaced with the old 5.2.1-9 code.
To compile you need libwide found on http://os4depot.net and the current clib2 code from http://github.com/adtools/clib2
- Realised that I would need a CrossCompiler to do this: I assumed that "adtools" was the main place. And I saw
https://github.com/adtools/amigaos-cross-toolchain.
- Realised in the
https://github.com/adtools/amigaos-cross-toolchain/ README.md says: you shall use a GCC 5.X compiler with 32-bit libs
- Decided to create a CHROOT on my Linux machine using Xenial 32 bit since that also came with GCC 5.x out of the box
- Built the ppc-amigaos-* tool chain and installed to the default /opt/ppc-amigaos
- The above point means that I have the default GCC 4.2.4 with an older version of the SDK which is purely from Hyperion.
- Then, I cloned the CoreUtils from the GitHub
- ./configure --host=ppc-amigaos
- Bumped into a number of issues along the way (see above)
- required -D__NO_NET_API
- required fixing C99 for-loops since the build process believed that this was a non-C99 compiler
- Realised that I really did need libwide.a as suggested in the README.os4 fle from the CoreUtils
- Realised that libwide was using 'strnlen' that was not even in CLIB2 using the latest SDK, and so:
- Realised that I needed to upgrade the CLIB2 version using the CLIB2 on the GitHub [
https://github.com/adtools/clib2] (since the Hyperion official one did not have the necessary features)
- Compiled the latest CLIB2 from GitHub
- So, I kept the original /opt/ppc-amigaos/ etc files that were installed via the cross-compiler build above, but simply replaced SDK/CLIB2 with the newly compiled one
- Realised that I needed to use "-lnet -lunix -lm -lwide -lc"
/configure --host=ppc-amigaos CFLAGS="-mcrt=clib2 -D__NO_NET_API" LIBS=-"lwide -lc -lnet -lunix -lm" && make
- Finally compiled CoreUtils
===RESULT===
So, I SCP the freshly compiled RM to my Amiga X1000 and just try it out out of curiosity and it works! Now, my RM compiled will actually work correctly if there is something in a test directory.
=======
So, I am wondering if someone can test out RM using CoreUtils supplied through AmigaOS 4 Depot.
Regards.
===EDIT===
I may have just realised that the latest SDK does not need CoreUtils. Looks like the latest SDK has separate binary for RM, CP etc vs the older SDK (as of last week) which all went through the "coreutils" binary.