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

Eliot Miranda eliot.miranda at gmail.com
Thu Mar 25 21:43:41 UTC 2021


Hi Tobias, Hi All,

On Thu, Mar 25, 2021 at 3:04 AM Tobias Pape <Das.Linux at gmx.de> wrote:

> Hi Bruce, all
>
>
> > On 25. Mar 2021, at 10:32, Bruce O'Neel <bruce.oneel at pckswarms.ch>
> wrote:
> >
> > Hi,
> >
> > I've attached sqUnixMain.i from the command below.
>
> Thanks, that helps.
>
> The problem is here:
>
> # 1 "/home/edoneel/tmp/opensmalltalk-vm/platforms/unix/vm/sqUnixMain.c" 2
> # 36 "/home/edoneel/tmp/opensmalltalk-vm/platforms/unix/vm/sqUnixMain.c"
> # 1 "/home/edoneel/tmp/opensmalltalk-vm/platforms/Cross/vm/sq.h" 1
> # 12 "/home/edoneel/tmp/opensmalltalk-vm/platforms/Cross/vm/sq.h"
> # 1 "/usr/include/stdio.h" 1 3 4
> # 27 "/usr/include/stdio.h" 3 4
> # 1 "/usr/include/x86_64-linux-gnu/bits/libc-header-start.h" 1 3 4
> # 33 "/usr/include/x86_64-linux-gnu/bits/libc-header-start.h" 3 4
> # 1 "/usr/include/features.h" 1 3 4
> # 439 "/usr/include/features.h" 3 4
> # 1 "/usr/include/stdc-predef.h" 1 3 4
>
>
> This is due to aafcb78371c7e576073a8dbf2f1f32667568e05e, Where the include
> of "sqConfig.h" was demoted to _after_ stdio.h and such.
>
> This seems to deal with an interdependency between EXPORT and
> sqPlatformSpecific.h
> but I don't understand what that has to do with sqConfig.h
>
> I see that _only_ win32 is doing a lot of stuff in sqConfig.h (via
> sqWin32.h) which _most probably_ would belong in sqPlatformSpecific.h in
> the first place.
>
> Since Eliot strongly-worded to not change that, I wont commit a fix.
>

I am trying to maintain a complex product across Windows and MacOS, and
soon enough linux ARMv8.  In doing this I hade to change the order of
includes for sqPlatformSpecific.h to get the EXPORT & IMPORT macros
correctly defined to be able to share variables and functions between the
VM and dlls on Windows.  This *must not* be broken.

I do not object to including a config.h file before any platform includes,
provided that that config.h is generated *and only defines values
meaningful to the platform include files*.  I find sqConfig.h noise at
best.  Its purpose is unclear and differs across platforms.

I said many years ago that I find the current automake code in
platforms/unix/config a disaster:
- it does not run reliably on many linuxes
- it does not produce the same configure script when run on different
distros and different versions of the same distro
- it is two phase, one must first compile, and then configure
- the makefiles it produces are awal: they don't include dependency
information so one must manually delete objects to get proper recompilation

I have said on numerous occasions that I believe that the right way to
tackle these problems is to
- discard the automake nonsense in favour of a small configure script that
generates a sqConfig.h in the root of the relevant build directory (e.g.
build.linux64x64/sqConfig.h, build.linux64ARMv8/sqConfig.h, etc). -- we
can't call it configh.h wit5hout affecting plugins that include code which
has its own config.h
- use proper static makefiles that are parameterised by plugins.int,
plugins.ext and the mvm script

But no one is stepping up to help.  So I'm just going to ensure that Terf
works (it includes everything Squeak does and then much more) on the
platforms we care about at the moment, and try and try and address the
structural problems with the current platform sources when I have time, or
when (as the IMPORT/EXPORT issue did) issues force addressing them.

I've written and maintained the static makefiles for MacOS.  I've written
the static MSVC Makefiles for WIndows.  I've maintained with Nicholas the
static Makefiles for MinGW/Cygwin that Andreas contributed.  I've spent far
too long struggling with the autoconf mess on unix.  Anybody prepared to
step up and move to statuic makefiles, a config.h in every build directory
and move all generated and platform source files to conform to the template

#include "sqConfig.h"
#include <platform headers>
#include "our readers

?


and test across at least 64-bit macos, windows, msvc & mingw/cygwin, & at
least one linux platform?

best
>         -tobias
>
>
>
> >
> > And yes it is in config.h
> >
> >
> > #ifndef _GNU_SOURCE
> > # define _GNU_SOURCE 1
> > #endif
> >
> > Thanks.
> >
> > bruce
> >
> >
> >
> > 25 March 2021 10:14 Tobias Pape <Das.Linux at gmx.de> wrote:
> > Hi Bruce and all
> >
> > > On 25. Mar 2021, at 09:43, Bruce O'Neel 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 which is
> included in the beginning of 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" 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
> > >
> > >
> > >
> >
> >
> >
> > <sqUnixMain.i>
>
>
>

-- 
_,,,^..^,,,_
best, Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20210325/1b55c8fb/attachment-0001.html>


More information about the Vm-dev mailing list