gem5-dev@gem5.org

The gem5 Developer List

View all threads

[S] Change in gem5/gem5[develop]: scons: Use pkgconfig to get correct Protobuf dependency

YW
Yu-hsin Wang (Gerrit)
Tue, Jul 4, 2023 9:41 AM

Yu-hsin Wang has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/72039?usp=email )

Change subject: scons: Use pkgconfig to get correct Protobuf dependency
......................................................................

scons: Use pkgconfig to get correct Protobuf dependency

Latest protobuf library depends on abseil libraries. We should rely on
pkgconfig to give us correct dependency. We still keep the old check as
fallback.

Change-Id: I529ea1f61e5bbc16b2520ab1badff3d8264f1c33

M src/proto/SConsopts
1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/src/proto/SConsopts b/src/proto/SConsopts
index 6b5b25d..fab29bc 100644
--- a/src/proto/SConsopts
+++ b/src/proto/SConsopts
@@ -50,14 +50,6 @@
warning('protoc version', min_protoc_version, 'or newer
required.\n'
'Installed version:', protoc_version[1])
else:

  •    # Attempt to determine the appropriate include path and
    
  •    # library path using pkg-config, that means we also need to
    
  •    # check for pkg-config. Note that it is possible to use
    
  •    # protobuf without the involvement of pkg-config. Later on we
    
  •    # check go a library config check and at that point the test
    
  •    # will fail if libprotobuf cannot be found.
    
  •    if conf.env['HAVE_PKG_CONFIG']:
    
  •        conf.CheckPkgConfig('protobuf', '--cflags', '--libs-only-L')
        conf.env['HAVE_PROTOC'] = True
    
    # If we have the protobuf compiler, also make sure we have the
    

@@ -65,9 +57,11 @@
# automatically added to the LIBS environment variable. After
# this, we can use the HAVE_PROTOBUF flag to determine if we have
# got both protoc and libprotobuf available.

  • conf.env['CONF']['HAVE_PROTOBUF'] = conf.env['HAVE_PROTOC'] and \
  • conf.env['CONF']['HAVE_PROTOBUF'] = conf.env['HAVE_PROTOC'] and (
  •    (conf.env['HAVE_PKG_CONFIG'] and
    
  •     conf.CheckPkgConfig('protobuf', '--cflags', '--libs')) or
        conf.CheckLibWithHeader('protobuf', 'google/protobuf/message.h',
    
  •                            'C++', 'GOOGLE_PROTOBUF_VERIFY_VERSION;')
    
  •                            'C++', 'GOOGLE_PROTOBUF_VERIFY_VERSION;'))
    

    If we have the compiler but not the library, print another warning.

    if main['HAVE_PROTOC'] and not main['CONF']['HAVE_PROTOBUF']:

--
To view, visit
https://gem5-review.googlesource.com/c/public/gem5/+/72039?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I529ea1f61e5bbc16b2520ab1badff3d8264f1c33
Gerrit-Change-Number: 72039
Gerrit-PatchSet: 1
Gerrit-Owner: Yu-hsin Wang yuhsingw@google.com

Yu-hsin Wang has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/72039?usp=email ) Change subject: scons: Use pkgconfig to get correct Protobuf dependency ...................................................................... scons: Use pkgconfig to get correct Protobuf dependency Latest protobuf library depends on abseil libraries. We should rely on pkgconfig to give us correct dependency. We still keep the old check as fallback. Change-Id: I529ea1f61e5bbc16b2520ab1badff3d8264f1c33 --- M src/proto/SConsopts 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/proto/SConsopts b/src/proto/SConsopts index 6b5b25d..fab29bc 100644 --- a/src/proto/SConsopts +++ b/src/proto/SConsopts @@ -50,14 +50,6 @@ warning('protoc version', min_protoc_version, 'or newer required.\n' 'Installed version:', protoc_version[1]) else: - # Attempt to determine the appropriate include path and - # library path using pkg-config, that means we also need to - # check for pkg-config. Note that it is possible to use - # protobuf without the involvement of pkg-config. Later on we - # check go a library config check and at that point the test - # will fail if libprotobuf cannot be found. - if conf.env['HAVE_PKG_CONFIG']: - conf.CheckPkgConfig('protobuf', '--cflags', '--libs-only-L') conf.env['HAVE_PROTOC'] = True # If we have the protobuf compiler, also make sure we have the @@ -65,9 +57,11 @@ # automatically added to the LIBS environment variable. After # this, we can use the HAVE_PROTOBUF flag to determine if we have # got both protoc and libprotobuf available. - conf.env['CONF']['HAVE_PROTOBUF'] = conf.env['HAVE_PROTOC'] and \ + conf.env['CONF']['HAVE_PROTOBUF'] = conf.env['HAVE_PROTOC'] and ( + (conf.env['HAVE_PKG_CONFIG'] and + conf.CheckPkgConfig('protobuf', '--cflags', '--libs')) or conf.CheckLibWithHeader('protobuf', 'google/protobuf/message.h', - 'C++', 'GOOGLE_PROTOBUF_VERIFY_VERSION;') + 'C++', 'GOOGLE_PROTOBUF_VERIFY_VERSION;')) # If we have the compiler but not the library, print another warning. if main['HAVE_PROTOC'] and not main['CONF']['HAVE_PROTOBUF']: -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/72039?usp=email To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: public/gem5 Gerrit-Branch: develop Gerrit-Change-Id: I529ea1f61e5bbc16b2520ab1badff3d8264f1c33 Gerrit-Change-Number: 72039 Gerrit-PatchSet: 1 Gerrit-Owner: Yu-hsin Wang <yuhsingw@google.com>