evpo / EncryptPad

Minimalist secure text editor and binary encryptor that implements RFC 4880 Open PGP format: symmetrically encrypted, compressed and integrity protected. The editor can protect files with passwords, key files or both.
https://evpo.net/encryptpad
Other
437 stars 63 forks source link

Encryptpad not compiling on arch linux because of <limits> not included #104

Closed barci2 closed 3 years ago

barci2 commented 3 years ago

Make command output:


g++  -fstack-protector -m64 -pthread -std=c++11 -D_REENTRANT -O3 -momit-leaf-frame-pointer -D_FILE_OFFSET_BITS=64 -Wall -Wextra -Wpedantic -Wstrict-aliasing -Wcast-align -Wmissing-declarations -Wpointer-arith -Wcast-qual -Wzero-as-null-pointer-constant -Wnon-virtual-dtor  -I/usr/include/botan-2  -Ibuild/include -I/home/barcisz/Downloads/encryptpad/deps/libencryptmsg/build/include -I/home/barcisz/Downloads/encryptpad/build/include/internal -isystem /home/barcisz/Downloads/encryptpad/deps/stlplus/containers -isystem /home/barcisz/Downloads/encryptpad/deps/plog/include -c src/back_end_src/decryption_state_machine.cpp -o build/obj/lib/back_end_src_decryption_state_machine.o
In file included from src/back_end_src/packet_stream.h:28,
                 from src/back_end_src/decryption_state_machine.h:3,
                 from src/back_end_src/decryption_state_machine.cpp:1:
src/back_end_src/decryption_state_machine.cpp: In member function ‘void EncryptPad::DecryptionStateMachine::ReadIn_OnEnter(LightStateMachine::StateMachineContext&)’:
src/back_end_src/decryption_state_machine.cpp:191:48: error: ‘numeric_limits’ is not a member of ‘std’
  191 |                     static_cast<uint64_t>(std::numeric_limits<stream_length_type>::max()),
      |                                                ^~~~~~~~~~~~~~
src/back_end_src/decryption_state_machine.cpp:191:81: error: expected primary-expression before ‘>’ token
  191 |                     static_cast<uint64_t>(std::numeric_limits<stream_length_type>::max()),
      |                                                                                 ^
src/back_end_src/decryption_state_machine.cpp:191:84: error: ‘::max’ has not been declared; did you mean ‘std::max’?
  191 |                     static_cast<uint64_t>(std::numeric_limits<stream_length_type>::max()),
      |                                                                                    ^~~
In file included from /usr/include/c++/11.1.0/algorithm:62,
                 from /usr/include/botan-2/botan/secmem.h:14,
                 from /usr/include/botan-2/botan/symkey.h:11,
                 from /home/barcisz/Downloads/encryptpad/deps/libencryptmsg/build/include/encryptmsg/emsg_types.h:9,
                 from src/back_end_src/decryption_state_machine.h:2,
                 from src/back_end_src/decryption_state_machine.cpp:1:
/usr/include/c++/11.1.0/bits/stl_algo.h:3467:5: note: ‘std::max’ declared here
 3467 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
In file included from src/back_end_src/packet_stream.h:28,
                 from src/back_end_src/decryption_state_machine.h:3,
                 from src/back_end_src/decryption_state_machine.cpp:1:
src/back_end_src/decryption_state_machine.cpp:192:48: error: ‘numeric_limits’ is not a member of ‘std’
  192 |                     static_cast<uint64_t>(std::numeric_limits<size_t>::max())
      |                                                ^~~~~~~~~~~~~~
src/back_end_src/decryption_state_machine.cpp:192:69: error: expected primary-expression before ‘>’ token
  192 |                     static_cast<uint64_t>(std::numeric_limits<size_t>::max())
      |                                                                     ^
src/back_end_src/decryption_state_machine.cpp:192:72: error: ‘::max’ has not been declared; did you mean ‘std::max’?
  192 |                     static_cast<uint64_t>(std::numeric_limits<size_t>::max())
      |                                                                        ^~~
In file included from /usr/include/c++/11.1.0/algorithm:62,
                 from /usr/include/botan-2/botan/secmem.h:14,
                 from /usr/include/botan-2/botan/symkey.h:11,
                 from /home/barcisz/Downloads/encryptpad/deps/libencryptmsg/build/include/encryptmsg/emsg_types.h:9,
                 from src/back_end_src/decryption_state_machine.h:2,
                 from src/back_end_src/decryption_state_machine.cpp:1:
/usr/include/c++/11.1.0/bits/stl_algo.h:3467:5: note: ‘std::max’ declared here
 3467 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
make: *** [Makefile:232: build/obj/lib/back_end_src_decryption_state_machine.o] Error 1```

quick fix:
add -include limits behind CXX flags

proper fix:
include limits everywhere where numeric_limits is used
evpo commented 3 years ago

Hi @barci2 ,

Thanks for finding this. I updated my arch and this problem came up. Then I realised that the limits header was missing and compiled before somehow. I checked in a fix.