Closed ViNN280801 closed 2 weeks ago
@ViNN280801 Would you mind giving some details on the compiler? I'm a bit surprised by this issue since we're not seeing it anywhere else. I don't understand why a namespaced enum would cause this.
@cgcgcg, of course.
(base) vladislavsemykin@loveit:~$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-linux-gnu/13/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 13.3.0-8' --with-bugurl=file:///usr/share/doc/gcc-13/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-13 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-libstdcxx-backtrace --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/reproducible-path/gcc-13-13.3.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/reproducible-path/gcc-13-13.3.0/debian/tmp-gcn/usr --enable-offload-defaulted --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=3
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.3.0 (Debian 13.3.0-8)
(base) vladislavsemykin@loveit:~$ gcc --version
gcc (Debian 13.3.0-8) 13.3.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
(base) vladislavsemykin@loveit:~$ nvcc_wrapper --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2024 NVIDIA Corporation
Built on Wed_Aug_14_10:10:22_PDT_2024
Cuda compilation tools, release 12.6, V12.6.68
Build cuda_12.6.r12.6/compiler.34714021_0
I'm building on C++17 (CUDA and C++ std)
Great. Would you mind checking if the issue is purely a GCC problem by disabling Cuda?
@cgcgcg
(base) vladislavsemykin@loveit:~$ cd Documents/Work/
(base) vladislavsemykin@loveit:~/Documents/Work$ cd Trilinos_16.0_builded_without_CUDA/
(base) vladislavsemykin@loveit:~/Documents/Work/Trilinos_16.0_builded_without_CUDA$ cd build
(base) vladislavsemykin@loveit:~/Documents/Work/Trilinos_16.0_builded_without_CUDA/build$ sudo make -j20 install
[sudo] password for vladislavsemykin:
[ 0%] Building CXX object packages/shards/src/CMakeFiles/shards.dir/Shards_Array.cpp.o
[ 0%] Building CXX object packages/shards/src/CMakeFiles/shards.dir/Shards_CellTopologyManagedData.cpp.o
[ 0%] Building CXX object packages/shards/src/CMakeFiles/shards.dir/Shards_BasicTopologies.cpp.o
[ 0%] Building CXX object packages/sh...
...
[100%] Building CXX object packages/muelu/src/CMakeFiles/muelu.dir/Utils/MueLu_MutuallyExclusiveTime.cpp.o
[100%] Building CXX object packages/muelu/src/CMakeFiles/muelu.dir/Utils/MueLu_TimeMonitor.cpp.o
[100%] Building CXX object packages/muelu/src/CMakeFiles/muelu.dir/Utils/MueLu_Utilities.cpp.o
[100%] Linking CXX static library libmuelu.a
[100%] Built target muelu
[100%] Building CXX object packages/muelu/adapters/CMakeFiles/muelu-adapters.dir/stratimikos/Stratimikos_MueLuHelpers.cpp.o
[100%] Building CXX object packages/muelu/adapters/CMakeFiles/muelu-adapters.dir/ExplicitInstantiation/Thyra_MueLuPreconditionerFactory.cpp.o
[100%] Building CXX object packages/muelu/adapters/CMakeFiles/muelu-adapters.dir/ExplicitInstantiation/Thyra_XpetraLinearOp.cpp.o
...
<installing packages here in /usr/local/Trilinos/>
Running my project with CMAKE_BUILD_TYPE=Release and without CUDA:
Making with 20 threads. Your PC provides 20 threads.
-- 🚫 CUDA support for GPU acceleration is disabled.
-- ✅ Vectorization and anti-aliasing flags are enabled.
-- ✅ OpenMP support enabled for the project.
-- ✅ MPI is enabled for the project.
-- ✅ Logging is enabled.
-- Using environment variable CC: /usr/bin/gcc-13
-- Using environment variable CXX: /usr/bin/g++-13
-- The CXX compiler identification is GNU 13.3.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/g++-13 - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
[ 52%] Linking CXX static library libSessionManagers.a
[ 52%] Built target SessionManagers
<command-line>: error: expected identifier before numeric constant
/usr/local/Trilinos/include/MueLu_Level.hpp:368:22: note: in expansion of macro ‘RELEASE’
368 | RELEASE,
| ^~~~~~~
<command-line>: error: expected ‘}’ before numeric constant
/usr/local/Trilinos/include/MueLu_Level.hpp:368:22: note: in expansion of macro ‘RELEASE’
368 | RELEASE,
| ^~~~~~~
In file included from /usr/local/Trilinos/include/MueLu_Factory.hpp:29,
from /usr/local/Trilinos/include/MueLu_SmootherPrototype_decl.hpp:16,
from /usr/local/Trilinos/include/MueLu_SmootherPrototype.hpp:1,
from /usr/local/Trilinos/include/MueLu_Ifpack2Smoother_decl.hpp:35,
from /usr/local/Trilinos/include/MueLu_Ifpack2Smoother.hpp:1,
from /usr/local/Trilinos/include/MueLu_SmootherCloner.hpp:20,
from /usr/local/Trilinos/include/MueLu_Hierarchy_decl.hpp:22,
from /usr/local/Trilinos/include/MueLu_Hierarchy.hpp:1,
from /usr/local/Trilinos/include/MueLu.hpp:33,
from /usr/local/Trilinos/include/MueLu_CreateTpetraPreconditioner.hpp:25,
from /home/vladislavsemykin/Documents/Work/Start/include/FiniteElementMethod/FEMTypes.hpp:13,
from /home/vladislavsemykin/Documents/Work/Start/include/FiniteElementMethod/Cubature/CubatureManager.hpp:5,
from /home/vladislavsemykin/Documents/Work/Start/src/FiniteElementMethod/Cubature/CubatureManager.cpp:1:
/usr/local/Trilinos/include/MueLu_Level.hpp:367:20: note: to match this ‘{’
367 | enum RequestMode { REQUEST,
| ^
<command-line>: error: expected unqualified-id before numeric constant
/usr/local/Trilinos/include/MueLu_Level.hpp:368:22: note: in expansion of macro ‘RELEASE’
368 | RELEASE,
| ^~~~~~~
/usr/local/Trilinos/include/MueLu_Level.hpp: In constructor ‘MueLu::Level::Level()’:
/usr/local/Trilinos/include/MueLu_Level.hpp:70:7: error: class ‘MueLu::Level’ does not have any field named ‘lib_’
70 | : lib_(Xpetra::NotSpecified)
...
<and many strange errors>
@cgcgcg, but in CMAKE_BUILD_TYPE=Debug everything is fine:
-- 🛠️ Compiling in DEBUG mode
-- 🚀 Start project compiling mode set to START_RELEASE.
CMake Warning at /usr/local/lib/cmake/CGAL/CGAL_enable_end_of_configuration_hook.cmake:93 (message):
=======================================================================
CGAL performance notice:
The variable CMAKE_BUILD_TYPE is set to "Debug". For performance reasons,
you should set CMAKE_BUILD_TYPE to "Release".
Set CGAL_DO_NOT_WARN_ABOUT_CMAKE_BUILD_TYPE to TRUE if you want to disable
this warning.
=======================================================================
Call Stack (most recent call first):
/usr/local/lib/cmake/CGAL/CGAL_enable_end_of_configuration_hook.cmake:193 (CGAL_hook_check_CMAKE_BUILD_TYPE)
CMakeLists.txt:DEFERRED
-- Configuring done (4.7s)
-- Generating done (0.1s)
-- Build files have been written to: /home/vladislavsemykin/Documents/Work/Start/build
[ 2%] Building CXX object src/FiniteElementMethod/BoundaryConditions/CMakeFiles/FiniteElementMethod_BoundaryConditions.dir/VectorBoundaryConditionsManager.cpp.o
[ 7%] Building CXX object src/FiniteElementMethod/BoundaryConditions/CMakeFiles/FiniteElementMethod_BoundaryConditions.dir/BoundaryConditionsManager.cpp.o
[ 5%] Building CXX object src/FiniteElementMethod/BoundaryConditions/CMakeFiles/FiniteElementMethod_BoundaryConditions.dir/MatrixBoundaryConditionsManager.cpp.o
[ 10%] Building CXX object src/DataHandling/CMakeFiles/DataHandling.dir/HDF5Handler.cpp.o
[ 13%] Building CXX object src/Utilities/CMakeFiles/Utilities.dir/ConfigParser.cpp.o
[ 15%] Building CXX object src/FiniteElementMethod/Cubature/CMakeFiles/FiniteElementMethod_Cubature.dir/CubatureManager.cpp.o
[ 21%] Building CXX object src/Geometry/CMakeFiles/Geometry.dir/Mesh.cpp.o
[ 23%] Building CXX object src/Utilities/CMakeFiles/Utilities.dir/Timer.cpp.o
[ 26%] Building CXX object src/FiniteElementMethod/Cell/CMakeFiles/FiniteElementMethod_Cell.dir/CellSelector.cpp.o
[ 18%] Building CXX object src/FiniteElementMethod/LinearAlgebraManagers/CMakeFiles/FiniteElementMethod_LinearAlgebraManagers.dir/MatrixManager.cpp.o
[ 28%] Building CXX object src/SessionManagement/CMakeFiles/SessionManagers.dir/GmshSessionManager.cpp.o
[ 44%] Building CXX object src/Generators/CMakeFiles/Generators.dir/ParticleGenerator.cpp.o
[ 31%] Building CXX object src/FiniteElementMethod/Cell/CMakeFiles/FiniteElementMethod_Cell.dir/CellSelectorException.cpp.o
[ 34%] Building CXX object src/Utilities/CMakeFiles/Utilities.dir/Utilities.cpp.o
[ 36%] Building CXX object src/Geometry/CMakeFiles/Geometry.dir/CubicGrid.cpp.o
[ 50%] Building CXX object src/Geometry/CMakeFiles/Geometry.dir/RayTriangleIntersection.cpp.o
[ 50%] Building CXX object src/Generators/CMakeFiles/Generators.dir/RealNumberGenerator.cpp.o
[ 39%] Building CXX object src/FiniteElementMethod/LinearAlgebraManagers/CMakeFiles/FiniteElementMethod_LinearAlgebraManagers.dir/VectorManager.cpp.o
[ 42%] Building CXX object src/DataHandling/CMakeFiles/DataHandling.dir/TetrahedronMeshManager.cpp.o
[ 52%] Linking CXX static library libSessionManagers.a
[ 52%] Built target SessionManagers
[ 55%] Linking CXX static library libFiniteElementMethod_Cell.a
[ 55%] Built target FiniteElementMethod_Cell
[ 57%] Linking CXX static library libUtilities.a
[ 60%] Linking CXX static library libFiniteElementMethod_BoundaryConditions.a
[ 60%] Built target Utilities
[ 60%] Built target FiniteElementMethod_BoundaryConditions
[ 63%] Linking CXX static library libFiniteElementMethod_LinearAlgebraManagers.a
[ 63%] Built target FiniteElementMethod_LinearAlgebraManagers
[ 65%] Linking CXX static library libGenerators.a
[ 65%] Built target Generators
[ 68%] Building CXX object src/Particle/CMakeFiles/Particle.dir/Particle.cpp.o
[ 71%] Linking CXX static library libGeometry.a
[ 71%] Built target Geometry
[ 73%] Linking CXX static library libDataHandling.a
[ 73%] Built target DataHandling
[ 76%] Linking CXX static library libParticle.a
[ 76%] Built target Particle
...
[ 84%] Building CXX object src/FiniteElementMethod/CMakeFiles/FiniteElementMethod.dir/GSMAssemblier.cpp.o
[ 86%] Building CXX object src/FiniteElementMethod/CMakeFiles/FiniteElementMethod.dir/MatrixEquationSolver.cpp.o
[ 89%] Building CXX object src/FiniteElementMethod/CMakeFiles/FiniteElementMethod.dir/FEMPrinter.cpp.o
[ 92%] Linking CXX static library libFiniteElementMethod.a
[ 92%] Built target FiniteElementMethod
[ 94%] Building CXX object CMakeFiles/nia_start_core.dir/src/main.cpp.o
[ 97%] Building CXX object CMakeFiles/nia_start_core.dir/src/ModelingMainDriver.cpp.o
[100%] Linking CXX executable /home/vladislavsemykin/Documents/Work/Start/nia_start_core
[100%] Built target nia_start_core
@cgcgcg, and if I do smth like this and compile with CMAKE_BUILD_TYPE=DEBUG:
then, I'll have another errors:
/usr/local/Trilinos/include/MueLu_Level.hpp:367:20: note: to match this ‘{’
367 | enum RequestMode { REQUEST,
| ^
<command-line>: error: expected unqualified-id before numeric constant
/usr/local/Trilinos/include/MueLu_Level.hpp:368:22: note: in expansion of macro ‘RELEASE’
368 | RELEASE,
| ^~~~~~~
/usr/local/Trilinos/include/MueLu_Level.hpp: In constructor ‘MueLu::Level::Level()’:
/usr/local/Trilinos/include/MueLu_Level.hpp:70:7: error: class ‘MueLu::Level’ does not have any field named ‘lib_’
70 | : lib_(Xpetra::NotSpecified)
Based on this reasoning, it's clear that using names like RELEASE
or DEBUG
in the code should be avoided. These names are often predefined as macros in compilers or build systems, which can lead to unexpected conflicts and compilation errors. When used in enumerations or as identifiers (enum
s in C are constants of compile time), they may be replaced by the macro values, disrupting the intended code structure and causing compilation failures.
Status Flag 'Pre-Test Inspection' - - This Pull Request Requires Inspection... The code must be inspected by a member of the Team before Testing/Merging NO INSPECTION HAS BEEN PERFORMED ON THIS PULL REQUEST! - This PR must be inspected by setting label 'AT: PRE-TEST INSPECTED'.
I totally agree on the use of DEBUG, but I haven't seen RELEASE used anywhere. Could you double check that the code that you are building against Trilinos does not define a RELEASE macro?
ok, I'll check it out
upd: no, my code doesn't define RELEASE. But I'll do more experiments and tell you results
@ViNN280801 Thank you. It's a bit mysterious to me where that macro gets defined. In principle your changes are fine, but I would like to better understand where the macro comes from.
@cgcgcg
While building a project that uses Trilinos, an error occurs in the MueLu_Level.hpp
header file when the CMAKE_BUILD_TYPE
is set to Release
. The error specifically shows an issue with an identifier in an enum declaration in MueLu_Level.hpp
, suggesting a conflict with a macro named RELEASE
.
#define RELEASE
in Project and System FilesProject Search: Executed a recursive search within the project directory:
grep -rnw './' -e '#define RELEASE'
Result: No instances of #define RELEASE were found in the project files.
(base) vladislavsemykin@loveit:~$ grep -rnw './' -e '#define RELEASE'
grep: ./.cache/vscode-cpptools/ipch/712ff8f7d7af5c17/ParticleGenerator.ipch: binary file matches
grep: ./VirtualBox VMs/deb12/deb12.vdi: binary file matches
grep: ./.local/share/parcellite/history: binary file matches
(base) vladislavsemykin@loveit:~/Documents/Work/Start$ echo '' | gcc -dM -E - | grep RELEASE
#define __ATOMIC_HLE_RELEASE 131072
#define __ATOMIC_RELEASE 3
Release Build with Trilinos: When building Trilinos with CMAKE_BUILD_TYPE=Release, we observed the following error:
/usr/local/Trilinos/include/MueLu_Level.hpp(372): error: expected an identifier
1,
^
This suggests that the RELEASE
enumerator in MueLu_Level.hpp
was somehow replaced by a macro value (possibly 1). This error occurs when building the main project in Release mode, leading to the hypothesis that this issue might stem from a macro conflict introduced during the Trilinos compilation in Release
mode.
Based on the gathered data, it is hypothesized that:
Macro Conflicts: Setting CMAKE_BUILD_TYPE=RELEASE
might have triggered a macro definition that conflicts with the RELEASE
enumerator in Trilinos. This could be due to an internal or system-defined macro conflict, possibly introduced by the CUDA/NVCC compiler or another linked library.
Potential Solution: Rebuilding Trilinos with a different build type (e.g., RelWithDebInfo
instead of Release
) could avoid defining any implicit RELEASE
macros, resolving the issue without modifying the Trilinos source.
with CUDA and without CUDA I have strange substitution RELEASE=1
/usr/local/Trilinos/include/MueLu_Level.hpp(368): error: expected an identifier
1,
^
Hm. Maybe just hack in a
#define RELEASE 2
and see if the error message about conflicting macros is useful in tracking down where this comes from?
omg, I apologize for it. I have these lines in my CMakeLists.txt for my project:
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
add_compile_definitions(DEBUG)
message(STATUS "🛠️ Compiling in DEBUG mode")
elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
add_compile_definitions(RELEASE)
message(STATUS "🚀 Compiling in RELEASE mode")
else()
message(WARNING "⚠️ Unknown build type: ${CMAKE_BUILD_TYPE}")
endif()
So, this leads to:
[ 7%] Building CXX object src/FiniteElementMethod/Cell/CMakeFiles/FiniteElementMethod_Cell.dir/CellSelector.cpp.o
cd /home/vladislavsemykin/Documents/Work/Start/build/src/FiniteElementMethod/LinearAlgebraManagers && /usr/bin/g++-13 -DRELEASE -DSTART_RELEASE -I/usr/local/CGAL/include -I/usr/include/nlohmann -I/usr/lib/x86_64-linux-gnu/openmpi/include -I/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi -I/usr/include/hdf5/serial -I/usr/local/Trilinos/include -I/home/vladislavsemykin/Documents/Work/Start/include -I/home/vladislavsemykin/Documents/Work/Start/include/DataHandling -I/home/vladislavsemykin/Documents/Work/Start/include/FiniteElementMethod -I/home/vladislavsemykin/Documents/Work/Start/include/FiniteElementMethod/BoundaryConditions -I/home/vladislavsemykin/Documents/Work/Start/include/FiniteElementMethod/Cell -I/home/vladislavsemykin/Documents/Work/Start/include/FiniteElementMethod/Cubature -I/home/vladislavsemykin/Documents/Work/Start/include/Generators -I/home/vladislavsemykin/Documents/Work/Start/include/Geometry -I/home/vladislavsemykin/Documents/Work/Start/include/Particle -I/home/vladislavsemykin/Documents/Work/Start/include/SessionManagement -I/home/vladislavsemykin/Documents/Work/Start/include/Utilities -fopenmp -DUSE_OMP -Wall -Wextra -Wpedantic -pthread -O3 -Wmisleading-indentation -Wno-deprecated-declarations -Wno-unused-parameter -Wno-implicit-fallthrough -fno-math-errno -fno-trapping-math -Wall -Wextra -Wpedantic -pthread -O3 -Wmisleading-indentation -Wno-deprecated-declarations -Wno-unused-parameter -Wno-implicit-fallthrough -fno-math-errno -fno-trapping-math -mno-amx-tile -O3 -DNDEBUG -std=c++20 -fopenmp -DUSE_OMP -Wno-cast-function-type -DUSE_MPI -DSHOW_LOGS -flarge-source-files -ftree-vectorize -fstrict-aliasing -mprefer-vector-width=256 -frounding-math -Wmisleading-indentation -MD -MT src/FiniteElementMethod/LinearAlgebraManagers/CMakeFiles/FiniteElementMethod_LinearAlgebraManagers.dir/MatrixManager.cpp.o -MF CMakeFiles/FiniteElementMethod_LinearAlgebraManagers.dir/MatrixManager.cpp.o.d -o CMakeFiles/FiniteElementMethod_LinearAlgebraManagers.dir/MatrixManager.cpp.o -c /home/vladislavsemykin/Documents/Work/Start/src/FiniteElementMethod/LinearAlgebraManagers/MatrixManager.cpp
cd /home/vladislavsemykin/Documents/Work/Start/build/src/FiniteElementMethod/LinearAlgebraManagers && /usr/bin/g++-13 -DRELEASE -DSTART_RELEASE -I/usr/local/CGAL/include -I/usr/include/nlohmann -I/usr/lib/x86_64-linux-gnu/openmpi/include -I/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi -I/usr/include/hdf5/serial -I/usr/local/Trilinos/include -I/home/vladislavsemykin/Documents/Work/Start/include -I/home/vladislavsemykin/Documents/Work/Start/include/DataHandling -I/home/vladislavsemykin/Documents/Work/Start/include/FiniteElementMethod -I/home/vladislavsemykin/Documents/Work/Start/include/FiniteElementMethod/BoundaryConditions -I/home/vladislavsemykin/Documents/Work/Start/include/FiniteElementMethod/Cell -I/home/vladislavsemykin/Documents/Work/Start/include/FiniteElementMethod/Cubature -I/home/vladislavsemykin/Documents/Work/Start/include/Generators -I/home/vladislavsemykin/Documents/Work/Start/include/Geometry -I/home/vladislavsemykin/Documents/Work/Start/include/Particle -I/home/vladislavsemykin/Documents/Work/Start/include/SessionManagement -I/home/vladislavsemykin/Documents/Work/Start/include/Utilities -fopenmp -DUSE_OMP -Wall -Wextra -Wpedantic -pthread -O3 -Wmisleading-indentation -Wno-deprecated-declarations -Wno-unused-parameter -Wno-implicit-fallthrough -fno-math-errno -fno-trapping-math -Wall -Wextra -Wpedantic -pthread -O3 -Wmisleading-indentation -Wno-deprecated-declarations -Wno-unused-parameter -Wno-implicit-fallthrough -fno-math-errno -fno-trapping-math -mno-amx-tile -O3 -DNDEBUG -std=c++20 -fopenmp -DUSE_OMP -Wno-cast-function-type -DUSE_MPI -DSHOW_LOGS -flarge-source-files -ftree-vectorize -fstrict-aliasing -mprefer-vector-width=256 -frounding-math -Wmisleading-indentation -MD -MT src/FiniteElementMethod/LinearAlgebraManagers/CMakeFiles/FiniteElementMethod_LinearAlgebraManagers.dir/VectorManager.cpp.o -MF CMakeFiles/FiniteElementMethod_LinearAlgebraManagers.dir/VectorManager.cpp.o.d -o CMakeFiles/FiniteElementMethod_LinearAlgebraManagers.dir/VectorManager.cpp.o -c /home/vladislavsemykin/Documents/Work/Start/src/FiniteElementMethod/LinearAlgebraManagers/VectorManager.cpp
As you can see, -DRELEASE
that redefine RELEASE
in enum. Sorry for wasting your time with wrong PR.
Haha, no worries :-) It's good that we figured it out!
Pull Request: Fix for Enum Name Conflict in
MueLu_Level.hpp
Issue Description
This PR addresses a build issue occurring in
Release
mode when compiling Trilinos with theMueLu
package. The error encountered is due to a naming conflict involving theRequestMode
enum inMueLu_Level.hpp
. Specifically, enum valuesREQUEST
,RELEASE
, andUNDEF
conflict with certain standard or predefined macros in the compiler environment, especially under optimized compilation settings used inRelease
.Error Message
Here’s an example of the error output observed:
Issue Description
This error only manifests in Release mode, while the code compiles successfully in Debug mode. After investigation, the root cause appears to be the conflict with macro definitions or compiler-reserved names in the Release configuration.
Solution Overview
To avoid conflicts, the enum values in
RequestMode
have been renamed as follows:Level::REQUEST
➔RequestModeRequest
Level::RELEASE
➔RequestModeRelease
Level::UNDEF
➔RequestModeUndef
These new names provide a unique identifier that minimizes the risk of conflicting with external definitions, particularly in Release builds.
Modifications
The following changes were made to implement this fix:
MueLu_Level.hpp
, renamed the enum values underRequestMode
:Code Updates
Updated all references to these enum values across the affected source files in
MueLu
:packages/muelu/src/Transfers/Energy-Minimization/MueLu_EminPFactory_def.hpp
packages/muelu/src/Misc/MueLu_LocalOrdinalTransferFactory_def.hpp
packages/muelu/src/Misc/MueLu_CoordinatesTransferFactory_def.hpp
Each reference to the original enum values was updated accordingly:
Level::REQUEST
➔Level::RequestModeRequest
Level::RELEASE
➔Level::RequestModeRelease
Level::UNDEF
➔Level::RequestModeUndef
This was done to ensure consistency and avoid conflicts with potential macros or reserved keywords.
Here is my system info:
After changes I compiled the Trilinos with these configuration:
So, the result was good, compiled successfully, without any errors at all. Proofs:
Tested on the latest Trilinos version, which was just cloned from the repo with:
Before
After