[Vm-dev] [OpenSmalltalk/opensmalltalk-vm] sqUnixEvent.c missing from platforms/unix/vm (#555)

Tobias Pape Das.Linux at gmx.de
Thu Mar 25 09:14:53 UTC 2021


Hi Bruce and all

> On 25. Mar 2021, at 09:43, Bruce O'Neel <bruce.oneel at pckswarms.ch> wrote:
> 
> Hi,
> 
> Yea that's right, but, I think that is not where the problem is.
> 
> What seems to have happened is that someone got clever with <features.h> which is included in the beginning of  <sys/ucontext.h> and which must have changed between different versions of Linux.  So I'm on what is basically Ubuntu 20.4 and they have played around what __USE_GNU means.


>  Now it seams that the magic #define is _GNU_SOURCE.

This is so quite a long time already.
I just checked a system frozen in time in 2012, it is the same there.
All __USE_* get undefined in features.h and only set with the respective _*_SOURCE options.

The __USE_GNU dance in
	 https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/4f6b75b56b314c20b1842078872bd845d61344a4/platforms/unix/vm/include_ucontext.h#L15

is hence sadly ineffective.


> 
> The easiest patch I found is below and attached above.  I also attached features.h just so you can see the nightmare that has become.
> 
> diff --git a/build.linux64x64/squeak.cog.spur/build/mvm b/build.linux64x64/squeak.cog.spur/build/mvm
> index 29b710460..eb67f677e 100755
> --- a/build.linux64x64/squeak.cog.spur/build/mvm
> +++ b/build.linux64x64/squeak.cog.spur/build/mvm
> @@ -34,7 +34,7 @@ test -f config.h || ../../../platforms/unix/config/configure --without-npsqueak
> --with-src=spur64src \
> TARGET_ARCH="-m64" \
> CC=clang \
> - CFLAGS="$CFLAGS" \
> + CFLAGS="$CFLAGS -D_GNU_SOURCE=1" \
> LIBS="$LIBS" \
> LDFLAGS="$LDFLAGS"
> rm -f vm/sqUnixMain.o # nuke version info
> 
Configure should define that!

AC_USE_SYSTEM_EXTENSIONS in 
	https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/4f6b75b56b314c20b1842078872bd845d61344a4/platforms/unix/config/configure.ac#L42
does exactly that: if GNU Extensions are avaialbe, define _GNU_SORUCE.

This define should be in config.h

This is the unconfigured file: https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/Cog/platforms/unix/config/config.h.in#L392

Once you run ./configure, it _will_ define _GNU_SOURCE.

However, it must be sur that config.h is included. 
This is done unconditionally in sqMemoryAccess.h and conditionally (HAVE_CONFIG_H) in sqConfig.h (which is pulled by sq.h)
(HAVE_CONFIG_H is set as I see in your email from 2 days ago)


Based on your command in your email, can yous please send the output of

clang -Wall  -g -O2 -DNDEBUG -DDEBUGVM=0 -msse2 -DCOGMTVM=0 -pthread -DLSB_FIRST=1 -m64 -Wno-missing-braces -Wno-unknown-pragmas -Wno-unused-value -Wno-unused-label -Wno-unused-function -Wno-unused-variable  -DHAVE_CONFIG_H  -DSQUEAK_BUILTIN_PLUGIN -I/home/edoneel/tmp/opensmalltalk-vm/build.linux64x64/squeak.cog.spur/build -I/home/edoneel/tmp/opensmalltalk-vm/build.linux64x64/squeak.cog.spur/build -I/home/edoneel/tmp/opensmalltalk-vm/platforms/unix/vm -I/home/edoneel/tmp/opensmalltalk-vm/platforms/Cross/vm -I/home/edoneel/tmp/opensmalltalk-vm/spur64src/vm -I/usr/local/include -I/home/edoneel/tmp/opensmalltalk-vm/platforms/Cross/vm -I/home/edoneel/tmp/opensmalltalk-vm/platforms/unix/vm -I/home/edoneel/tmp/opensmalltalk-vm/spur64src/vm -I/home/edoneel/tmp/opensmalltalk-vm/platforms/Cross/plugins/FilePlugin -I/home/edoneel/tmp/opensmalltalk-vm/platforms/unix/plugins/B3DAcceleratorPlugin -m64 -Wno-missing-braces -Wno-unknown-pragmas -Wno-unused-value -Wno-unused-label -Wno-unused-function -Wno-unused-variable   -E -o sqUnixMain.i /home/edoneel/tmp/opensmalltalk-vm/platforms/unix/vm/sqUnixMain.c

and the resulting sqUnixMain.i?


Best regards
	-Tobias


> I tried to play the same ifdef games currently with __USE_GNU in include_ucontext.h but I was not successful.
> 
> This builds both with clang and with gcc on Ubuntu 20.4 on x86_64.
> 
> cheers
> 
> bruce
> 
> 24 March 2021 20:58 "David T. Lewis" <lewis at mail.msen.com> wrote:
> 
> On Wed, Mar 24, 2021 at 11:54:55AM -0700, Eliot Miranda wrote:
> >
> > Hi David,
> >
> > On Mon, Mar 22, 2021 at 4:14 PM David T. Lewis wrote:
> >
> > >
> > > On Mon, Mar 22, 2021 at 11:46:27AM +0100, Bruce O'Neel wrote:
> > > >
> > > >
> > > > Hi,
> > > >
> > > > That fixed one problem I was tripping over on the ARMv8 build.
> > > >
> > > > There still seems to be a problem with the x86-64 build.????
> > > >
> > > > Thanks.
> > > >
> > > > bruce
> > >
> > > I see the same issue on my Linux x86-64 PC. I cannot spot the exact cause
> > > of
> > > the problem, but it seems to have been introduced in this commit:
> > >
> > > commit 6d74c4b652c7780110fe327f97e98aaef5242fbc
> > > Author: Eliot Miranda
> > > Date: Wed Feb 10 21:41:31 2021 -0800
> > >
> > > Revisions to core include files to get EXPORT defined correctly at the
> > > relevant points.
> > > Essentially move the default EXPORT definitions from sq.h to
> > > sqMemoryAccess.h.
> > > Include fbdev support in build.linux32ARMv6 builds and add -m32 to
> > > their CFLAGS
> > > to attempt to get the 32-bit VMs to be compilable on 64-bit ARM. [ci
> > > skip]
> > > cuz new cogit files will arrive soon.
> > >
> > >
> > > The changes seem straightforward, but for some reason the header files must
> > > not be getting included properly.
> > >
> > > Dave
> > >
> > > >
> > > /home/edoneel/tmp/opensmalltalk-vm/platforms/unix/vm/sqUnixMain.c:926:35:
> > > error: use of undeclared identifier 'REG_RBP'
> > >
> >
> > If you have a look at the code here the file is trying to
> > - find out what platform it is on
> > - pull in the relevant version of ucontext.h containing the relevant
> > defines for extracting register values from an interrupt context
> > - print out the registers for a crash report
> > So please look to
> > - find out if platforms/unix/vm/include_ucontext.h is working correctly on
> > this platform
> > - find out what are the platform defines (-E -dM is your friend here)
> > - find out how ucontext.h defines the registers in a ucontext
> >
> 
> Hi Eliot,
> 
> I think that platforms/unix/vm/include_ucontext.h is working correctly.
> Using -E -dM, I can confirm:
> 
> #define __linux__ 1
> #define __x86_64 1
> 
> Also, include_ucontext.h was not modified in commit 924a24bb54870a621c5283f23631261d5a792000
> which is where I think the issue originates(?).
> 
> So there is something else going wrong with the includes for Linux, but
> I am blind and cannot spot it.
> 
> Dave
> 
> 
> <diff><features.h>




More information about the Vm-dev mailing list