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 compile #607

Closed
nonetrix opened this issue Aug 8, 2021 · 6 comments
Closed

Can't compile #607

nonetrix opened this issue Aug 8, 2021 · 6 comments
Assignees

Comments

@nonetrix
Copy link

nonetrix commented Aug 8, 2021

OS:

                   -`                    nonetrix@ArchBTW 
                  .o+`                   ---------------- 
                 `ooo/                   OS: Arch Linux x86_64 
                `+oooo:                  Host: B450 AORUS PRO WIFI 
               `+oooooo:                 Kernel: 5.13.7-zen1-1-zen 
               -+oooooo+:                Uptime: 7 hours, 44 mins 
             `/:-:++oooo+:               Packages: 1042 (pacman) 
            `/++++/+++++++:              Shell: bash 5.1.8 
           `/++++++++++++++:             Resolution: 1920x1200 
          `/+++ooooooooooooo/`           DE: Plasma 5.22.4 
         ./ooosssso++osssssso+`          WM: KWin 
        .oossssso-````/ossssss+`         Theme: Breeze Dark [Plasma], Adwaita [GTK3] 
       -osssssso.      :ssssssso.        Icons: [Plasma], Adwaita [GTK3] 
      :osssssss/        osssso+++.       Terminal: konsole 
     /ossssssss/        +ssssooo/-       Terminal Font: DejaVu Sans Mono 12 
   `/ossssso+/:-        -:/+osssso+-     CPU: AMD Ryzen 7 3700X (16) @ 3.600GHz 
  `+sso+:-`                 `.-/+oso:    GPU: NVIDIA GeForce GTX 1080 
 `++:.                           `-/+/   Memory: 5057MiB / 32052MiB 
 .`                                 `/
                                                                 
                                                                 

CMake error:

[ 70%] Built target libcurl
[ 77%] Built target cpr
Consolidate compiler generated dependencies of target discord
[ 78%] Built target discord
[ 95%] Built target zlib
Consolidate compiler generated dependencies of target gtest
[ 96%] Building CXX object _deps/googletest-build/googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.o
In file included from /home/nonetrix/Project/C++/discord/_deps/googletest-src/googletest/src/gtest-all.cc:42:
/home/nonetrix/Project/C++/discord/_deps/googletest-src/googletest/src/gtest-death-test.cc: In function ‘bool testing::internal::StackGrowsDown()’:
/home/nonetrix/Project/C++/discord/_deps/googletest-src/googletest/src/gtest-death-test.cc:1301:24: error: ‘dummy’ may be used uninitialized [-Werror=maybe-uninitialized]
 1301 |   StackLowerThanAddress(&dummy, &result);
      |   ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/home/nonetrix/Project/C++/discord/_deps/googletest-src/googletest/src/gtest-death-test.cc:1290:13: note: by argument 1 of type ‘const void*’ to ‘void testing::internal::StackLowerThanAddress(const void*, bool*)’ declared here
 1290 | static void StackLowerThanAddress(const void* ptr, bool* result) {
      |             ^~~~~~~~~~~~~~~~~~~~~
/home/nonetrix/Project/C++/discord/_deps/googletest-src/googletest/src/gtest-death-test.cc:1299:7: note: ‘dummy’ declared here
 1299 |   int dummy;
      |       ^~~~~
cc1plus: all warnings being treated as errors
make[2]: *** [_deps/googletest-build/googletest/CMakeFiles/gtest.dir/build.make:76: _deps/googletest-build/googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:441: _deps/googletest-build/googletest/CMakeFiles/gtest.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

CMake file:

cmake_minimum_required(VERSION 3.21.1)
include(FetchContent)

FetchContent_Declare(cpr GIT_REPOSITORY https://github.com/whoshuu/cpr.git GIT_TAG f4622efcb59d84071ae11404ae61bd821c1c344b) #cpr v1.6.2
FetchContent_MakeAvailable(cpr)


project (discord)

add_executable(discord main.cpp)
target_link_libraries(discord PRIVATE cpr::cpr)

CMake version:

cmake version 3.21.1

CMake suite maintained and supported by Kitware (kitware.com/cmake).

Source:

#include <iostream>
#include <cpr/cpr.h>

int main() {
    cpr::Response r = cpr::Get(cpr::Url{"https://discord.com/api/v9/channels/xxxxxxxxxxxxxxx/messages"},
                      cpr::Authentication{"authorization", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"},
                      cpr::Parameters{{"content", "Hello world!"}});
    std::cout << "Goodbye world!" << std::endl;
}

CMake command:

cmake .

Make command:

make -j16

This seems like an issue in the cpr code or my compiler, I am kinda new to this stuff so not exactly sure tbh, if you need more information or something just ask me, but I tried to give as much as possible.

@COM8
Copy link
Member

COM8 commented Aug 9, 2021

Thanks for this really well formulated issue!
To me this looks like google-test is failing to compile on your system.
In case you do not need the tests to be build, try replacing

FetchContent_Declare(cpr GIT_REPOSITORY https://github.com/whoshuu/cpr.git GIT_TAG f4622efcb59d84071ae11404ae61bd821c1c344b) #cpr v1.6.2
FetchContent_MakeAvailable(cpr)

with:

FetchContent_Declare(cpr GIT_REPOSITORY https://github.com/whoshuu/cpr.git GIT_TAG f4622efcb59d84071ae11404ae61bd821c1c344b) #cpr v1.6.2
set(CPR_BUILD_TESTS OFF CACHE INTERNAL "" FORCE)
FetchContent_MakeAvailable(cpr)

In case this does not help, could you please provide the full cmake . output.

@COM8 COM8 added the Build 👷 label Aug 9, 2021
@nonetrix
Copy link
Author

Should have also gave the GCC version, might help with fixing this

gcc (GCC) 11.1.0
Copyright (C) 2021 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.

@nonetrix
Copy link
Author

This was able to fix it closing issue

@COM8
Copy link
Member

COM8 commented Aug 11, 2021

Hmmm...
I'm also using gcc 11 without any problems.

@nonetrix
Copy link
Author

Could be the Arch version maybe? Sometimes they compile them with different options

I'll try compiling GCC from source and see if changes anything

@SquitchYT SquitchYT mentioned this issue Sep 1, 2021
@COM8
Copy link
Member

COM8 commented Sep 6, 2021

google/googletest#3219

Fixed in: 73f49c0

@COM8 COM8 self-assigned this Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants