Hi Florian,
which vm are you trying to build? https://github.com/OpenSmalltalk/opensmalltalk-vm or some other vm?
_,,,^..^,,,_ (phone)
On Nov 29, 2022, at 4:10 AM, Florian Weimer fweimer@redhat.com wrote:
I'm trying to build the VM with a C compiler which does not accept implicit function declarations or implici int.
This is in preparation for a future change in GCC and Clang defaults. More information is here:
https://fedoraproject.org/wiki/Changes/PortingToModernC https://fedoraproject.org/wiki/Toolchain/PortingToModernC
(The second link points to a container image with an instrumented GCC that can be used for experiments, or you can just inject -Werror=implicit-function-declaration -Werror=implicit-int into the build, which has the same results if compiler flags injection works reliably throughout the build environment.)
According to Fedora's records Squeak-4.10.2.2614-src-no-mp3 was downloaded from http://squeakvm.org/unix/release/.
I got passed the first obstacle with these little changes:
diff -ur Squeak-4.10.2.2614-src-no-mp3.orig/Cross/plugins/CroquetPlugin/CroquetPlugin.h Squeak-4.10.2.2614-src-no-mp3/Cross/plugins/CroquetPlugin/CroquetPlugin.h --- Squeak-4.10.2.2614-src-no-mp3.orig/Cross/plugins/CroquetPlugin/CroquetPlugin.h 2006-09-14 19:52:45.000000000 +0200 +++ Squeak-4.10.2.2614-src-no-mp3/Cross/plugins/CroquetPlugin/CroquetPlugin.h 2022-11-29 12:30:00.834158643 +0100 @@ -20,4 +20,6 @@ */ int ioGatherEntropy(char *bufPtr, int bufSize);
+int triBoxOverlap(float *a, float *b, float *c, float *d, float *e);
#endif /* CROQUET_PLUGIN_H */ diff -ur Squeak-4.10.2.2614-src-no-mp3.orig/Cross/plugins/CroquetPlugin/TriBoxStub.c Squeak-4.10.2.2614-src-no-mp3/Cross/plugins/CroquetPlugin/TriBoxStub.c --- Squeak-4.10.2.2614-src-no-mp3.orig/Cross/plugins/CroquetPlugin/TriBoxStub.c 2009-05-26 23:15:18.000000000 +0200 +++ Squeak-4.10.2.2614-src-no-mp3/Cross/plugins/CroquetPlugin/TriBoxStub.c 2022-11-29 12:30:10.184066148 +0100 @@ -1,3 +1,5 @@ +#include "CroquetPlugin.h"
/* a stub for triboxoverlap */ int triBoxOverlap(float *a, float *b, float *c, float *d, float *e) { return 0; diff -ur Squeak-4.10.2.2614-src-no-mp3.orig/Cross/plugins/SerialPlugin/SerialPlugin.h Squeak-4.10.2.2614-src-no-mp3/Cross/plugins/SerialPlugin/SerialPlugin.h --- Squeak-4.10.2.2614-src-no-mp3.orig/Cross/plugins/SerialPlugin/SerialPlugin.h 2009-08-27 03:48:06.000000000 +0200 +++ Squeak-4.10.2.2614-src-no-mp3/Cross/plugins/SerialPlugin/SerialPlugin.h 2022-11-29 13:02:56.418443376 +0100 @@ -6,9 +6,13 @@
#pragma export on int serialPortClose(int portNum); +int serialPortCloseByName(const char *portName);
int serialPortCount(void); int serialPortOpen(int portNum, int baudRate, int stopBitsType, int parityType, int dataBits, int inFlowCtrl, int outFlowCtrl, int xOnChar, int xOffChar); +int serialPortOpenByName(char *portName, int dataRate, int stopBitsType, int parityType, int dataBits,
int inFlowCtrl, int outFlowCtrl, int xOnChar, int xOffChar);
int serialPortReadInto(int portNum, int count, void *bufferPtr); int serialPortReadIntoByName(const char *portName, int count, void *bufferPtr); int serialPortWriteFrom(int portNum, int count, void *bufferPtr); diff -ur Squeak-4.10.2.2614-src-no-mp3.orig/unix/plugins/AsynchFilePlugin/sqUnixAsynchFile.c Squeak-4.10.2.2614-src-no-mp3/unix/plugins/AsynchFilePlugin/sqUnixAsynchFile.c --- Squeak-4.10.2.2614-src-no-mp3.orig/unix/plugins/AsynchFilePlugin/sqUnixAsynchFile.c 2006-10-18 19:10:25.000000000 +0200 +++ Squeak-4.10.2.2614-src-no-mp3/unix/plugins/AsynchFilePlugin/sqUnixAsynchFile.c 2022-11-29 12:30:44.062730997 +0100 @@ -142,7 +142,7 @@ return fp; }
-INLINE static allocateBuffer(struct FileBuf *buf, int size) +INLINE static int allocateBuffer(struct FileBuf *buf, int size) { if (buf->capacity >= size) return 1;
A few more changes like these seem to be needed.
But now I'm hitting this error:
…/unix/src/vm/intplugins/MiscPrimitivePlugin/MiscPrimitivePlugin.c:118: implicit function declaration: isBytes
This error is harder to deal with because it seems to be a bug in the code generator. There probably should be a macro definition for isBytes similar to arrayValueOf, like this:
#define isBytes(oop) (interpreterProxy->isBytes(oop))
Otherwise, the global function definition is picked up instead, and that does not seem to be the right pattern.
Thanks, Florian