Gerbil fails to build with --enable-smp #798

Closed
opened 2023-09-06 17:00:52 +00:00 by chiefnoah · 11 comments
chiefnoah commented 2023-09-06 17:00:52 +00:00 (Migrated from github.com)

Configuration:

./configure --enable-shared --enable-libxml --enable-libyaml --enable-lmdb --enable-leveldb --enable-smp --enable-thread-system=posix --enable-multiple-threaded-vms

Output from running make

>>> finalizing build 
'gerbil/interactive/init.ss' -> '/home/noah/repos/gerbil/build/lib/init.ss'
'gerbil/interactive/r7rs-init.ss' -> '/home/noah/repos/gerbil/build/lib/r7rs-init.ss'
'gxi' -> 'gerbil'
'gxc' -> 'gerbil'
[*] Building gerbil stdlib
*** ERROR IN load-module -- Module is incompatible (it was compiled with a different C compiler and/or options)
(load "/opt/gerbil/v0.17.0-213-g737c23a4/lib/gerbil/core__1.o1")
*** ERROR; build failed
build failed
make: *** [Makefile:4: build] Error 1
Configuration: ```shell ./configure --enable-shared --enable-libxml --enable-libyaml --enable-lmdb --enable-leveldb --enable-smp --enable-thread-system=posix --enable-multiple-threaded-vms ``` Output from running `make` ```shell >>> finalizing build 'gerbil/interactive/init.ss' -> '/home/noah/repos/gerbil/build/lib/init.ss' 'gerbil/interactive/r7rs-init.ss' -> '/home/noah/repos/gerbil/build/lib/r7rs-init.ss' 'gxi' -> 'gerbil' 'gxc' -> 'gerbil' [*] Building gerbil stdlib *** ERROR IN load-module -- Module is incompatible (it was compiled with a different C compiler and/or options) (load "/opt/gerbil/v0.17.0-213-g737c23a4/lib/gerbil/core__1.o1") *** ERROR; build failed build failed make: *** [Makefile:4: build] Error 1 ```
vyzo commented 2023-09-06 17:02:34 +00:00 (Migrated from github.com)

Yeah, bug. And we need to get all the testing we can get with smp.

Yeah, bug. And we need to get all the testing we can get with smp.
chiefnoah commented 2023-09-06 17:12:43 +00:00 (Migrated from github.com)

There's a specific incantation required to get Gambit building with SMP support that requires the make bootsrap dance. My exact proceedure is:

/configure --enable-single-host \
                 --enable-dynamic-clib \
                 --enable-trust-c-tco \
                 --enable-march=native
make bootstrap
make bootclean
./configure --enable-single-host \
                  --enable-dynamic-clib \
                  --enable-trust-c-tco \
                  --enable-march=native \
                  --enable-smp \
                  --enable-multiple-threaded-vms \
                  --prefix=/usr/local/gambit
make
sudo make install

...

> gsi
Gambit v4.9.5-38-g74488dc7

> (##current-vm-processor-count)
8
There's a specific incantation required to get Gambit building with SMP support that requires the `make bootsrap` dance. My exact proceedure is: ```shell /configure --enable-single-host \ --enable-dynamic-clib \ --enable-trust-c-tco \ --enable-march=native make bootstrap make bootclean ./configure --enable-single-host \ --enable-dynamic-clib \ --enable-trust-c-tco \ --enable-march=native \ --enable-smp \ --enable-multiple-threaded-vms \ --prefix=/usr/local/gambit make sudo make install ``` ... ``` > gsi Gambit v4.9.5-38-g74488dc7 > (##current-vm-processor-count) 8 ```
chiefnoah commented 2023-09-06 17:13:55 +00:00 (Migrated from github.com)

I've had this working on Linux ARM and Linux x86_64. I get infinite build times on MacOS ARM and eventual segfaults.

I've had this working on Linux ARM and Linux x86_64. I get infinite build times on MacOS ARM and eventual segfaults.
vyzo commented 2023-09-06 17:21:27 +00:00 (Migrated from github.com)

Thank you for the incantation! I will update configure/build to take this into account, fix coming soon.

I don't know what is the problem in MacOS, but be advised that SMP is not stable yet. Crashes are to be expected!

Thank you for the incantation! I will update configure/build to take this into account, fix coming soon. I don't know what is the problem in MacOS, but be advised that SMP is not stable yet. Crashes are to be expected!
chiefnoah commented 2023-09-06 17:25:53 +00:00 (Migrated from github.com)

To clarify, I don't think the above incantation is related to the failure, my guess is the C flags aren't be propagated somehow but I haven't dug into it. The bootstrap thing is necessary to not get silent failures (ie. ##current-vm-processor-count will be 1) for SMP.

No idea what's going on with Mac, it's probably something with LLVM/Clang, but I couldn't get it working with GCC either.

To clarify, I don't think the above incantation is related to the failure, my guess is the C flags aren't be propagated somehow but I haven't dug into it. The bootstrap thing is necessary to not get silent failures (ie. `##current-vm-processor-count` will be 1) for SMP. No idea what's going on with Mac, it's probably something with LLVM/Clang, but I couldn't get it working with GCC either.
vyzo commented 2023-09-06 17:28:35 +00:00 (Migrated from github.com)

I see, can you investigate a bit more? A pr would be wonderful.

If we need to do the bootstrap dance, we should intercept --enable-smp and put a variable in build-env.sh; the build.sh (top level) script can intercept and make a build.sh gambit-smp (or something similar), This will have to be added to src/build.sh.

I see, can you investigate a bit more? A pr would be wonderful. If we need to do the bootstrap dance, we should intercept --enable-smp and put a variable in build-env.sh; the build.sh (top level) script can intercept and make a `build.sh gambit-smp` (or something similar), This will have to be added to src/build.sh.
chiefnoah commented 2023-09-06 17:33:06 +00:00 (Migrated from github.com)

I won't have time for a few days, but I'm happy to give it a go.

I won't have time for a few days, but I'm happy to give it a go.
vyzo commented 2023-09-06 17:37:41 +00:00 (Migrated from github.com)

Thank you.

Thank you.
vyzo commented 2023-09-22 12:13:31 +00:00 (Migrated from github.com)

We now always rebootstrap Gambit as part of the build, is this still an issue?

We now always rebootstrap Gambit as part of the build, is this still an issue?
chiefnoah commented 2023-09-22 17:35:01 +00:00 (Migrated from github.com)

Looks good, even gives your proper SMP behavior:

Gerbil 0.17.0-282-geb2f4eb4 on Gambit v4.9.5-40-g24201248
> (##current-vm-processor-count)
4

Config flags I used:

./configure --enable-shared --enable-libxml --enable-libyaml --disable-lmdb --disable-leveldb --enable-smp --enable-thread-system=posix --enable-multiple-threaded-vms

I did a clean build with no pre-existing Gambit install, so full bootstrap success!

It does look like REPL tab completion is broken (this is probably Gambits, not Gerbil though)

Looks good, even gives your proper SMP behavior: ```shell Gerbil 0.17.0-282-geb2f4eb4 on Gambit v4.9.5-40-g24201248 > (##current-vm-processor-count) 4 ``` Config flags I used: ```shell ./configure --enable-shared --enable-libxml --enable-libyaml --disable-lmdb --disable-leveldb --enable-smp --enable-thread-system=posix --enable-multiple-threaded-vms ``` I did a clean build with no pre-existing Gambit install, so full bootstrap success! It does look like REPL tab completion is broken (this is probably Gambits, not Gerbil though)
vyzo commented 2023-09-22 17:49:48 +00:00 (Migrated from github.com)

Great!

We had to disable the terminal line editor because it causes problem; you can get it back by running with -:te

Great! We had to disable the terminal line editor because it causes problem; you can get it back by running with `-:te`
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
mighty-gerbils/gerbil#798
No description provided.