st3w / neo

Simulates the digital rain from "The Matrix" (CMatrix clone with 32-bit color and Unicode support)
Other
667 stars 25 forks source link

Compilation fails both with gcc++ and clang on Gentoo Linux #9

Closed byeCl0ud closed 2 years ago

byeCl0ud commented 2 years ago

I tried to compile neo from source according to instructions both in Readme and from docs/install. Building fails with similar errors, both when using git clone and from release page source (both from source code and official release tarball). I'm using latest (in gentoo it is "testing") version of both ncurses (6.3) and autoconf (2.71). I've tried it on two machines with the same result, both running gentoo, the other is using stable version of ncurses (6.2). Also tried using build directory and compiling there, again no luck for me.

This is terminal output when compiling with gcc++:

kenny2@Dell-gentoo ~/neo/neo-0.6 $ ./autogen.sh 
configure.ac:4: installing 'build-aux/install-sh'
configure.ac:4: installing 'build-aux/missing'
src/Makefile.am: installing 'build-aux/depcomp'
kenny2@Dell-gentoo ~/neo/neo-0.6 $ ./configure 
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C++... yes
checking whether g++ accepts -g... yes
checking for g++ option to enable C++11 features... none needed
checking whether make supports the include directive... yes (GNU style)
checking dependency style of g++... gcc3
checking whether make sets $(MAKE)... (cached) yes
checking for initscr in -lncursesw... yes
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for getopt.h... yes
checking for locale.h... yes
checking for ncurses.h... yes
checking whether g++ supports C++11 features with -std=c++11... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating doc/Makefile
config.status: creating src/Makefile
config.status: executing depfiles commands
kenny2@Dell-gentoo ~/neo/neo-0.6 $ make
Making all in doc
make[1]: Entering directory '/home/kenny2/neo/neo-0.6/doc'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/kenny2/neo/neo-0.6/doc'
Making all in src
make[1]: Entering directory '/home/kenny2/neo/neo-0.6/src'
g++ -std=c++11 -DPACKAGE_NAME=\"neo\" -DPACKAGE_TARNAME=\"neo\" -DPACKAGE_VERSION=\"0.6\" -DPACKAGE_STRING=\"neo\ 0.6\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"neo\" -DVERSION=\"0.6\" -DHAVE_LIBNCURSESW=1 -DHAVE_STDIO_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_STRINGS_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_UNISTD_H=1 -DSTDC_HEADERS=1 -DHAVE_GETOPT_H=1 -DHAVE_LOCALE_H=1 -DHAVE_NCURSES_H=1 -DHAVE_CXX11=1 -I.    -DNCURSES_WIDECHAR -std=c++11 -g -O2 -MT cloud.o -MD -MP -MF .deps/cloud.Tpo -c -o cloud.o cloud.cpp
cloud.cpp: In member function ‘void Cloud::CalcMessage()’:
cloud.cpp:852:9: error: ‘mvinnwstr’ was not declared in this scope; did you mean ‘mvinnstr’?
  852 |         mvinnwstr(msgChar.line, msgChar.col, wc, 1);
      |         ^~~~~~~~~
      |         mvinnstr
cloud.cpp: In member function ‘void Cloud::DrawMessage() const’:
cloud.cpp:870:9: error: ‘mvadd_wch’ was not declared in this scope; did you mean ‘mvaddch’?
  870 |         mvadd_wch(msgChar.line, msgChar.col, &wc);
      |         ^~~~~~~~~
      |         mvaddch
make[1]: *** [Makefile:374: cloud.o] Error 1
make[1]: Leaving directory '/home/kenny2/neo/neo-0.6/src'
make: *** [Makefile:336: all-recursive] Error 1

and this is result when compiling with clang:

kenny2@Dell-gentoo ~/neo/neo-0.6 $ ./autogen.sh 
configure.ac:4: installing 'build-aux/install-sh'
configure.ac:4: installing 'build-aux/missing'
src/Makefile.am: installing 'build-aux/depcomp'
kenny2@Dell-gentoo ~/neo/neo-0.6 $ ./configure CXXFLAGS="-Os -march=native -mtune=native -DNDEBUG -fno-exceptions -ffunction-sections -fdata-sections -flto" LDFLAGS="-Wl,--gc-sections -flto" CXX="clang++"
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C++... yes
checking whether clang++ accepts -g... yes
checking for clang++ option to enable C++11 features... none needed
checking whether make supports the include directive... yes (GNU style)
checking dependency style of clang++... gcc3
checking whether make sets $(MAKE)... (cached) yes
checking for initscr in -lncursesw... yes
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for getopt.h... yes
checking for locale.h... yes
checking for ncurses.h... yes
checking whether clang++ supports C++11 features with -std=c++11... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating doc/Makefile
config.status: creating src/Makefile
config.status: executing depfiles commands
kenny2@Dell-gentoo ~/neo/neo-0.6 $ make
Making all in doc
make[1]: Entering directory '/home/kenny2/neo/neo-0.6/doc'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/kenny2/neo/neo-0.6/doc'
Making all in src
make[1]: Entering directory '/home/kenny2/neo/neo-0.6/src'
clang++ -std=c++11 -DPACKAGE_NAME=\"neo\" -DPACKAGE_TARNAME=\"neo\" -DPACKAGE_VERSION=\"0.6\" -DPACKAGE_STRING=\"neo\ 0.6\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"neo\" -DVERSION=\"0.6\" -DHAVE_LIBNCURSESW=1 -DHAVE_STDIO_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_STRINGS_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_UNISTD_H=1 -DSTDC_HEADERS=1 -DHAVE_GETOPT_H=1 -DHAVE_LOCALE_H=1 -DHAVE_NCURSES_H=1 -DHAVE_CXX11=1 -I.    -DNCURSES_WIDECHAR -std=c++11 -Os -march=native -mtune=native -DNDEBUG -fno-exceptions -ffunction-sections -fdata-sections -flto -MT cloud.o -MD -MP -MF .deps/cloud.Tpo -c -o cloud.o cloud.cpp
cloud.cpp:852:9: error: use of undeclared identifier 'mvinnwstr'; did you mean 'mvinnstr'?
        mvinnwstr(msgChar.line, msgChar.col, wc, 1);
        ^~~~~~~~~
        mvinnstr
/usr/include/curses.h:707:28: note: 'mvinnstr' declared here
extern NCURSES_EXPORT(int) mvinnstr (int, int, char *, int);            /* generated */
                           ^
cloud.cpp:852:46: error: cannot initialize a parameter of type 'char *' with an lvalue of type 'wchar_t [2]'
        mvinnwstr(msgChar.line, msgChar.col, wc, 1);
                                             ^~
/usr/include/curses.h:707:54: note: passing argument to parameter here
extern NCURSES_EXPORT(int) mvinnstr (int, int, char *, int);            /* generated */
                                                     ^
cloud.cpp:870:9: error: use of undeclared identifier 'mvadd_wch'; did you mean 'mvaddch'?
        mvadd_wch(msgChar.line, msgChar.col, &wc);
        ^~~~~~~~~
        mvaddch
/usr/include/curses.h:691:28: note: 'mvaddch' declared here
extern NCURSES_EXPORT(int) mvaddch (int, int, const chtype);            /* generated */
                           ^
cloud.cpp:870:46: error: cannot initialize a parameter of type 'chtype' (aka 'unsigned int') with an rvalue of type 'cchar_t *'
        mvadd_wch(msgChar.line, msgChar.col, &wc);
                                             ^~~
/usr/include/curses.h:691:59: note: passing argument to parameter here
extern NCURSES_EXPORT(int) mvaddch (int, int, const chtype);            /* generated */
                                                          ^
4 errors generated.
make[1]: *** [Makefile:374: cloud.o] Error 1
make[1]: Leaving directory '/home/kenny2/neo/neo-0.6/src'
make: *** [Makefile:336: all-recursive] Error 1

EDIT: fixed formatting and added info on my second gentoo machine

st3w commented 2 years ago

It's trying to link against ncurses rather than ncursesw. ncursesw is just ncurses with widechar (Unicode) support.

I'm not sure why it's linking against ncursesw though.

In "src/Makefile.am", line 5 is supposed to make it link against ncursesw:

LDADD = -lncursesw

You could try adding "-lncursesw" to CXXFLAGS and/or LDFLAGS variables in the "./configure" command line. That will probably fix it assuming you have ncursesw installed somewhere.

Edit: this might also have to do with your system include paths. If you have ncursesw installed (should come with libncurses-dev package), then your copy of "ncurses.h" should have the functions that the compiler is failing to find.

byeCl0ud commented 2 years ago

Ok so I played with it a little and now it starts compiling but end up on this error:

Making all in doc
make[1]: Entering directory '/home/svante/neo/neo/doc'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/svante/neo/neo/doc'
Making all in src
make[1]: Entering directory '/home/svante/neo/neo/src'
g++ -std=c++11 -DPACKAGE_NAME=\"neo\" -DPACKAGE_TARNAME=\"neo\" -DPACKAGE_VERSION=\"0.6\" -DPACKAGE_STRING=\"neo\ 0.6\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"neo\" -DVERSION=\"0.6\" -DHAVE_LIBNCURSESW=1 -DHAVE_STDIO_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_STRINGS_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_UNISTD_H=1 -DSTDC_HEADERS=1 -DHAVE_GETOPT_H=1 -DHAVE_LOCALE_H=1 -DHAVE_NCURSES_H=1 -DHAVE_CXX11=1 -I.    -DNCURSES_WIDECHAR -std=c++11 -g -O2 -MT cloud.o -MD -MP -MF .deps/cloud.Tpo -c -o cloud.o cloud.cpp
mv -f .deps/cloud.Tpo .deps/cloud.Po
g++ -std=c++11 -DPACKAGE_NAME=\"neo\" -DPACKAGE_TARNAME=\"neo\" -DPACKAGE_VERSION=\"0.6\" -DPACKAGE_STRING=\"neo\ 0.6\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"neo\" -DVERSION=\"0.6\" -DHAVE_LIBNCURSESW=1 -DHAVE_STDIO_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_STRINGS_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_UNISTD_H=1 -DSTDC_HEADERS=1 -DHAVE_GETOPT_H=1 -DHAVE_LOCALE_H=1 -DHAVE_NCURSES_H=1 -DHAVE_CXX11=1 -I.    -DNCURSES_WIDECHAR -std=c++11 -g -O2 -MT droplet.o -MD -MP -MF .deps/droplet.Tpo -c -o droplet.o droplet.cpp
mv -f .deps/droplet.Tpo .deps/droplet.Po
g++ -std=c++11 -DPACKAGE_NAME=\"neo\" -DPACKAGE_TARNAME=\"neo\" -DPACKAGE_VERSION=\"0.6\" -DPACKAGE_STRING=\"neo\ 0.6\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"neo\" -DVERSION=\"0.6\" -DHAVE_LIBNCURSESW=1 -DHAVE_STDIO_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_STRINGS_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_UNISTD_H=1 -DSTDC_HEADERS=1 -DHAVE_GETOPT_H=1 -DHAVE_LOCALE_H=1 -DHAVE_NCURSES_H=1 -DHAVE_CXX11=1 -I.    -DNCURSES_WIDECHAR -std=c++11 -g -O2 -MT neo.o -MD -MP -MF .deps/neo.Tpo -c -o neo.o neo.cpp
mv -f .deps/neo.Tpo .deps/neo.Po
g++ -std=c++11 -DNCURSES_WIDECHAR -std=c++11 -g -O2   -o neo cloud.o droplet.o neo.o -lncursesw -lncursesw 
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: neo.o: undefined reference to symbol 'keypad'
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /lib64/libtinfow.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:355: neo] Error 1
make[1]: Leaving directory '/home/svante/neo/neo/src'
make: *** [Makefile:336: all-recursive] Error 1

I was trying to find some fix and found out that for some people adding this helps: ./configure LIBS=-ltinfo So I tried it and this was the result:

Making all in doc
make[1]: Entering directory '/home/svante/neo/neo/doc'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/svante/neo/neo/doc'
Making all in src
make[1]: Entering directory '/home/svante/neo/neo/src'
g++ -std=c++11 -DPACKAGE_NAME=\"neo\" -DPACKAGE_TARNAME=\"neo\" -DPACKAGE_VERSION=\"0.6\" -DPACKAGE_STRING=\"neo\ 0.6\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"neo\" -DVERSION=\"0.6\" -DHAVE_LIBNCURSESW=1 -DHAVE_STDIO_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_STRINGS_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_UNISTD_H=1 -DSTDC_HEADERS=1 -DHAVE_GETOPT_H=1 -DHAVE_LOCALE_H=1 -DHAVE_NCURSES_H=1 -DHAVE_CXX11=1 -I.    -DNCURSES_WIDECHAR -std=c++11 -g -O2 -MT cloud.o -MD -MP -MF .deps/cloud.Tpo -c -o cloud.o cloud.cpp
mv -f .deps/cloud.Tpo .deps/cloud.Po
g++ -std=c++11 -DPACKAGE_NAME=\"neo\" -DPACKAGE_TARNAME=\"neo\" -DPACKAGE_VERSION=\"0.6\" -DPACKAGE_STRING=\"neo\ 0.6\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"neo\" -DVERSION=\"0.6\" -DHAVE_LIBNCURSESW=1 -DHAVE_STDIO_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_STRINGS_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_UNISTD_H=1 -DSTDC_HEADERS=1 -DHAVE_GETOPT_H=1 -DHAVE_LOCALE_H=1 -DHAVE_NCURSES_H=1 -DHAVE_CXX11=1 -I.    -DNCURSES_WIDECHAR -std=c++11 -g -O2 -MT droplet.o -MD -MP -MF .deps/droplet.Tpo -c -o droplet.o droplet.cpp
mv -f .deps/droplet.Tpo .deps/droplet.Po
g++ -std=c++11 -DPACKAGE_NAME=\"neo\" -DPACKAGE_TARNAME=\"neo\" -DPACKAGE_VERSION=\"0.6\" -DPACKAGE_STRING=\"neo\ 0.6\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"neo\" -DVERSION=\"0.6\" -DHAVE_LIBNCURSESW=1 -DHAVE_STDIO_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_STRINGS_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_UNISTD_H=1 -DSTDC_HEADERS=1 -DHAVE_GETOPT_H=1 -DHAVE_LOCALE_H=1 -DHAVE_NCURSES_H=1 -DHAVE_CXX11=1 -I.    -DNCURSES_WIDECHAR -std=c++11 -g -O2 -MT neo.o -MD -MP -MF .deps/neo.Tpo -c -o neo.o neo.cpp
mv -f .deps/neo.Tpo .deps/neo.Po
g++ -std=c++11 -DNCURSES_WIDECHAR -std=c++11 -g -O2   -o neo cloud.o droplet.o neo.o -lncursesw -lncursesw -ltinfo
make[1]: Leaving directory '/home/svante/neo/neo/src'
make[1]: Entering directory '/home/svante/neo/neo'
make[1]: Nothing to be done for 'all-am'.
make[1]: Leaving directory '/home/svante/neo/neo'

This was promising but after running sudo make install i got Segmentation fault. What else can I try?

st3w commented 2 years ago

Did the plain "make" command succeed after your most recent changes? It should create a "neo" executable file in the directory you built from.

I have no idea why "sudo make install" would segfault. That should just copy the neo executable and man page to the appropriate locations.

byeCl0ud commented 2 years ago

I posted output of plain make in my previous comment. It didn't throw any errors. After that I found neo executable in src directory, however when executing it gave segfault as well.

prykhodev commented 2 years ago

No luck on this one yet? Having same issue on OpenSuse Tumbleweed. Have installed ncurses-devel package. Do i need to install ncursesw or something also?

byeCl0ud commented 2 years ago

I have ncursesw library installed in /usr/include/ncursesw/ncurses.h from the "ncurses" package, as there is no devel package in gentoo. I tried pointing to it in the source code by replacing #include <ncurses.h> by #include <ncursesw/ncurses.h> in relevant source code (cloud.h and neo.cpp). The output is the first one in my previous comment. Then I added LIBS=-ltinfo when running ./configure and then it didn't throw any error, but opening the "neo" executable throw segfault.

I was playing with it for too long and still no luck. I think we I just have to wait for someone smarter to find a solution. For the time being you can try to follow my steps and see if it will bring you somewhere.

st3w commented 2 years ago

I'm guessing you might have to do something similar to what the macOS users have to do where you force the linker and compiler to use the right directories:

export LDFLAGS="-L/opt/homebrew/opt/ncurses/lib"
export CPPFLAGS="-I/opt/homebrew/opt/ncurses/include"

I think you might have manually solved the "include" issue but you might still have to adjust LDFLAGS.

Also, what is the exact message when it segfaults? Does it only say "segmentation fault" or is there more to it? What is the output if you run the ldd command on the neo executable?

I probably have a better chance of reproducing this issue in OpenSUSE. Not going to build Gentoo for the first time just to fix a bug. Also I'll probably end up building it differently.

byeCl0ud commented 2 years ago

I tried pointing the compiler with

export LDFLAGS="-L/usr/include/ncursesw"
export CPPFLAGS="-I/usr/include/ncursesw"

but it didn't do anything. This is how the output looks like on "neo" executable:

svante@nucbox ~/neo/last/neo/build/src $ ls
cloud.o  droplet.o  Makefile  neo  neo.o
svante@nucbox ~/neo/last/neo/build/src $ ./neo
Segmentation fault
svante@nucbox ~/neo/last/neo/build/src $ ldd neo
    linux-vdso.so.1 (0x00007ffcc5389000)
    libncursesw.so.6 => /lib64/libncursesw.so.6 (0x00007fe30245a000)
    libtinfo.so.6 => /lib64/libtinfo.so.6 (0x00007fe30241e000)
    libstdc++.so.6 => /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/libstdc++.so.6 (0x00007fe30220a000)
    libm.so.6 => /lib64/libm.so.6 (0x00007fe3020ca000)
    libgcc_s.so.1 => /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/libgcc_s.so.1 (0x00007fe3020b0000)
    libc.so.6 => /lib64/libc.so.6 (0x00007fe301ef6000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00007fe301eee000)
    libtinfow.so.6 => /lib64/libtinfow.so.6 (0x00007fe301eb2000)
    /lib64/ld-linux-x86-64.so.2 (0x00007fe3024be000)
svante@nucbox ~/neo/last/neo/build/src $ 

EDIT: And this is where my ncurses.h is located on the system:

svante@nucbox ~ $ locate ncurses.h
/usr/include/ncurses.h
/usr/include/ncursest/ncurses.h
/usr/include/ncursestw/ncurses.h
/usr/include/ncursesw/ncurses.h
st3w commented 2 years ago

Looks like my hunch was wrong. Thanks for the reply with the detailed info.

The ldd output seems fine.

I think my only hope is to reproduce the issue and compile neo with debug options and hook up a debugger to it to see why there is a segfault. It feels like some kind of library compatibility issue, but I can't put my finger on it.

prykhodev commented 2 years ago

So been trying to export compiler variables:

export LDFLAGS="-L/usr/include/ncursesw" export CPPFLAGS="-I/usr/include/ncursesw"

And it didn't work in the beginning, but after reconfiguration (./configure) everything compiled without any issues, and man it looks cool, way better than cmatrix.

rbycek commented 2 years ago

I was having the same issue compiling on OpenSUSE 15.3, but setting LDFLAGS per @prykhodev seems to have fixed it.

TechnologyClassroom commented 2 years ago

I had trouble compiling on Trisquel 9 (Ubuntu 18.04), but this thread helped me.

git clone https://github.com/st3w/neo
cd neo
./autogen.sh
export LDFLAGS="-L/usr/include/ncursesw" export CPPFLAGS="-I/usr/include/ncursesw"
 ./configure LIBS=-ltinfo
make -j3
sudo make install
byeCl0ud commented 2 years ago

Interesting, I still wasn't able to fix it. Perhaps it would be interesting what version of gcc and make are you using? Maybe there is a problem with specific version.

st3w commented 2 years ago

Cross-platform builds with ncursesw are a mess...

I found more info such as this GitHub issue. For some systems, people have to add "LIBS=-ltinfo". We already know this. However, some ncurses implementations do not use libtinfo. So I cannot unconditionally add "-ltinfo" - it will break the build for some people. Similar projects have gotten around this by adding "-ltinfo" if it exists. Here's an example from Apple's less implementation:

https://opensource.apple.com/source/less/less-23/less/configure.ac.auto.html

Also, I should probably change:

#include <ncurses.h>

To:

#include <ncursesw/ncurses.h>

Hopefully, these changes will fix the build issues for most users that are having trouble building neo. Unfortunately, I don't think it will solve whatever issue(s) @byeCl0ud is facing.

It might take me a day or two to implement and test this. It's something I really don't want to screw up because it could break the build for lots of people...

Edit: On second thought, I think changing the include directive will break the build for macOS Homebrew. FFFFFFFUUUUUUUUUUUU

st3w commented 2 years ago

I've been reading around and took another look at the ldd output from @byeCl0ud. It's fishy that both libtinfo and libtinfow are being linked. I'm pretty sure it's supposed to be one or the other but not both. This could be the source of the segfault.

@byeCl0ud, please try this. The main difference is setting LIBS to "-ltinfow" instead of "-ltinfo".

make clean
export LDFLAGS="-L/usr/include/ncursesw"
export CPPFLAGS="-I/usr/include/ncursesw"
./configure LIBS=-ltinfow
make
sudo make install
neo

I'm still looking into a proper solution to change configure.ac and Makefile.am.

byeCl0ud commented 2 years ago

I've tried it and this time it got stuck at ./configure like this:

svante@nucbox ~/neo/neo $ ./configure LIBS=-tinfow
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for g++... g++
checking whether the C++ compiler works... no
configure: error: in `/home/svante/neo/neo':
configure: error: C++ compiler cannot create executables
See `config.log' for more details

And here is that log file: config.log

st3w commented 2 years ago

I'm so sorry! That was a stupid typo on my end. It's supposed to be LIBS=-ltinfow with the 'l' in front.

st3w commented 2 years ago

I made a few fixes in commit c7e849a63327166b77e01e6d1683f44e129b3ef7.

That should fix the issues seen by @TechnologyClassroom, @rbycek, and @prykhodev. The LDFLAGS/CPPFLAGS override should no longer be necessary. Also, the configure script should automagically add "LIBS=-ltinfo" or "LIBS=-ltinfow" when necessary. So now the instructions on the README should hopefully just work for these folks without extra shenanigans. You will definitely need to rerun ./autogen.sh and configure. I think a make clean also probably wouldn't hurt either.

I'm not sure if this will resolve the build failure that @byeCl0ud was seeing, but I hope that it will.

TechnologyClassroom commented 2 years ago

@st3w I tried again after the latest commit and compilation instructions in the README now work for me on Trisquel 9 (Ubuntu 18.04).

git clone https://github.com/st3w/neo
cd neo
./autogen.sh
./configure
make -j3
sudo make install
st3w commented 2 years ago

@byeCl0ud, any luck?

byeCl0ud commented 2 years ago

I apologize for not answering for so long, I was celebrating Christmas holiday. After your latest commit I'm able to build&run neo without any modification. Everything is smooth. Just a tip if someone will read this with gentoo machine: if you see squares with numbers in terminal instead of chinese/japanese characters in terminal, emerge media-fonts/opendesktop-fonts and set your locale through eselect locale set en_GB.UTF-8, more info here.