Swipl-win.exe crash... hint about debugging

I’m trying to develop a swipl-win (Qt 6.6) interface for OGDF, but I’ve got the following SIGSEGV

GDB report in QtCreator:

1 strlen 0x7ffb3ec92071
2 libswipl!PL_new_atom 0x7ffae8a10e86
3 libswipl!PL_get_delay_list 0x7ffae8ac920d
4 libswipl!PL_unregister_atom 0x7ffae8a36db1
5 libswipl!PL_current_prolog_flag 0x7ffae8a1ae58
6 libswipl!PL_cleanup 0x7ffae8a08bed
7 libswipl!PL_halt 0x7ffae8a12704
8 libswipl!PL_load_extensions 0x7ffae8ad318e
9 libswipl!PL_exit_hook 0x7ffae8aa7638
10 libswipl!PL_exit_hook 0x7ffae8aa765b
11 libswipl!PL_thread_self 0x7ffae8aa57dc
12 SwiPrologEngine::run SwiPrologEngine.cpp 238 0x7ff666d89188
13 QThreadPrivate::start qthread_win.cpp 290 0x7ffa93c6dd80
14 KERNEL32!BaseThreadInitThunk 0x7ffb3f79257d
15 ntdll!RtlUserThreadStart 0x7ffb4042aa58
16 ??

I think I have these possibilities now

  1. check if there are tracing functions already available
  2. try to recompile the core swipl.dll in windows (debug symbols would be unimportant, because I could add the tracing I need to find the problem)
  3. I do have a lot of C++ compilers available on Windows… does switch to MSVC could help ?
  4. switch back to my (very old and right now unstable) Ubuntu box, where I was able to compile from source… but I would need to update Qt there… and could be near to impossible…
  5. use WSL to compile from source - I’m unsure if I could reuse my fresh install of Qt 6.6 (~70gb sigh)

Maybe there were some threads on this list about compiling for Windows, but seems I cannot find them right now… sorry for the noise…

Anyway I will try now to follow the documented MSVC route.

I would revive the Ubuntu box. 2nd choice would be to use WSL. Building on Windows works quite well with recent releases (requires VS2022), but it requires a lot of patience to build and the result performs only at 50% compared to the MinGW builds :frowning: Bare metal Ubuntu wins by a big factor, even if the hardware is much less powerful.

Thanks Jan
I do have VS2022, so I will try first this path.

It took a lot… sorry.

Now I’ve found that SIGSEGV was caused by PL_initialise (@line 1211 of pl-init.c) trying to shutdown issuing

fatalError("Could not find system resources");

Given the complexity of startup/shutdown code I don’t think the problem is worth further analysis.

Currently I’m trying to overcome it passing on command line

-x c:/dev/swipl-devel/build/home/boot.prc

and it seems to work, just the menus don’t show up.
Right now I don’t understand what has changed - IIRC when I upgraded to Qt 6.1 it worked out-of-the-box - but I will try to fix/complete the setup phase.

Thanks for your help.

Seems it can’t find its home directory. What do you pass to PL_initialise()?


I have built the debuggable with VS2022, then in swipl-win.pro (QtCreator project) I hardcoded the path

SwiPl = "C:\dev\swipl-devel\build\src\Debug"

Hmm. argv[0] shall be the running program. On Windows you often better use “libswipl.dll”, which causes the initialization to try and find the home from the location of this dll. Various things changed in the code that tries to find the home to accommodate Windows environments that wishes to put swipl.exe in some Unix-like bin directory. It is not impossible this has more consequences. There are a too many scenarios, various of which I cannot test, to validate them all.

The first option listed on The Prolog‘home’ directory worked (that is, pass on the command line --home=c:/dev/swipl-devel/build/home)

Thanks so much.