stefanhaustein / TerminalImageViewer

Small C++ program to display images in a (modern) terminal using RGB ANSI codes and unicode block graphics characters
Other
1.56k stars 111 forks source link

Build fails on Ubuntu 16.04 #87

Closed Roman- closed 3 years ago

Roman- commented 3 years ago

screenshot

$cd /tmp                                                                                                                            tmp$git clone https://github.com/stefanhaustein/TerminalImageViewer.git                                                                Cloning into 'TerminalImageViewer'...                                                                                                  ;remote: Enumerating objects: 9, done.                                                                                                 
remote: Counting objects: 100% (9/9), done.                        
remote: Compressing objects: 100% (9/9), done.                     
remote: Total 669 (delta 3), reused 0 (delta 0), pack-reused 660   
Receiving objects: 100% (669/669), 723.34 KiB | 762.00 KiB/s, done.
Resolving deltas: 100% (265/265), done.
Checking connectivity... done.
tmp$cd TerminalImageViewer/
TerminalImageViewer$..
tmp$cd TerminalImageViewer/src/main/cpp
cpp$make
g++ -O2 -fpermissive -std=c++17 -Wall -fexceptions   -c -o tiv.o tiv.cpp
tiv.cpp:197:34: error: array must be initialized with a brace-enclosed initializer
   std::array<int, 3> fgColor = {0};
                                  ^                                
tiv.cpp:198:34: error: array must be initialized with a brace-enclosed initializer
   std::array<int, 3> bgColor = {0};
                                  ^                                
tiv.cpp: In function ‘CharData findCharData(const cimg_library::CImg<unsigned char>&, int, int, int)’:
tiv.cpp:330:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i = 0; BITMAPS[i + 1] != end_marker; i += 2) {
                                  ^                                
<builtin>: recipe for target 'tiv.o' failed
make: *** [tiv.o] Error 1

gcc version:

$g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.12' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.12)
aaronliu0130 commented 3 years ago

std::array<int, 3> fgColor = {0};

@stefanhaustein I'm sure the initializer {0}​ is the catalyst here. Perhaps change it to {0,0,0}​? Edit: This should have been solved with #79 . What overwrote it? 2e91d92 ?


From: Roman Strakhov notifications@github.com Sent: Monday, October 19, 2020 9:21 AM To: stefanhaustein/TerminalImageViewer TerminalImageViewer@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: [stefanhaustein/TerminalImageViewer] Build fails on Ubuntu 16.04 (#87)

[screenshot]https://camo.githubusercontent.com/8e65803afe7ac97730433d4254e048981026f372/68747470733a2f2f73756e392d33352e757365726170692e636f6d2f4541787645774537786a7579385f44636a7179784a614230486d306a473339305661524b33512f475032735245433753484d2e6a7067

$cd /tmp tmp$git clone https://github.com/stefanhaustein/TerminalImageViewer.git Cloning into 'TerminalImageViewer'... ;remote: Enumerating objects: 9, done.

remote: Counting objects: 100% (9/9), done.

remote: Compressing objects: 100% (9/9), done.

remote: Total 669 (delta 3), reused 0 (delta 0), pack-reused 660

Receiving objects: 100% (669/669), 723.34 KiB | 762.00 KiB/s, done.

Resolving deltas: 100% (265/265), done.

Checking connectivity... done.

tmp$cd TerminalImageViewer/

TerminalImageViewer$..

tmp$cd TerminalImageViewer/src/main/cpp

cpp$make

g++ -O2 -fpermissive -std=c++17 -Wall -fexceptions -c -o tiv.o tiv.cpp

tiv.cpp:197:34: error: array must be initialized with a brace-enclosed initializer

std::array<int, 3> fgColor = {0};

                              ^

tiv.cpp:198:34: error: array must be initialized with a brace-enclosed initializer

std::array<int, 3> bgColor = {0};

                              ^

tiv.cpp: In function ‘CharData findCharData(const cimg_library::CImg&, int, int, int)’:

tiv.cpp:330:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

for (int i = 0; BITMAPS[i + 1] != end_marker; i += 2) {

                              ^
: recipe for target 'tiv.o' failed make: *** [tiv.o] Error 1 gcc version: $g++ -v Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.12' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.12) — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.
stefanhaustein commented 3 years ago

Thanks for the pointer Aaron -- I am not sure what went wrong with the fix / PR. I have just replicated the change to address this.

stefanhaustein commented 3 years ago

p.s. Roman, can you confirm this is fixed now for Ubuntu 16.04 (I am using Manjaro...)

Roman- commented 3 years ago

p.s. Roman, can you confirm this is fixed now for Ubuntu 16.04 (I am using Manjaro...)

It builds successfully and works fine!

stefanhaustein commented 3 years ago

Thanks!