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

gamenetworkingsockets fails to build (likely related to #3667 ) #3710

Open
RobbeBryssinck opened this issue Apr 6, 2024 · 10 comments
Open
Labels

Comments

@RobbeBryssinck
Copy link
Contributor

RobbeBryssinck commented Apr 6, 2024

Xmake Version

2.8.9

Operating System Version and Architecture

Windows 11, Ubuntu 22.04

Describe Bug

Linking to protobuf-cpp fails.

I am guessing it is related to the C++ version not being set correctly (protobuf or abseil using C++11 causing strings compilation to fail). Seems there are other packages like grpc that are running into similar issues ( #3705 ).

Sometimes, compilation seems to continue, only for it to later fail as the protobuf files are not present, resulting in errors such as the following:

error: @programdir\core\main.lua:329: @programdir\actions\build\main.lua:148: @programdir\modules\async\runjobs.lua:338: @programdir\modules\private\action\build\object.lua:91: @programdir\modules\core\tools\cl.lua:716: steamnetworkingsockets_stun.cpp
C:\Users\pc\AppData\Local\Temp\.xmake\240406.dir\src\steamnetworkingsockets\clientlib\../steamnetworkingsockets_internal.h(27): fatal error C1083: Cannot open include file: 'steamnetworkingsockets_messages_certs.pb.h': No such file or directory

Expected Behavior

protobuf and/or its dependencies should use the correct C++ version to compile.

Project Configuration

The latest version of gamenetworkingsockets is used (v1.4.1).

Additional Information and Error Logs

error: libprotobuf.lib(generated_message_tctable_lite.obj) : error LNK2019: unresolved external symbol "bool __cdecl utf8_range::IsStructurallyValid(class absl::lts_20240116::string_view)" (?IsStructurallyValid@utf8_range@@YA_NVstring_view@lts_20240116@absl@@@Z) referenced in function "public: static char const * __cdecl google::protobuf::internal::TcParser::FastUR1(class google::protobuf::MessageLite *,char const *,class google::protobuf::internal::ParseContext *,struct google::protobuf::internal::TcFieldData,struct google::protobuf::internal::TcParseTableBase const *,unsigned __int64)" (?FastUR1@TcParser@internal@protobuf@google@@SAPEBDPEAVMessageLite@34@PEBDPEAVParseContext@234@UTcFieldData@234@PEBUTcParseTableBase@234@_K@Z)
libprotobuf.lib(wire_format_lite.obj) : error LNK2001: unresolved external symbol "bool __cdecl utf8_range::IsStructurallyValid(class absl::lts_20240116::string_view)" (?IsStructurallyValid@utf8_range@@YA_NVstring_view@lts_20240116@absl@@@Z)
libprotobuf.lib(parse_context.obj) : error LNK2001: unresolved external symbol "bool __cdecl utf8_range::IsStructurallyValid(class absl::lts_20240116::string_view)" (?IsStructurallyValid@utf8_range@@YA_NVstring_view@lts_20240116@absl@@@Z)
libprotobuf.lib(text_format.obj) : error LNK2019: unresolved external symbol "unsigned __int64 __cdecl utf8_range::SpanStructurallyValid(class absl::lts_20240116::string_view)" (?SpanStructurallyValid@utf8_range@@YA_KVstring_view@lts_20240116@absl@@@Z) referenced in function "private: static void __cdecl google::protobuf::TextFormat::Printer::HardenedPrintString(class absl::lts_20240116::string_view,class google::protobuf::TextFormat::BaseTextGenerator *)" (?HardenedPrintString@Printer@TextFormat@protobuf@google@@CAXVstring_view@lts_20240116@absl@@PEAVBaseTextGenerator@234@@Z)
@waruqi
Copy link
Member

waruqi commented Apr 6, 2024

try this patch. #3706

@RobbeBryssinck
Copy link
Contributor Author

try this patch. #3706

Isn't this already in the "main repo"? As in, if I were to clean my repository cache, run xrepo update-repo, and then build again, shouldn't it build already with that patch? Because I tried that already.

@c8ef
Copy link
Member

c8ef commented Apr 6, 2024

Could you please provide a minimal reproduction that will help us pinpoint the root cause? This will assist in narrowing down the issue more effectively.

@RobbeBryssinck
Copy link
Contributor Author

The issue can be reproduced by adding the gamenetworkingsockets to a sample project (like, say, this one: https://github.com/xmake-io/xmake/tree/master/tests/projects/c%2B%2B/console). I modified the xmake.lua file of this project to look like this:

add_rules("mode.debug", "mode.release")
add_requires("gamenetworkingsockets")
target("test")
    set_kind("binary")
    add_files("src/*.cpp")
    add_deps("gamenetworkingsockets")

@waruqi
Copy link
Member

waruqi commented Apr 6, 2024

try

xrepo update-repo
xrepo remove --all abseil
xmake f -cvD

@RobbeBryssinck
Copy link
Contributor Author

This produces a long list of compilation errors that boils down to string_view not being able to compile:

...

[ 15%]: compiling.proto.release build_7c0aa346\.gens\gns\windows\x64\release\rules\protobuf\src\common\steamnetworkingsockets_messages_certs.pb.cc
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\bin\HostX64\x64\cl.exe -c -nologo -O2 -fp:fast -MT -Iinclude -Isrc -Isrc\common -Isrc\tier0 -Isrc\tier1 -Isrc\vstdlib -Isrc\steamnetworkingsockets -Isrc\steamnetworkingsockets\clientlib -Isrc\public -DWIN32 -D_WINDOWS -DSTEAMNETWORKINGSOCKETS_STATIC_LINK -DOPENSSL_USE_STATIC_LIBS -DSTEAMNETWORKINGSOCKETS_CRYPTO_25519_OPENSSL -DSTEAMNETWORKINGSOCKETS_CRYPTO_VALVEOPENSSL -DOPENSSL_HAS_25519_RAW -DVALVE_CRYPTO_ENABLE_25519 -DGOOGLE_PROTOBUF_NO_RTTI -DVALVE_CRYPTO_25519_OPENSSL -DCRYPTO_DISABLE_ENCRYPT_WITH_PASSWORD -DENABLE_OPENSSLCONNECTION /EHsc -external:W0 -external:IC:\Users\pc\AppData\Local\.xmake\packages\p\protobuf-cpp\26.1\6ffa349d1b5f4047a086e95e2d5e70ed\include -external:W0 -external:IC:\Users\pc\AppData\Local\.xmake\packages\a\abseil\20240116.1\f1d1419501d24c1cbe78f072955b1d15\include -external:W0 -external:IC:\Users\pc\AppData\Local\.xmake\packages\o\openssl\1.1.1-w\61d86fc2f8cc4e60a5bef5bc478c3a92\include -DNDEBUG -Ibuild_7c0aa346\.gens\gns\windows\x64\release\rules\protobuf\src\common -Fobuild_7c0aa346\.objs\gns\windows\x64\release\gens\rules\protobuf\src\common\steamnetworkingsockets_messages_certs.pb.cc.obj build_7c0aa346\.gens\gns\windows\x64\release\rules\protobuf\src\common\steamnetworkingsockets_messages_certs.pb.cc
steamnetworkingsockets_messages_certs.pb.cc
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\include\string_view(12): warning STL4038: The contents of <string_view> are available only with C++17 or later.
C:\Users\pc\AppData\Local\.xmake\packages\a\abseil\20240116.1\f1d1419501d24c1cbe78f072955b1d15\include\absl/strings/string_view.h(53): error C2039: 'string_view': is not a member of 'std'
...

@waruqi
Copy link
Member

waruqi commented Apr 6, 2024

please add set_languages("c++17") ,

#3705 (comment)

@waruqi
Copy link
Member

waruqi commented Apr 6, 2024

or add_requireconfs("**.abseil", {configs = {cxx_standard = "14"}})

@RobbeBryssinck
Copy link
Contributor Author

RobbeBryssinck commented Apr 7, 2024

I'm assuming these configuration options would be added in my project's configuration, and not the gamenetworkingsockets package configuration? These options don't work, even if cxx_standard is set to "17". I get the same compilation errors.

@waruqi
Copy link
Member

waruqi commented Apr 7, 2024

add to your gamenetworkingsockets package's project xmake.lua

RobbeBryssinck added a commit to RobbeBryssinck/xmake-repo that referenced this issue Apr 7, 2024
waruqi added a commit that referenced this issue Apr 30, 2024
* Fix gamenetworkingsockets abseil C++ version

As suggested by @waruqi in #3710 .

* Set language C++17 in gamenetworkingsockets

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* fix openssl fetch

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* remove arm64 support

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

---------

Co-authored-by: Jérôme Leclercq <[email protected]>
Co-authored-by: ruki <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants