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

Can't build from source with gcc-10 (Version: 1.12.0) #4693

Closed
nmiceli-simtlix opened this issue Sep 7, 2023 · 6 comments · Fixed by #4700
Closed

Can't build from source with gcc-10 (Version: 1.12.0) #4693

nmiceli-simtlix opened this issue Sep 7, 2023 · 6 comments · Fixed by #4700
Assignees

Comments

@nmiceli-simtlix
Copy link

Issue Description

Can't build with latest release

Steps to Reproduce

git clone https://github.com/xrplf/rippled
git checkout 89780c8e4fd4d140fcb912cf2d0c01c1b260539e
conan export external/snappy snappy/1.1.10@
conan export external/soci soci/4.0.3@
mkdir .build && cd .build
conan install .. --output-folder . --build missing --settings build_type=Release
cmake -DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release ..
cmake --build . -- --quiet

Expected Result

a built rippled binary

Actual Result

#13 441.1 [ 10%] Building CXX object CMakeFiles/xrpl_core.dir/src/ripple/protocol/impl/SField.cpp.o
#13 442.0 [ 10%] Building CXX object CMakeFiles/xrpl_core.dir/src/ripple/protocol/impl/SOTemplate.cpp.o
#13 443.0 [ 10%] Building CXX object CMakeFiles/xrpl_core.dir/src/ripple/protocol/impl/STAccount.cpp.o
#13 445.7 [ 10%] Building CXX object CMakeFiles/xrpl_core.dir/src/ripple/protocol/impl/STAmount.cpp.o
#13 449.2 /build/ripple/binary/src/ripple/protocol/impl/STAmount.cpp: In lambda function:
#13 449.2 /build/ripple/binary/src/ripple/protocol/impl/STAmount.cpp:1577:15: error: expected nested-name-specifier before 'enum'
#13 449.2  1577 |         using enum Number::rounding_mode;
#13 449.2       |               ^~~~
#13 449.2 /build/ripple/binary/src/ripple/protocol/impl/STAmount.cpp:1579:40: error: 'upward' was not declared in this scope
#13 449.2  1579 |             roundUp ^ resultNegative ? upward : downward);
#13 449.2       |                                        ^~~~~~
#13 449.2 /build/ripple/binary/src/ripple/protocol/impl/STAmount.cpp:1579:49: error: 'downward' was not declared in this scope
#13 449.2  1579 |             roundUp ^ resultNegative ? upward : downward);
#13 449.2       |                                                 ^~~~~~~~
#13 449.3 /build/ripple/binary/src/ripple/protocol/impl/STAmount.cpp: In instantiation of 'ripple::STAmount ripple::divRoundImpl(const ripple::STAmount&, const ripple::STAmount&, const ripple::Issue&, bool) [with MightSaveRound = ripple::{anonymous}::DontAffectNumberRoundMode]':
#13 449.3 /build/ripple/binary/src/ripple/protocol/impl/STAmount.cpp:1609:76:   required from here
#13 449.3 /build/ripple/binary/src/ripple/protocol/impl/STAmount.cpp:1578:30: warning: unused variable 'savedRound' [-Wunused-variable]
#13 449.3  1578 |         MightSaveRound const savedRound(
#13 449.3       |                              ^~~~~~~~~~
#13 450.1 make[2]: *** [CMakeFiles/xrpl_core.dir/build.make:863: CMakeFiles/xrpl_core.dir/src/ripple/protocol/impl/STAmount.cpp.o] Error 1
#13 450.1 make[1]: *** [CMakeFiles/Makefile2:120: CMakeFiles/xrpl_core.dir/all] Error 2
#13 450.1 make: *** [Makefile:130: all] Error 2

Environment

Ubuntu 20.04
CONAN_RELEASE_VERSION=1.59.0

@ckeshava
Copy link
Collaborator

Hello, thanks for bringing this issue to our attention.

Can you confirm that you adhere to the minimum compiler versions as listed here:
image

This issue has been observed with older versions of cpp compilers, because they don't allow for enum classes.

@nmiceli-simtlix
Copy link
Author

nmiceli-simtlix commented Sep 11, 2023

I believe I do. I had no problems when compiling previous versions.

python3.8                              3.8.10-0ubuntu1~20.04.8
cmake                                  3.16.3-1ubuntu1.20.04.1
cpp-10                                 10.5.0-1ubuntu1~20.04
g++-10                                 10.5.0-1ubuntu1~20.04
gcc-10                                 10.5.0-1ubuntu1~20.04
conan                                  1.59.0

Should I try something different with any of these?

@legleux
Copy link
Collaborator

legleux commented Sep 11, 2023

I believe our minimum requirements should be updated to require GCC 11 for using enum.
https://gcc.gnu.org/projects/cxx-status.html

@nmiceli-simtlix
Copy link
Author

Yes. That was the problem.
Updating cpp, g++ and gcc to v11 fixed my issue.
Those requirements should be updated.
Thanks!

@ckeshava
Copy link
Collaborator

thnks for the insight @legleux I have opened a PR to fix this discrepancy 👍

@intelliot intelliot changed the title [Can't build from source] (Version: [1.12.0]) Can't build from source with gcc-10 (Version: 1.12.0) Oct 2, 2023
@intelliot
Copy link
Collaborator

Looks like using enum was first introduced with 724a301 (Jun 22, 2023)

intelliot pushed a commit that referenced this issue Oct 2, 2023
Update minimum compiler requirement for building the codebase. The
feature "using enum" is required. This feature was introduced in C++20.

Updating the C++ compiler to version 11 or later fixes this error:

```
Building CXX object CMakeFiles/xrpl_core.dir/src/ripple/protocol/impl/STAmount.cpp.o
/build/ripple/binary/src/ripple/protocol/impl/STAmount.cpp: In lambda function:
/build/ripple/binary/src/ripple/protocol/impl/STAmount.cpp:1577:15: error: expected nested-name-specifier before 'enum'
 1577 |         using enum Number::rounding_mode;
      |               ^~~~
```

Fix #4693
sophiax851 pushed a commit to sophiax851/rippled that referenced this issue Jun 12, 2024
Update minimum compiler requirement for building the codebase. The
feature "using enum" is required. This feature was introduced in C++20.

Updating the C++ compiler to version 11 or later fixes this error:

```
Building CXX object CMakeFiles/xrpl_core.dir/src/ripple/protocol/impl/STAmount.cpp.o
/build/ripple/binary/src/ripple/protocol/impl/STAmount.cpp: In lambda function:
/build/ripple/binary/src/ripple/protocol/impl/STAmount.cpp:1577:15: error: expected nested-name-specifier before 'enum'
 1577 |         using enum Number::rounding_mode;
      |               ^~~~
```

Fix XRPLF#4693
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

Successfully merging a pull request may close this issue.

4 participants