Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fails due to _FORTIFY_SOURCE requires compiling with optimization (-O) #71

Open
salimp2009 opened this issue Oct 16, 2023 · 2 comments

Comments

@salimp2009
Copy link

Hi
Thank you for this template. I am a fan. Have all the books :)

I tried to build this as is on Linux Arch.
Configuration was OK but build failed due to a required optimization as mentioned in the error below. I tough this might be helpfull to have a look at it.

Salim

/catch_matchers_quantifiers.cpp:8:
/usr/include/features.h:414:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp]
  414 | #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
      |    ^~~~~~~
[114/196] Building CXX object _deps/ftxui-build/CMakeFiles/screen.dir/Debug/src/ftxui/screen/color.cpp.o
FAILED: _deps/ftxui-build/CMakeFiles/screen.dir/Debug/src/ftxui/screen/color.cpp.o 
/usr/bin/c++ -DCMAKE_INTDIR=\"Debug\" -I/home/salim/.cache/CPM/ftxui/56a5c8369b2a8eeef461d171119057c3d5ffb926/src -I/home/salim/.cache/CPM/ftxui/56a5c8369b2a8eeef461d171119057c3d5ffb926/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -fcf-protection -fstack-clash-protection  -D_GLIBCXX_ASSERTIONS -g -std=c++20 -flto=auto -fno-fat-lto-objects -Wall -Werror -Wextra -Wcast-align -Wdeprecated -Wmissing-declarations -Wnon-virtual-dtor -Wnull-dereference -Woverloaded-virtual -Wpedantic -Wshadow -Wunused -MD -MT _deps/ftxui-build/CMakeFiles/screen.dir/Debug/src/ftxui/screen/color.cpp.o -MF _deps/ftxui-build/CMakeFiles/screen.dir/Debug/src/ftxui/screen/color.cpp.o.d -o _deps/ftxui-build/CMakeFiles/screen.dir/Debug/src/ftxui/screen/color.cpp.o -c /home/salim/.cache/CPM/ftxui/56a5c8369b2a8eeef461d171119057c3d5ffb926/src/ftxui/screen/color.cpp
In file included from /usr/include/c++/13.2.1/x86_64-pc-linux-gnu/bits/os_defines.h:39,
                 from /usr/include/c++/13.2.1/x86_64-pc-linux-gnu/bits/c++config.h:679,
                 from /usr/include/c++/13.2.1/cstdint:38,
                 from /home/salim/.cache/CPM/ftxui/56a5c8369b2a8eeef461d171119057c3d5ffb926/include/ftxui/screen/color.hpp:4,
@salimp2009
Copy link
Author

I added -O optimization as it was the first error to hardening.cmake like this

  elseif(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang|GNU")
    set(NEW_CXX_DEFINITIONS "${NEW_CXX_DEFINITIONS} -D_GLIBCXX_ASSERTIONS -O")
    message(STATUS "*** GLIBC++ Assertions (vector[], string[], ...) enabled")

then tried again this time first error is gone but somehow fxtui is giving error for missing std header files.

FAILED: _deps/ftxui-build/CMakeFiles/screen.dir/Debug/src/ftxui/screen/string.cpp.o 
/usr/bin/c++ -DCMAKE_INTDIR=\"Debug\" -I/home/salim/.cache/CPM/ftxui/56a5c8369b2a8eeef461d171119057c3d5ffb926/
src -I/home/salim/.cache/CPM/ftxui/56a5c8369b2a8eeef461d171119057c3d5ffb926/include -U_FORTIFY_SOURCE -D_FORTI
FY_SOURCE=3 -fstack-protector-strong -fcf-protection -fstack-clash-protection  -D_GLIBCXX_ASSERTIONS -O -g -st
d=c++20 -flto=auto -fno-fat-lto-objects -Wall -Werror -Wextra -Wcast-align -Wdeprecated -Wmissing-declarations
 -Wnon-virtual-dtor -Wnull-dereference -Woverloaded-virtual -Wpedantic -Wshadow -Wunused -MD -MT _deps/ftxui-b
uild/CMakeFiles/screen.dir/Debug/src/ftxui/screen/string.cpp.o -MF _deps/ftxui-build/CMakeFiles/screen.dir/Deb
ug/src/ftxui/screen/string.cpp.o.d -o _deps/ftxui-build/CMakeFiles/screen.dir/Debug/src/ftxui/screen/string.cp
p.o -c /home/salim/.cache/CPM/ftxui/56a5c8369b2a8eeef461d171119057c3d5ffb926/src/ftxui/screen/string.cpp
In file included from /home/salim/.cache/CPM/ftxui/56a5c8369b2a8eeef461d171119057c3d5ffb926/src/ftxui/screen/s
tring.cpp:8:
/home/salim/.cache/CPM/ftxui/56a5c8369b2a8eeef461d171119057c3d5ffb926/include/ftxui/screen/string.hpp:51:48: e
rror: ‘uint32_t’ was not declared in this scope
   51 | WordBreakProperty CodepointToWordBreakProperty(uint32_t codepoint);
      |                                                ^~~~~~~~
/home/salim/.cache/CPM/ftxui/56a5c8369b2a8eeef461d171
e: ‘uint32_t’ is defined in header ‘<cstdint>’; did y
    6 | #include <vector>    // for vector
  +++ |+#include <cstdint>
    7 | 
/home/salim/.cache/CPM/ftxui/56a5c8369b2a8eeef461d171
 ‘bool {anonymous}::IsCombining(uint32_t)’:
/home/salim/.cache/CPM/ftxui/56a5c8369b2a8eeef461d171
or: ‘ftxui::CodepointToWordBreakProperty’ cannot be u
 1415 |   return ftxui::CodepointToWordBreakProperty(
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
/home/salim/.cache/CPM/ftxui/56a5c8369b2a8eeef461d171
cope:
/home/salim/.cache/CPM/ftxui/56a5c8369b2a8eeef461d171
or: ‘ftxui::WordBreakProperty ftxui::CodepointToWordB
ntity
 1570 | WordBreakProperty CodepointToWordBreakPropert
      |                                              
/home/salim/.cache/CPM/ftxui/56a5c8369b2a8eeef461d171
ote: previous declaration ‘ftxui::WordBreakProperty f
   51 | WordBreakProperty CodepointToWordBreakPropert
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
[125/196] Building CXX object _deps/ftxui-build/CMake
ninja: build stopped: subcommand failed.

@salimp2009
Copy link
Author

AS far as I understood the fxtui issue is an fxtui issues which is build and but probably not in the release used here. So I would suggest maybe to use the master branch here but still the previous error requires -O optimization to hardening but then it how will it be used for optimized build ? I tried Debug build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant