tpm2-software / tpm2-pytss

Python bindings for TSS
https://tpm2-pytss.readthedocs.io/en/latest/
BSD 2-Clause "Simplified" License
62 stars 45 forks source link

can not install on ubuntu 22.04 #570

Closed josh20170311 closed 3 months ago

josh20170311 commented 5 months ago
ubuntu@ubuntu-vm:~$ uname -a
Linux ubuntu-vm 6.5.0-27-generic #28~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Mar 15 10:51:06 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
ubuntu@ubuntu-vm:~$ pip3 install tpm2-pytss
Defaulting to user installation because normal site-packages is not writeable
Collecting tpm2-pytss
  Using cached tpm2-pytss-2.2.1.tar.gz (208 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [61 lines of output]
      /tmp/pip-build-env-od6zhajc/overlay/local/lib/python3.10/dist-packages/setuptools_scm/_integration/setuptools.py:30: RuntimeWarning:
      ERROR: setuptools==59.6.0 is used in combination with setuptools_scm>=8.x

      Your build configuration is incomplete and previously worked by accident!
      setuptools_scm requires setuptools>=61

      Suggested workaround if applicable:
       - migrating from the deprecated setup_requires mechanism to pep517/518
         and using a pyproject.toml to declare build dependencies
         which are reliably pre-installed before running the build tools

        warnings.warn(
      adding path: /tmp/pip-install-8pyig6_n/tpm2-pytss_935acbc0407c4f19803363a2c5866332/scripts
      Traceback (most recent call last):
        File "/usr/lib/python3/dist-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
          main()
        File "/usr/lib/python3/dist-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/usr/lib/python3/dist-packages/pip/_vendor/pep517/in_process/_in_process.py", line 164, in prepare_metadata_for_build_wheel
          return hook(metadata_directory, config_settings)
        File "/usr/lib/python3/dist-packages/setuptools/build_meta.py", line 174, in prepare_metadata_for_build_wheel
          self.run_setup()
        File "/usr/lib/python3/dist-packages/setuptools/build_meta.py", line 158, in run_setup
          exec(compile(code, __file__, 'exec'), locals())
        File "setup.py", line 285, in <module>
          setup(
        File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 153, in setup
          return distutils.core.setup(**attrs)
        File "/usr/lib/python3/dist-packages/setuptools/_distutils/core.py", line 109, in setup
          _setup_distribution = dist = klass(attrs)
        File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 459, in __init__
          _Distribution.__init__(
        File "/usr/lib/python3/dist-packages/setuptools/_distutils/dist.py", line 293, in __init__
          self.finalize_options()
        File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 837, in finalize_options
          ep(self)
        File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 858, in _finalize_setup_keywords
          ep.load()(self, ep.name, value)
        File "/tmp/pip-build-env-od6zhajc/normal/local/lib/python3.10/dist-packages/cffi/setuptools_ext.py", line 216, in cffi_modules
          add_cffi_module(dist, cffi_module)
        File "/tmp/pip-build-env-od6zhajc/normal/local/lib/python3.10/dist-packages/cffi/setuptools_ext.py", line 49, in add_cffi_module
          execfile(build_file_name, mod_vars)
        File "/tmp/pip-build-env-od6zhajc/normal/local/lib/python3.10/dist-packages/cffi/setuptools_ext.py", line 25, in execfile
          exec(code, glob, glob)
        File "scripts/libtss2_build.py", line 69, in <module>
          ffibuilder.cdef(open("libesys.h").read())
        File "/tmp/pip-build-env-od6zhajc/normal/local/lib/python3.10/dist-packages/cffi/api.py", line 112, in cdef
          self._cdef(csource, override=override, packed=packed, pack=pack)
        File "/tmp/pip-build-env-od6zhajc/normal/local/lib/python3.10/dist-packages/cffi/api.py", line 126, in _cdef
          self._parser.parse(csource, override=override, **options)
        File "/tmp/pip-build-env-od6zhajc/normal/local/lib/python3.10/dist-packages/cffi/cparser.py", line 389, in parse
          self._internal_parse(csource)
        File "/tmp/pip-build-env-od6zhajc/normal/local/lib/python3.10/dist-packages/cffi/cparser.py", line 396, in _internal_parse
          self._process_macros(macros)
        File "/tmp/pip-build-env-od6zhajc/normal/local/lib/python3.10/dist-packages/cffi/cparser.py", line 479, in _process_macros
          raise CDefError(
      cffi.CDefError: only supports one of the following syntax:
        #define TPM2_HR_PCR ...     (literally dot-dot-dot)
        #define TPM2_HR_PCR NUMBER  (with NUMBER an integer constant, decimal/hex/octal)
      got:
        #define TPM2_HR_PCR ...<< TPM2_HR_SHIFT)
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
whooo commented 5 months ago

Which version of tpm2-tss are you building against?

josh20170311 commented 5 months ago

Which version of tpm2-tss are you building against?

tpm2-tss 4.1.0-rc0-2-gfdb3594b

josh20170311 commented 5 months ago

run sudo ./configure --with-device=/dev/tpm0 and sudo make check-device

ubuntu@vm:~/tpm2-tss$ sudo ./configure  --with-device=/dev/tpm0 
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... /usr/bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking whether to enable debugging... info
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C11 features... none needed
checking whether gcc understands -c and -o together... yes
checking whether make supports the include directive... yes (GNU style)
checking dependency style of gcc... gcc3
checking for g++... g++
checking whether the compiler supports GNU C++... yes
checking whether g++ accepts -g... yes
checking for g++ option to enable C++11 features... none needed
checking dependency style of g++... gcc3
checking whether ln -s works... yes
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for wchar.h... yes
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking whether _XOPEN_SOURCE should be defined... no
checking whether byte ordering is bigendian... no
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /usr/bin/dd
checking how to truncate binary pipes... /usr/bin/dd bs=4096 count=1
checking for mt... mt
checking if mt is a manifest tool... no
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking how to run the C++ preprocessor... g++ -E
checking for ld used by g++... /usr/bin/ld -m elf_x86_64
checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC -DPIC
checking if g++ PIC flag -fPIC -DPIC works... yes
checking if g++ static flag -static works... yes
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (cached) yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking dynamic linker characteristics... (cached) GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking for gcc options needed to detect all undeclared functions... none needed
checking for library containing dlopen... none required
checking for dlerror... yes
checking for shl_load... no
checking for shl_load in -ldld... no
checking for dld_link in -ldld... no
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for strndup... yes
checking for reallocarray... yes
checking for libcrypto >= 1.1.0... yes
checking for EVP_sm3 in -lcrypto... yes
checking for EVP_sm4_cfb128 in -lcrypto... yes
checking for json-c >= 0.13... yes
checking for libcurl... yes
checking for curl_url_strerror in -lcurl... yes
checking for uuid... yes
checking for libtpms/tpm_library.h... no
configure: WARNING: library libtpms missing
checking for libusb-1.0... yes
checking for libusb-1.0/libusb.h... yes
checking for linux/ioctl.h... yes
checking for libftdi... yes
success
 20:04:07 up 58 min,  2 users,  load average: 0.19, 0.18, 0.18
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
checking for valgrind... no
checking if LD -Wl,--version-script works... yes
checking whether C compiler accepts -std=c99... yes
checking whether C compiler accepts -Wall... yes
checking whether C compiler accepts -Wextra... yes
checking whether C compiler accepts -Wformat-security... yes
checking whether C compiler accepts -Werror... yes
checking whether C compiler accepts -fstack-protector-all... yes
checking whether C compiler accepts -fpic... yes
checking whether C compiler accepts -fPIC... yes
checking whether C compiler accepts -Wno-missing-braces... yes
checking whether C compiler accepts -Wstrict-overflow=5... yes
checking whether the linker accepts -Wl,--no-undefined... yes
checking whether the linker accepts -Wl,-z,noexecstack... yes
checking whether the linker accepts -Wl,-z,now... yes
checking whether the linker accepts -Wl,-z,relro... yes
checking for systemd-sysusers... yes
checking for systemd-tmpfiles... yes
checking for doxygen... /usr/bin/doxygen
checking for perl... /usr/bin/perl
checking whether to build with code coverage support... no
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating Doxyfile
config.status: creating lib/tss2-sys.pc
config.status: creating lib/tss2-esys.pc
config.status: creating lib/tss2-mu.pc
config.status: creating lib/tss2-tcti-device.pc
config.status: creating lib/tss2-tcti-mssim.pc
config.status: creating lib/tss2-tcti-swtpm.pc
config.status: creating lib/tss2-tcti-pcap.pc
config.status: creating lib/tss2-tcti-libtpms.pc
config.status: creating lib/tss2-rc.pc
config.status: creating lib/tss2-tctildr.pc
config.status: creating lib/tss2-fapi.pc
config.status: creating lib/tss2-tcti-cmd.pc
config.status: creating lib/tss2-policy.pc
config.status: creating lib/tss2-tcti-spi-helper.pc
config.status: creating lib/tss2-tcti-spi-ltt2go.pc
config.status: creating lib/tss2-tcti-spidev.pc
config.status: creating lib/tss2-tcti-spi-ftdi.pc
config.status: creating lib/tss2-tcti-i2c-helper.pc
config.status: creating lib/tss2-tcti-i2c-ftdi.pc
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
config.status: executing libtool commands

    tpm2-tss 4.1.0-rc0-2-gfdb3594b
    esys:               yes
    fapi:               yes
    policy:             yes
    tctidefaultmodule:  libtss2-tcti-default.so
    tctidefaultconfig:  
    unit:               no
    integration:        no
    testing backend:    none
    fapi test profile:  P_ECC
    fuzzing:            none
    debug:              info
    maxloglevel:        trace
    doxygen:            1 
    crypto backend:     ossl
    sysconfdir:         ${prefix}/etc
    localstatedir:      ${prefix}/var
    runstatedir:        ${localstatedir}/run
    sysusersdir:        ${prefix}/etc/sysusers.d
    tmpfilesdir:        ${prefix}/etc/tmpfiles.d
    userstatedir:       $HOME/.local/share
    sysmeasurements:    /sys/kernel/security/tpm0/binary_bios_measurements
    imameasurements:    /sys/kernel/security/ima/binary_runtime_measurements
    tcti_spi_ltt2go      yes
    tcti_spidev         yes
    tcti_spi_ftdi       yes
    tcti_i2c_ftdi       yes

ubuntu@vm:~/tpm2-tss$ sudo make check-device
make -j1 check
make[1]: Entering directory '/home/ubuntu/tpm2-tss'
  DXGEN  Doxyfile
warning: Tag 'TCL_SUBST' at line 242 of file 'Doxyfile' has become obsolete.
         To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
warning: Tag 'COLS_IN_ALPHA_INDEX' at line 1155 of file 'Doxyfile' has become obsolete.
         To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
warning: Tag 'PERL_PATH' at line 2220 of file 'Doxyfile' has become obsolete.
         To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
warning: Tag 'MSCGEN_PATH' at line 2242 of file 'Doxyfile' has become obsolete.
         To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
/home/ubuntu/tpm2-tss/doc/doxygen.dox:986: warning: Documentation for undefined enum '_ESYS_STATE' found.
/home/ubuntu/tpm2-tss/doc/doxygen.dox:2174: warning: documented symbol 'void ifapi_flush_policy_session' was not declared or defined.
/home/ubuntu/tpm2-tss/doc/doxygen.dox:3139: warning: documented symbol 'TSS2_RC ifapi_get_intl_ek_certificate' was not declared or defined.
/home/ubuntu/tpm2-tss/README.md:20: warning: explicit link request to 'x2011' could not be resolved
/home/ubuntu/tpm2-tss/README.md:21: warning: explicit link request to 'x2011' could not be resolved
/home/ubuntu/tpm2-tss/README.md:22: warning: explicit link request to 'x2011' could not be resolved
/home/ubuntu/tpm2-tss/README.md:23: warning: explicit link request to 'x2011' could not be resolved
/home/ubuntu/tpm2-tss/README.md:24: warning: explicit link request to 'x2011' could not be resolved
/home/ubuntu/tpm2-tss/README.md:24: warning: explicit link request to 'x2011' could not be resolved
/home/ubuntu/tpm2-tss/README.md:24: warning: explicit link request to 'x2011' could not be resolved
/home/ubuntu/tpm2-tss/README.md:24: warning: explicit link request to 'x2011' could not be resolved
/home/ubuntu/tpm2-tss/README.md:24: warning: explicit link request to 'x2011' could not be resolved
/home/ubuntu/tpm2-tss/README.md:24: warning: explicit link request to 'x2011' could not be resolved
/home/ubuntu/tpm2-tss/README.md:24: warning: explicit link request to 'x2011' could not be resolved
/home/ubuntu/tpm2-tss/README.md:24: warning: unable to resolve reference to '/home/ubuntu/tpm2-tss/doc/tcti.md' for \ref command
/home/ubuntu/tpm2-tss/README.md:30: warning: unable to resolve reference to '/home/ubuntu/tpm2-tss/INSTALL.md' for \ref command
/home/ubuntu/tpm2-tss/README.md:41: warning: unable to resolve reference to '/home/ubuntu/tpm2-tss/CONTRIBUTING.md' for \ref command
/home/ubuntu/tpm2-tss/README.md:44: warning: unable to resolve reference to '/home/ubuntu/tpm2-tss/INSTALL.md' for \ref command
/home/ubuntu/tpm2-tss/README.md:77: warning: unable to resolve reference to '/home/ubuntu/tpm2-tss/INSTALL.md' for \ref command
/home/ubuntu/tpm2-tss/README.md:179: warning: unable to resolve reference to '/home/ubuntu/tpm2-tss/doc/fuzzing.md' for \ref command
/home/ubuntu/tpm2-tss/README.md:20: warning: explicit link request to 'x2011' could not be resolved
/home/ubuntu/tpm2-tss/README.md:21: warning: explicit link request to 'x2011' could not be resolved
/home/ubuntu/tpm2-tss/README.md:22: warning: explicit link request to 'x2011' could not be resolved
/home/ubuntu/tpm2-tss/README.md:23: warning: explicit link request to 'x2011' could not be resolved
/home/ubuntu/tpm2-tss/README.md:24: warning: explicit link request to 'x2011' could not be resolved
/home/ubuntu/tpm2-tss/README.md:24: warning: explicit link request to 'x2011' could not be resolved
/home/ubuntu/tpm2-tss/README.md:24: warning: explicit link request to 'x2011' could not be resolved
/home/ubuntu/tpm2-tss/README.md:24: warning: explicit link request to 'x2011' could not be resolved
/home/ubuntu/tpm2-tss/README.md:24: warning: explicit link request to 'x2011' could not be resolved
/home/ubuntu/tpm2-tss/README.md:24: warning: explicit link request to 'x2011' could not be resolved
/home/ubuntu/tpm2-tss/README.md:24: warning: explicit link request to 'x2011' could not be resolved
/home/ubuntu/tpm2-tss/README.md:24: warning: unable to resolve reference to '/home/ubuntu/tpm2-tss/doc/tcti.md' for \ref command
/home/ubuntu/tpm2-tss/README.md:30: warning: unable to resolve reference to '/home/ubuntu/tpm2-tss/INSTALL.md' for \ref command
/home/ubuntu/tpm2-tss/README.md:41: warning: unable to resolve reference to '/home/ubuntu/tpm2-tss/CONTRIBUTING.md' for \ref command
/home/ubuntu/tpm2-tss/README.md:44: warning: unable to resolve reference to '/home/ubuntu/tpm2-tss/INSTALL.md' for \ref command
/home/ubuntu/tpm2-tss/README.md:77: warning: unable to resolve reference to '/home/ubuntu/tpm2-tss/INSTALL.md' for \ref command
/home/ubuntu/tpm2-tss/README.md:179: warning: unable to resolve reference to '/home/ubuntu/tpm2-tss/doc/fuzzing.md' for \ref command
make        
make[2]: Entering directory '/home/ubuntu/tpm2-tss'
make  all-am
make[3]: Entering directory '/home/ubuntu/tpm2-tss'
make[3]: Leaving directory '/home/ubuntu/tpm2-tss'
make[2]: Leaving directory '/home/ubuntu/tpm2-tss'
make  check-TESTS
make[2]: Entering directory '/home/ubuntu/tpm2-tss'
make[3]: Entering directory '/home/ubuntu/tpm2-tss'
============================================================================
Testsuite summary for tpm2-tss 4.1.0-rc0-2-gfdb3594b
============================================================================
# TOTAL: 0
# PASS:  0
# SKIP:  0
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0
============================================================================
make[3]: Leaving directory '/home/ubuntu/tpm2-tss'
make[2]: Leaving directory '/home/ubuntu/tpm2-tss'
make[1]: Leaving directory '/home/ubuntu/tpm2-tss'
whooo commented 5 months ago

I suspect the issue is related to https://github.com/tpm2-software/tpm2-tss/commit/fdb3594b27aee315ad56af361512800266672582 Do you have that commit in your checked out repo?

josh20170311 commented 5 months ago

yes, my repo have that commit

ubuntu@vm:~/tpm2-tss$ git log
commit fdb3594b27aee315ad56af361512800266672582 (HEAD -> master, origin/master, origin/HEAD)
Author: Andreas Fuchs <andreas.fuchs@infineon.com>
Date:   Tue Apr 9 10:20:22 2024 +0200

    All: Fix left-shifts of signed vs unsigned constants

    In order to silence -fsanitize=undefined all left shifts of constants
    are now cast before shifting, in order to avoid undefined behavior,
    if the target variable is unsigned.

    Signed-off-by: Andreas Fuchs <andreas.fuchs@infineon.com>
whooo commented 5 months ago

I'll create a fix when I have some time, but could you try building tpm2-tss without that commit just to confirm?

josh20170311 commented 5 months ago

Thank you, I switched to tag 4.1.0-rc0 and pytss is successfully installed.

j30231 commented 5 months ago

I have too also problem.

jj@pp:~/tpm2-tss$ uname -a Linux pp 5.15.0-105-generic #115-Ubuntu SMP Mon Apr 15 09:52:04 UTC 2024 aarch64 aarch64 aarch64 GNU/Linux jj@pp:~/tpm2-tss$ pip3 install tpm2-pytss Defaulting to user installation because normal site-packages is not writeable Collecting tpm2-pytss Using cached tpm2-pytss-2.2.1.tar.gz (208 kB) Installing build dependencies ... done Getting requirements to build wheel ... done Installing backend dependencies ... done Preparing metadata (pyproject.toml) ... error error: subprocess-exited-with-error

× Preparing metadata (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [48 lines of output] /tmp/pip-build-env-2xd0_uc8/overlay/local/lib/python3.10/dist-packages/setuptools_scm/_integration/setuptools.py:30: RuntimeWarning: ERROR: setuptools==59.6.0 is used in combination with setuptools_scm>=8.x

  Your build configuration is incomplete and previously worked by accident!
  setuptools_scm requires setuptools>=61

  Suggested workaround if applicable:
   - migrating from the deprecated setup_requires mechanism to pep517/518
     and using a pyproject.toml to declare build dependencies
     which are reliably pre-installed before running the build tools

    warnings.warn(
  Traceback (most recent call last):
    File "/usr/lib/python3/dist-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
      main()
    File "/usr/lib/python3/dist-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/usr/lib/python3/dist-packages/pip/_vendor/pep517/in_process/_in_process.py", line 164, in prepare_metadata_for_build_wheel
      return hook(metadata_directory, config_settings)
    File "/usr/lib/python3/dist-packages/setuptools/build_meta.py", line 174, in prepare_metadata_for_build_wheel
      self.run_setup()
    File "/usr/lib/python3/dist-packages/setuptools/build_meta.py", line 158, in run_setup
      exec(compile(code, __file__, 'exec'), locals())
    File "setup.py", line 285, in <module>
      setup(
    File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 153, in setup
      return distutils.core.setup(**attrs)
    File "/usr/lib/python3/dist-packages/setuptools/_distutils/core.py", line 109, in setup
      _setup_distribution = dist = klass(attrs)
    File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 459, in __init__
      _Distribution.__init__(
    File "/usr/lib/python3/dist-packages/setuptools/_distutils/dist.py", line 293, in __init__
      self.finalize_options()
    File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 837, in finalize_options
      ep(self)
    File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 858, in _finalize_setup_keywords
      ep.load()(self, ep.name, value)
    File "/tmp/pip-build-env-2xd0_uc8/normal/local/lib/python3.10/dist-packages/cffi/setuptools_ext.py", line 216, in cffi_modules
      add_cffi_module(dist, cffi_module)
    File "/tmp/pip-build-env-2xd0_uc8/normal/local/lib/python3.10/dist-packages/cffi/setuptools_ext.py", line 49, in add_cffi_module
      execfile(build_file_name, mod_vars)
    File "/tmp/pip-build-env-2xd0_uc8/normal/local/lib/python3.10/dist-packages/cffi/setuptools_ext.py", line 25, in execfile
      exec(code, glob, glob)
    File "scripts/libtss2_build.py", line 3, in <module>
      ffibuilder = FFI()
    File "/tmp/pip-build-env-2xd0_uc8/normal/local/lib/python3.10/dist-packages/cffi/api.py", line 54, in __init__
      raise Exception("Version mismatch: this is the 'cffi' package version %s, located in %r.  When we import the top-level '_cffi_backend' extension module, we get version %s, located in %r.  The two versions should be equal; check your installation." % (
  Exception: Version mismatch: this is the 'cffi' package version 1.16.0, located in '/tmp/pip-build-env-2xd0_uc8/normal/local/lib/python3.10/dist-packages/cffi/api.py'.  When we import the top-level '_cffi_backend' extension module, we get version 1.15.0, located in '/usr/lib/python3/dist-packages/_cffi_backend.cpython-310-aarch64-linux-gnu.so'.  The two versions should be equal; check your installation.
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed

× Encountered error while generating package metadata. ╰─> See above for output.

note: This is an issue with the package mentioned above, not pip. hint: See above for details.

kloczek commented 4 months ago

I have the same issue with pep517 build with tpm2-tss 4.1.2.

+ /usr/bin/python3 -sBm build -w --no-isolation
* Getting build dependencies for wheel...
* Building wheel...
adding path: /home/tkloczko/rpmbuild/BUILD/tpm2-pytss-2.2.1/scripts
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
    main()
  File "/usr/lib/python3.10/site-packages/pyproject_hooks/_in_process/_in_process.py", line 335, in main
    json_out['return_val'] = hook(**hook_input['kwargs'])
  File "/usr/lib/python3.10/site-packages/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel
    return _build_backend().build_wheel(wheel_directory, config_settings,
  File "/usr/lib/python3.10/site-packages/setuptools/build_meta.py", line 410, in build_wheel
    return self._build_with_temp_dir(
  File "/usr/lib/python3.10/site-packages/setuptools/build_meta.py", line 395, in _build_with_temp_dir
    self.run_setup()
  File "/usr/lib/python3.10/site-packages/setuptools/build_meta.py", line 311, in run_setup
    exec(code, locals())
  File "<string>", line 285, in <module>
  File "/usr/lib/python3.10/site-packages/setuptools/__init__.py", line 104, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 146, in setup
    _setup_distribution = dist = klass(attrs)
  File "/usr/lib/python3.10/site-packages/setuptools/dist.py", line 307, in __init__
    _Distribution.__init__(self, dist_attrs)
  File "/usr/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 284, in __init__
    self.finalize_options()
  File "/usr/lib/python3.10/site-packages/setuptools/dist.py", line 658, in finalize_options
    ep(self)
  File "/usr/lib/python3.10/site-packages/setuptools/dist.py", line 678, in _finalize_setup_keywords
    ep.load()(self, ep.name, value)
  File "/usr/lib64/python3.10/site-packages/cffi/setuptools_ext.py", line 216, in cffi_modules
    add_cffi_module(dist, cffi_module)
  File "/usr/lib64/python3.10/site-packages/cffi/setuptools_ext.py", line 49, in add_cffi_module
    execfile(build_file_name, mod_vars)
  File "/usr/lib64/python3.10/site-packages/cffi/setuptools_ext.py", line 25, in execfile
    exec(code, glob, glob)
  File "scripts/libtss2_build.py", line 69, in <module>
    ffibuilder.cdef(open("libesys.h").read())
  File "/usr/lib64/python3.10/site-packages/cffi/api.py", line 112, in cdef
    self._cdef(csource, override=override, packed=packed, pack=pack)
  File "/usr/lib64/python3.10/site-packages/cffi/api.py", line 126, in _cdef
    self._parser.parse(csource, override=override, **options)
  File "/usr/lib64/python3.10/site-packages/cffi/cparser.py", line 386, in parse
    self._internal_parse(csource)
  File "/usr/lib64/python3.10/site-packages/cffi/cparser.py", line 393, in _internal_parse
    self._process_macros(macros)
  File "/usr/lib64/python3.10/site-packages/cffi/cparser.py", line 476, in _process_macros
    raise CDefError(
cffi.CDefError: only supports one of the following syntax:
  #define TPM2_HR_PCR ...     (literally dot-dot-dot)
  #define TPM2_HR_PCR NUMBER  (with NUMBER an integer constant, decimal/hex/octal)
got:
  #define TPM2_HR_PCR ...<< TPM2_HR_SHIFT)

ERROR Backend subprocess exited when trying to invoke build_wheel
kloczek commented 4 months ago

Looks like build has been fixed on master. Is it possible to release new version with those fixes? 🤔

whooo commented 3 months ago

I pushed a new release candidate, see https://pypi.org/project/tpm2-pytss/2.3.0rc0/

whooo commented 3 months ago

Closing as fixed in 2.3.0-rc0