Giter Club home page Giter Club logo

Comments (10)

tycho avatar tycho commented on May 14, 2024 1

I'll be looking at this tonight. MSVC doesn't like using functions as template arguments.

from gamenetworkingsockets.

tycho avatar tycho commented on May 14, 2024 1

@gregorypease280 I suspect it's just an old Ubuntu release and you aren't going to get significantly newer packages. Try using something based on Ubuntu 18.04.

from gamenetworkingsockets.

aiusepsi avatar aiusepsi commented on May 14, 2024

It appears that these are your errors:

..\src\common\crypto.cpp(246): error C2065: 'EVP_MD_CTX_free': undeclared identifier
..\src\common\crypto.cpp(246): error C2975: 'CleanupFunc': invalid template argument for 'EVPCTXPointer', expected compile-time constant expression
..\src\common\crypto.cpp(49): note: see declaration of 'CleanupFunc'
..\src\common\crypto.cpp(324): error C2065: 'EVP_MD_CTX_free': undeclared identifier
..\src\common\crypto.cpp(324): error C2975: 'CleanupFunc': invalid template argument for 'EVPCTXPointer', expected compile-time constant expression
..\src\common\crypto.cpp(49): note: see declaration of 'CleanupFunc'

Your problem is probably something to do with OpenSSL, not protobuf.

from gamenetworkingsockets.

gregorypease280 avatar gregorypease280 commented on May 14, 2024

@tycho tried building on a vm with similar-ish errors

vagrant@vagrant:~/GameNetworkingSockets$ ls
cmake		examples			      include  meson.build	  README.md  tests
CMakeLists.txt	GameNetworkingSockets.code-workspace  LICENSE  meson_options.txt  src
vagrant@vagrant:~/GameNetworkingSockets$ mkdir build
vagrant@vagrant:~/GameNetworkingSockets$ cd build
vagrant@vagrant:~/GameNetworkingSockets/build$ sudo apt-get install libssl-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
libssl-dev is already the newest version (1.0.2g-1ubuntu4.14).
0 upgraded, 0 newly installed, 0 to remove and 19 not upgraded.
vagrant@vagrant:~/GameNetworkingSockets/build$ sudo apt-get install libprotobuf-dev protobuf-compiler
Reading package lists... Done
Building dependency tree
Reading state information... Done
libprotobuf-dev is already the newest version (2.6.1-1.3).
protobuf-compiler is already the newest version (2.6.1-1.3).
0 upgraded, 0 newly installed, 0 to remove and 19 not upgraded.
vagrant@vagrant:~/GameNetworkingSockets/build$ cmake -G Ninja ../src -DUSE_LIBSODIUM:BOOL=false
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler using: Ninja
-- Check for working C compiler using: Ninja -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler using: Ninja
-- Check for working CXX compiler using: Ninja -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found Protobuf: /usr/lib/x86_64-linux-gnu/libprotobuf.so
-- Found OpenSSL: /usr/lib/x86_64-linux-gnu/libssl.so;/usr/lib/x86_64-linux-gnu/libcrypto.so (found version "1.0.2g")
-- Performing Test _fvisibility_hidden_TEST
-- Performing Test _fvisibility_hidden_TEST - Success
-- Performing Test _fno_strict_aliasing_TEST
-- Performing Test _fno_strict_aliasing_TEST - Success
-- Performing Test _Wall_TEST
-- Performing Test _Wall_TEST - Success
-- Performing Test _Wno_unknown_pragmas_TEST
-- Performing Test _Wno_unknown_pragmas_TEST - Success
-- Performing Test _Wno_sign_compare_TEST
-- Performing Test _Wno_sign_compare_TEST - Success
-- Performing Test _Wno_unused_local_typedef_TEST
-- Performing Test _Wno_unused_local_typedef_TEST - Success
-- Performing Test _Wno_unused_const_variable_TEST
-- Performing Test _Wno_unused_const_variable_TEST - Success
-- Performing Test _Wstrict_prototypes_TEST
-- Performing Test _Wstrict_prototypes_TEST - Success
-- Performing Test _fvisibility_inlines_hidden_TEST
-- Performing Test _fvisibility_inlines_hidden_TEST - Success
-- Performing Test _Wno_reorder_TEST
-- Performing Test _Wno_reorder_TEST - Success
-- Performing Test _Wno_non_virtual_dtor_TEST
-- Performing Test _Wno_non_virtual_dtor_TEST - Success
-- Performing Test _fno_rtti_TEST
-- Performing Test _fno_rtti_TEST - Success
-- Performing Test _fno_exceptions_TEST
-- Performing Test _fno_exceptions_TEST - Success
CMake Warning (dev) in CMakeLists.txt:
  No cmake_minimum_required command is present.  A line of code such as

    cmake_minimum_required(VERSION 3.5)

  should be added at the top of the file.  The version specified may be lower
  if you wish to support older CMake versions for this project.  For more
  information run "cmake --help-policy CMP0000".
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Configuring done
CMake Warning (dev) at CMakeLists.txt:215 (add_library):
  Policy CMP0003 should be set before this line.  Add code such as

    if(COMMAND cmake_policy)
      cmake_policy(SET CMP0003 NEW)
    endif(COMMAND cmake_policy)

  as early as possible but after the most recent call to
  cmake_minimum_required or cmake_policy(VERSION).  This warning appears
  because target "GameNetworkingSockets" links to some libraries for which
  the linker must search:

    -lpthread, -lpthread

  and other libraries with known full path:

    /usr/lib/x86_64-linux-gnu/libcrypto.so

  CMake is adding directories in the second list to the linker search path in
  case they are needed to find libraries from the first list (for backwards
  compatibility with CMake 2.4).  Set policy CMP0003 to OLD or NEW to enable
  or disable this behavior explicitly.  Run "cmake --help-policy CMP0003" for
  more information.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Generating done
-- Build files have been written to: /home/vagrant/GameNetworkingSockets/build
vagrant@vagrant:~/GameNetworkingSockets/build$ ninja
[9/67] Building CXX object CMakeFiles/GameNetworkingSockets_s.dir/common/crypto.o
FAILED: /usr/bin/c++   -DCRYPTO_DISABLE_ENCRYPT_WITH_PASSWORD -DENABLE_OPENSSLCONNECTION -DGNUC -DGNU_COMPILER -DGOOGLE_PROTOBUF_NO_RTTI -DHAVE_OPENSSL -DLINUX -DPOSIX -DSTEAMDATAGRAMLIB_FOREXPORT -I/home/vagrant/GameNetworkingSockets/src/../include -I/home/vagrant/GameNetworkingSockets/src/common -I/home/vagrant/GameNetworkingSockets/src/public -I. -fvisibility=hidden -fno-strict-aliasing -Wall -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-local-typedef -Wno-unused-const-variable -fvisibility-inlines-hidden -Wno-reorder -Wno-non-virtual-dtor -fno-rtti -fno-exceptions -fstack-protector-strong -std=gnu++11 -MMD -MT CMakeFiles/GameNetworkingSockets_s.dir/common/crypto.o -MF CMakeFiles/GameNetworkingSockets_s.dir/common/crypto.o.d -o CMakeFiles/GameNetworkingSockets_s.dir/common/crypto.o -c /home/vagrant/GameNetworkingSockets/src/common/crypto.cpp
/home/vagrant/GameNetworkingSockets/src/common/crypto.cpp: In function ‘void CCrypto::GenerateSHA256Digest(const uint8*, int, unsigned char (*)[32])’:
/home/vagrant/GameNetworkingSockets/src/common/crypto.cpp:246:30: error: ‘EVP_MD_CTX_free’ was not declared in this scope
  EVPCTXPointer<EVP_MD_CTX *, EVP_MD_CTX_free> ctx(EVP_MD_CTX_create());
                              ^
/home/vagrant/GameNetworkingSockets/src/common/crypto.cpp:246:45: error: template argument 2 is invalid
  EVPCTXPointer<EVP_MD_CTX *, EVP_MD_CTX_free> ctx(EVP_MD_CTX_create());
                                             ^
/home/vagrant/GameNetworkingSockets/src/common/crypto.cpp:246:68: error: invalid conversion from ‘EVP_MD_CTX* {aka env_md_ctx_st*}’ to ‘int’ [-fpermissive]
  EVPCTXPointer<EVP_MD_CTX *, EVP_MD_CTX_free> ctx(EVP_MD_CTX_create());
                                                                    ^
In file included from /home/vagrant/GameNetworkingSockets/src/public/tier1/utlmemory.h:17:0,
                 from /home/vagrant/GameNetworkingSockets/src/common/crypto.cpp:23:
/home/vagrant/GameNetworkingSockets/src/common/crypto.cpp:249:18: error: request for member ‘ctx’ in ‘ctx’, which is of non-class type ‘int’
  VerifyFatal(ctx.ctx != NULL);
                  ^
/home/vagrant/GameNetworkingSockets/src/public/tier0/dbg.h:307:11: note: in definition of macro ‘_AssertMsgSmall’
    if ( !(_exp) ) \
           ^
/home/vagrant/GameNetworkingSockets/src/public/tier0/dbg.h:339:38: note: in expansion of macro ‘AssertFatal’
 #define  VerifyFatal( _exp )         AssertFatal( _exp )
                                      ^
/home/vagrant/GameNetworkingSockets/src/common/crypto.cpp:249:2: note: in expansion of macro ‘VerifyFatal’
  VerifyFatal(ctx.ctx != NULL);
  ^
/home/vagrant/GameNetworkingSockets/src/common/crypto.cpp:250:36: error: request for member ‘ctx’ in ‘ctx’, which is of non-class type ‘int’
  VerifyFatal(EVP_DigestInit_ex(ctx.ctx, EVP_sha256(), NULL) == 1);
                                    ^
/home/vagrant/GameNetworkingSockets/src/public/tier0/dbg.h:307:11: note: in definition of macro ‘_AssertMsgSmall’
    if ( !(_exp) ) \
           ^
/home/vagrant/GameNetworkingSockets/src/public/tier0/dbg.h:339:38: note: in expansion of macro ‘AssertFatal’
 #define  VerifyFatal( _exp )         AssertFatal( _exp )
                                      ^
/home/vagrant/GameNetworkingSockets/src/common/crypto.cpp:250:2: note: in expansion of macro ‘VerifyFatal’
  VerifyFatal(EVP_DigestInit_ex(ctx.ctx, EVP_sha256(), NULL) == 1);
  ^
/home/vagrant/GameNetworkingSockets/src/common/crypto.cpp:251:35: error: request for member ‘ctx’ in ‘ctx’, which is of non-class type ‘int’
  VerifyFatal(EVP_DigestUpdate(ctx.ctx, pubInput, cubInput) == 1);
                                   ^
/home/vagrant/GameNetworkingSockets/src/public/tier0/dbg.h:307:11: note: in definition of macro ‘_AssertMsgSmall’
    if ( !(_exp) ) \
           ^
/home/vagrant/GameNetworkingSockets/src/public/tier0/dbg.h:339:38: note: in expansion of macro ‘AssertFatal’
 #define  VerifyFatal( _exp )         AssertFatal( _exp )
                                      ^
/home/vagrant/GameNetworkingSockets/src/common/crypto.cpp:251:2: note: in expansion of macro ‘VerifyFatal’
  VerifyFatal(EVP_DigestUpdate(ctx.ctx, pubInput, cubInput) == 1);
  ^
/home/vagrant/GameNetworkingSockets/src/common/crypto.cpp:252:34: error: request for member ‘ctx’ in ‘ctx’, which is of non-class type ‘int’
  VerifyFatal(EVP_DigestFinal(ctx.ctx, *pOutDigest, &digest_len) == 1);
                                  ^
/home/vagrant/GameNetworkingSockets/src/public/tier0/dbg.h:307:11: note: in definition of macro ‘_AssertMsgSmall’
    if ( !(_exp) ) \
           ^
/home/vagrant/GameNetworkingSockets/src/public/tier0/dbg.h:339:38: note: in expansion of macro ‘AssertFatal’
 #define  VerifyFatal( _exp )         AssertFatal( _exp )
                                      ^
/home/vagrant/GameNetworkingSockets/src/common/crypto.cpp:252:2: note: in expansion of macro ‘VerifyFatal’
  VerifyFatal(EVP_DigestFinal(ctx.ctx, *pOutDigest, &digest_len) == 1);
  ^
/home/vagrant/GameNetworkingSockets/src/common/crypto.cpp: In function ‘void CCrypto::GenerateHMAC256(const uint8*, uint32, const uint8*, uint32, unsigned char (*)[32])’:
/home/vagrant/GameNetworkingSockets/src/common/crypto.cpp:324:30: error: ‘EVP_MD_CTX_free’ was not declared in this scope
  EVPCTXPointer<EVP_MD_CTX *, EVP_MD_CTX_free> mdctx(EVP_MD_CTX_create());
                              ^
/home/vagrant/GameNetworkingSockets/src/common/crypto.cpp:324:45: error: template argument 2 is invalid
  EVPCTXPointer<EVP_MD_CTX *, EVP_MD_CTX_free> mdctx(EVP_MD_CTX_create());
                                             ^
/home/vagrant/GameNetworkingSockets/src/common/crypto.cpp:324:70: error: invalid conversion from ‘EVP_MD_CTX* {aka env_md_ctx_st*}’ to ‘int’ [-fpermissive]
  EVPCTXPointer<EVP_MD_CTX *, EVP_MD_CTX_free> mdctx(EVP_MD_CTX_create());
                                                                      ^
In file included from /home/vagrant/GameNetworkingSockets/src/public/tier1/utlmemory.h:17:0,
                 from /home/vagrant/GameNetworkingSockets/src/common/crypto.cpp:23:
/home/vagrant/GameNetworkingSockets/src/common/crypto.cpp:328:20: error: request for member ‘ctx’ in ‘mdctx’, which is of non-class type ‘int’
  VerifyFatal(mdctx.ctx != NULL && pkey.ctx != NULL);
                    ^
/home/vagrant/GameNetworkingSockets/src/public/tier0/dbg.h:307:11: note: in definition of macro ‘_AssertMsgSmall’
    if ( !(_exp) ) \
           ^
/home/vagrant/GameNetworkingSockets/src/public/tier0/dbg.h:339:38: note: in expansion of macro ‘AssertFatal’
 #define  VerifyFatal( _exp )         AssertFatal( _exp )
                                      ^
/home/vagrant/GameNetworkingSockets/src/common/crypto.cpp:328:2: note: in expansion of macro ‘VerifyFatal’
  VerifyFatal(mdctx.ctx != NULL && pkey.ctx != NULL);
  ^
/home/vagrant/GameNetworkingSockets/src/common/crypto.cpp:329:38: error: request for member ‘ctx’ in ‘mdctx’, which is of non-class type ‘int’
  VerifyFatal(EVP_DigestInit_ex(mdctx.ctx, digest, NULL) == 1);
                                      ^
/home/vagrant/GameNetworkingSockets/src/public/tier0/dbg.h:307:11: note: in definition of macro ‘_AssertMsgSmall’
    if ( !(_exp) ) \
           ^
/home/vagrant/GameNetworkingSockets/src/public/tier0/dbg.h:339:38: note: in expansion of macro ‘AssertFatal’
 #define  VerifyFatal( _exp )         AssertFatal( _exp )
                                      ^
/home/vagrant/GameNetworkingSockets/src/common/crypto.cpp:329:2: note: in expansion of macro ‘VerifyFatal’
  VerifyFatal(EVP_DigestInit_ex(mdctx.ctx, digest, NULL) == 1);
  ^
/home/vagrant/GameNetworkingSockets/src/common/crypto.cpp:330:39: error: request for member ‘ctx’ in ‘mdctx’, which is of non-class type ‘int’
  VerifyFatal(EVP_DigestSignInit(mdctx.ctx, NULL, digest, NULL, pkey.ctx) == 1);
                                       ^
/home/vagrant/GameNetworkingSockets/src/public/tier0/dbg.h:307:11: note: in definition of macro ‘_AssertMsgSmall’
    if ( !(_exp) ) \
           ^
/home/vagrant/GameNetworkingSockets/src/public/tier0/dbg.h:339:38: note: in expansion of macro ‘AssertFatal’
 #define  VerifyFatal( _exp )         AssertFatal( _exp )
                                      ^
/home/vagrant/GameNetworkingSockets/src/common/crypto.cpp:330:2: note: in expansion of macro ‘VerifyFatal’
  VerifyFatal(EVP_DigestSignInit(mdctx.ctx, NULL, digest, NULL, pkey.ctx) == 1);
  ^
/home/vagrant/GameNetworkingSockets/src/common/crypto.cpp:331:41: error: request for member ‘ctx’ in ‘mdctx’, which is of non-class type ‘int’
  VerifyFatal(EVP_DigestSignUpdate(mdctx.ctx, pubData, cubData) == 1);
                                         ^
/home/vagrant/GameNetworkingSockets/src/public/tier0/dbg.h:307:11: note: in definition of macro ‘_AssertMsgSmall’
    if ( !(_exp) ) \
           ^
/home/vagrant/GameNetworkingSockets/src/public/tier0/dbg.h:339:38: note: in expansion of macro ‘AssertFatal’
 #define  VerifyFatal( _exp )         AssertFatal( _exp )
                                      ^
/home/vagrant/GameNetworkingSockets/src/common/crypto.cpp:331:2: note: in expansion of macro ‘VerifyFatal’
  VerifyFatal(EVP_DigestSignUpdate(mdctx.ctx, pubData, cubData) == 1);
  ^
/home/vagrant/GameNetworkingSockets/src/common/crypto.cpp:334:40: error: request for member ‘ctx’ in ‘mdctx’, which is of non-class type ‘int’
  VerifyFatal(EVP_DigestSignFinal(mdctx.ctx, *pOutputDigest, &needed) == 1);
                                        ^
/home/vagrant/GameNetworkingSockets/src/public/tier0/dbg.h:307:11: note: in definition of macro ‘_AssertMsgSmall’
    if ( !(_exp) ) \
           ^
/home/vagrant/GameNetworkingSockets/src/public/tier0/dbg.h:339:38: note: in expansion of macro ‘AssertFatal’
 #define  VerifyFatal( _exp )         AssertFatal( _exp )
                                      ^
/home/vagrant/GameNetworkingSockets/src/common/crypto.cpp:334:2: note: in expansion of macro ‘VerifyFatal’
  VerifyFatal(EVP_DigestSignFinal(mdctx.ctx, *pOutputDigest, &needed) == 1);
  ^
At global scope:
cc1plus: warning: unrecognized command line option ‘-Wno-unused-const-variable’
cc1plus: warning: unrecognized command line option ‘-Wno-unused-local-typedef’
[9/67] Building CXX object CMakeFiles/GameNetworkingSockets_s.dir/common/opensslwrapper.o
ninja: build stopped: subcommand failed.
vagrant@vagrant:~/GameNetworkingSockets/build$

may be a separate issue?

from gamenetworkingsockets.

tycho avatar tycho commented on May 14, 2024

That might be a separate problem. What GCC and OpenSSL versions do you have in that environment?

from gamenetworkingsockets.

gregorypease280 avatar gregorypease280 commented on May 14, 2024

gcc (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609
OpenSSL 1.0.2g 1 Mar 2016

from gamenetworkingsockets.

nxrighthere avatar nxrighthere commented on May 14, 2024

@tycho I encountered the same problem with crypto.cpp right after today's changes in the code.

By the way, Protobuf_USE_STATIC_LIBS doesn't have any effect when checked in CMake, sodium_USE_STATIC_LIBS works fine. I verified this with dependency walker.

from gamenetworkingsockets.

tycho avatar tycho commented on May 14, 2024

The OpenSSL and GCC versions you have are super old, @gregorypease280. I wouldn't expect those to work at all.

What OpenSSL version are you using when you're compiling with Visual Studio? These don't happen for me with Visual Studio 2017 and OpenSSL 1.1.1a:

..\src\common\crypto.cpp(246): error C2065: 'EVP_MD_CTX_free': undeclared identifier
..\src\common\crypto.cpp(246): error C2975: 'CleanupFunc': invalid template argument for 'EVPCTXPointer', expected compile-time constant expression
..\src\common\crypto.cpp(49): note: see declaration of 'CleanupFunc'
..\src\common\crypto.cpp(324): error C2065: 'EVP_MD_CTX_free': undeclared identifier
..\src\common\crypto.cpp(324): error C2975: 'CleanupFunc': invalid template argument for 'EVPCTXPointer', expected compile-time constant expression
..\src\common\crypto.cpp(49): note: see declaration of 'CleanupFunc'

@nxrighthere Can you file a separate issue about the Protobuf_USE_STATIC_LIBS thing?

from gamenetworkingsockets.

gregorypease280 avatar gregorypease280 commented on May 14, 2024

@tycho my bad probably forgot to apt-get update, will do so and report back

from gamenetworkingsockets.

nxrighthere avatar nxrighthere commented on May 14, 2024

After updating OpenSSL to 1.1.1a, everything works fine now.

from gamenetworkingsockets.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.