microsoft / cppgraphqlgen

C++ GraphQL schema service generator
MIT License
325 stars 46 forks source link

Build fail on linux #301

Closed jimwang118 closed 4 months ago

jimwang118 commented 5 months ago

When I use vcpkg to compile the cppgraphqlgen library, a compilation error occurs using the following command. ./vcpkg install cppgraphqlgen[core,rapidjson]:x64-linux

error:

/usr/include/c++/13/bits/unique_ptr.h:99:9: error: ‘void operator delete(void*, std::size_t)’ called on unallocated object ‘<anonymous>’ [-Werror=free-nonheap-object]
   99 |         delete __ptr;
      |         ^~~~~~~~~~~~
/root/vcpkg/buildtrees/cppgraphqlgen/src/v4.5.5-147cf636ad.clean/src/GraphQLResponse.cpp: In constructor ‘graphql::response::Value::Value(graphql::response::Type)’:
/root/vcpkg/buildtrees/cppgraphqlgen/src/v4.5.5-147cf636ad.clean/src/GraphQLResponse.cpp:931:47: note: declared here
  931 |                         _data = { EnumData {} };
      |                                               ^
cc1plus: all warnings being treated as errors
wravery commented 4 months ago

I haven't been able to reproduce this error on an up-to-date installation of Ubuntu 22.04.4 LTS (running in WSL). Both building from source and building with a freshly pulled vcpkg worked for me. Here's the output from my compiler config, can you share what toolchain/version you're using?

> c++ --version
Ubuntu clang version 14.0.0-1ubuntu1.1
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
wravery commented 4 months ago

I also tried explicitly using clang++-15 using the CXX environment variable, and vcpkg still succeeded in building it. This is cppgraphqlgen v4.5.5 BTW, in case your vcpkg port is behind mine.

jimwang118 commented 4 months ago

I used cppgraphqlgen version 4.5.5 and compiled it on Ubuntu 24.04. The clang version is as follows:

Ubuntu clang version 18.1.3 (1)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/13
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/14
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/14
Candidate multilib: .;@m64
Selected multilib: .;@m64

What other information do you need?

jimwang118 commented 4 months ago

I cloned vcpkg directly and then installed it. I used gcc-13.2.0.

jimwang118 commented 4 months ago

Thanks for the fix, I tested it locally and it works.