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

[Bug]: Fix build warnings and errors on LCC (eLbrus C/C++ compiler) #4603

Open
makise-homura opened this issue Aug 22, 2024 · 0 comments
Open

Comments

@makise-homura
Copy link

Describe the issue

I have a machine based on CPU with e2k (Elbrus) architecture, and it is supplied with EDG-based LCC compiler, which is mainly compatible with GCC, but not exactly. Specifically, it has different warning causes and (as of version 1.25) does not support __attribute__((optimize("no-optimize-sibling-calls"))) (the same as with NVC, which has a specific workaround in googletest's code). Due to this, googletest can't be built with LCC on this machine without warnings and errors, unless patched correspondingly. And even then, after running CTest, the googletest-list-tests-unittest test fails.

I expect the build of googletest be successful and warningless with LCC that can fix these issues), and all CTest tests to pass. I'm ready to submit a PR which does that, from my fork of googletest.

Instead, I see a lot of unexpected warnings of -Wunused-variable, -Wunused-but-set-variable, -Wunused-function, -Wshadow that don't exist on GCC@x86_64, and, if building with lcc-1.25, the following error:

lcc: "/srv/home/molchan_i/googletest-master/googletest/googletest/src/gtest.cc", line 1166: error: unrecognized argument to attribute "optimize"

Steps to reproduce the problem

  • Use the e2k-based machine with LCC compiler. If you don't have one, I can provide user-mode ssh access to it (welcome here, the machine of a subject is yukari).
  • Clone googletest repository: git clone https://github.com/google/googletest
  • Configure the project: mkdir build; cd build; cmake -DCMAKE_BUILD_TYPE=Release -Dgmock_build_tests=ON -Dgtest_build_samples=ON -Dgtest_build_tests=ON -DBUILD_SHARED_LIBS=ON ../googletest
  • Build it: make -j32 (you may specify different number of processes).
  • You'll find a lot of build warnings.
  • Optionally, run ctest -j32 after build: you'll find googletest-list-tests-unittest test to fail.

If you proceed with LCC 1.25, you can't build gmock and gtest tests successfully (there are a lot of errors like no instance of overloaded function "testing::ElementsAreArray" matches the argument list, and compiling googletest-printers-test.cc segfaults--it looks like a known bug that was fixed in LCC 1.26), so configure string may look like this:
cmake -DCMAKE_BUILD_TYPE=Release -Dgmock_build_tests=OFF -Dgtest_build_samples=ON -Dgtest_build_tests=OFF -DBUILD_SHARED_LIBS=ON -DCMAKE_C_COMPILER=lcc-1.25 -DCMAKE_CXX_COMPILER=l++-1.25 ../googletest`.

What version of GoogleTest are you using?

I use current main, commit ff233bd.

What operating system and version are you using?

My /etc/os-release:

/etc/os-release
PRETTY_NAME="Elbrus Linux 7.2"
NAME="Elbrus Linux"
VERSION_ID="7"
VERSION="7.2"
ID="elbrus"
HOME_URL="http://www.mcst.ru/"
SUPPORT_URL="http://www.mcst.ru/support/"
BUG_REPORT_URL="https://bugs.mcst.ru/"

What compiler and version are you using?

  • LCC 1.25.20 (version string: lcc:1.25.20:Nov-17-2021:e2k-v4-linux gcc (GCC) 7.3.0 compatible)
  • LCC 1.26.22 (version string: lcc:1.26.22:Jan-10-2024:e2k-v4-linux gcc (GCC) 9.3.0 compatible)

What build system are you using?

I use cmake version 3.28.0.

Additional context

No response

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