swipl-devel icon indicating copy to clipboard operation
swipl-devel copied to clipboard

Error occurred in building packages/swipl-win in Ubuntu 20.04

Open haohaiziround opened this issue 4 years ago • 6 comments
trafficstars

Hi,

I have encountered an error when building from source on my Ubuntu 20.04 machine following instructions in CMAKE.md as well as swi-prolog website. Error messages are as follows,

[ 89%] Built target swipl-win_autogen
[ 89%] Generating qrc_swipl-win.cpp
Scanning dependencies of target swipl-win
[ 89%] Building CXX object packages/swipl-win/CMakeFiles/swipl-win.dir/main.cpp.o
[ 89%] Building CXX object packages/swipl-win/CMakeFiles/swipl-win.dir/SwiPrologEngine.cpp.o
[ 89%] Building CXX object packages/swipl-win/CMakeFiles/swipl-win.dir/Swipl_IO.cpp.o
[ 89%] Building CXX object packages/swipl-win/CMakeFiles/swipl-win.dir/Preferences.cpp.o
[ 89%] Building CXX object packages/swipl-win/CMakeFiles/swipl-win.dir/pqMainWindow.cpp.o
[ 89%] Building CXX object packages/swipl-win/CMakeFiles/swipl-win.dir/pqConsole.cpp.o
[ 89%] Building CXX object packages/swipl-win/CMakeFiles/swipl-win.dir/FlushOutputEvents.cpp.o
[ 89%] Building CXX object packages/swipl-win/CMakeFiles/swipl-win.dir/ConsoleEdit.cpp.o
[ 89%] Building CXX object packages/swipl-win/CMakeFiles/swipl-win.dir/Completion.cpp.o
[ 89%] Building CXX object packages/swipl-win/CMakeFiles/swipl-win.dir/swipl_win.cpp.o
[ 89%] Building CXX object packages/swipl-win/CMakeFiles/swipl-win.dir/ParenMatching.cpp.o
[ 89%] Building CXX object packages/swipl-win/CMakeFiles/swipl-win.dir/ansi_esc_seq.cpp.o
[ 89%] Building CXX object packages/swipl-win/CMakeFiles/swipl-win.dir/qrc_swipl-win.cpp.o
[ 89%] Building CXX object packages/swipl-win/CMakeFiles/swipl-win.dir/swipl-win_autogen/mocs_compilation.cpp.o
[ 89%] Linking CXX executable swipl-win
/usr/bin/ld: ../../src/libswipl.so.8.3.22: undefined reference to `tgetnum@NCURSES6_TINFO_5.0.19991023'
/usr/bin/ld: ../../src/libswipl.so.8.3.22: undefined reference to `tputs@NCURSES6_TINFO_5.0.19991023'
/usr/bin/ld: ../../src/libswipl.so.8.3.22: undefined reference to `tgoto@NCURSES6_TINFO_5.0.19991023'
/usr/bin/ld: ../../src/libswipl.so.8.3.22: undefined reference to `tgetent@NCURSES6_TINFO_5.0.19991023'
/usr/bin/ld: ../../src/libswipl.so.8.3.22: undefined reference to `tgetstr@NCURSES6_TINFO_5.0.19991023'
/usr/bin/ld: ../../src/libswipl.so.8.3.22: undefined reference to `tgetflag@NCURSES6_TINFO_5.0.19991023'
collect2: error: ld returned 1 exit status
make[2]: *** [packages/swipl-win/CMakeFiles/swipl-win.dir/build.make:288: packages/swipl-win/swipl-win] Error 1
make[1]: *** [CMakeFiles/Makefile2:12247: packages/swipl-win/CMakeFiles/swipl-win.dir/all] Error 2
make: *** [Makefile:163: all] Error 2

I have played around with the environment but have no idea how to fix it. Appreciated if anyone would love to offer help. Thanks very much!

haohaiziround avatar Apr 27 '21 03:04 haohaiziround

Doesn't really ring a bell. I'm using Ubuntu 20.04 as core dev machine. It is also pretty weird to me why it complains about undefined symbols against libswipl.so.8.3.22 while linking swipl-win. According to ldd and nm, libswipl.so loads libtinfo.so.6 which defines tgetnum (and I guess the others as well).

Did it build src/swipl? Does that work? You could try make -k to see whether swipl-win is the only failure. AFAIK nothing else depends on swipl-win and thus you might end up with an almost complete system.

JanWielemaker avatar Apr 28 '21 16:04 JanWielemaker

I get exactly the same error on MX-Linux . I guess that swipl-win is useless in a Linux system, but it prevents sometimes compilation. It would be nice to be able to drop it..

joseph-vidal-rosset avatar Dec 26 '21 14:12 joseph-vidal-rosset

Getting the same error too on a Ubuntu system. I "fixed" this by removing every line mentioning swipl-win in build/cmake_install.cmake and build/CMakeFiles/MakeFile2.

HEmile avatar Jan 28 '22 14:01 HEmile

Hello @JanWielemaker , I am wondering if any progress has been made on this issue, I am also unable to build the system correctly on ubuntu 20.04 with the same set of errors as above, but with what seems a much more recent version of SWI (the current 8.5.8 dev version). I ran it with make -k and it did indeed build the swipl executable in src/swipl. I ran check_installation/0 with the resulting executable and it seems to be in a correct state. But I am worried that this may be an unstable version were I try to use it. Are there any ways to avoid these issues? running the test suite reveals a segfault in java_in_prolog

ccr185 avatar Mar 18 '22 17:03 ccr185

I have no clue. If all is right, libswipl.so is linked to libtinfo or some other implementation of ncurses which provides these functions. Why this shows up when linking swipl-win I have no idea. Most likely candidate issues are with the library providing these functions or Qt. Some search using ldd and nm may reveal what is wrong.

As for the stability, linker issues should generally not affect these. the java_in_prolog issue appears with specific versions of Java with specific versions of Linux due to a change in stack security policies in Linux that is violated by specific Java VMs. As long as you do not need to embed Java in Prolog there is no reason to worry.

A simpler way to build without swipl-win is by passing -DSWIPL_PACKAGES_QT=OFF to cmake. That should also tell you whether this is the only failure.

JanWielemaker avatar Mar 20 '22 10:03 JanWielemaker

Thanks @JanWielemaker for your prompt reply. It seems to be the case that this swipl-win issue is indeed the only failure in the build process, as using the -DSWIPL_PACKAGES_QT=OFF flag allows the build process to complete with no errors. For now I will try to make use of this version, which my very cursory tests seem to indicate is working fine with nothing important missing.

ccr185 avatar Mar 20 '22 23:03 ccr185