danielhrisca / asammdf

Fast Python reader and editor for ASAM MDF / MF4 (Measurement Data Format) files
GNU Lesser General Public License v3.0
649 stars 226 forks source link

Failed to install asammdf==6.4.4 in docker container #833

Closed Baby-Anran closed 1 year ago

Baby-Anran commented 1 year ago

Python version

('python=3.7.0 (default, Aug 9 2022, 12:49:01) \n' '[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]') 'os=Linux-3.10.0-1160.53.1.el7.x86_64-x86_64-with-centos-7.9.2009-Core' 'numpy=1.21.6'

Code

Traceback

  Building wheels for collected packages: asammdf
  Building wheel for asammdf (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for asammdf (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [174 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-37
      creating build/lib.linux-x86_64-cpython-37/asammdf
      copying asammdf/__init__.py -> build/lib.linux-x86_64-cpython-37/asammdf
      copying asammdf/signal.py -> build/lib.linux-x86_64-cpython-37/asammdf
      copying asammdf/version.py -> build/lib.linux-x86_64-cpython-37/asammdf
      copying asammdf/mdf.py -> build/lib.linux-x86_64-cpython-37/asammdf
      creating build/lib.linux-x86_64-cpython-37/asammdf/blocks
      copying asammdf/blocks/mdf_common.py -> build/lib.linux-x86_64-cpython-37/asammdf/blocks
      copying asammdf/blocks/v2_v3_blocks.py -> build/lib.linux-x86_64-cpython-37/asammdf/blocks
      copying asammdf/blocks/conversion_utils.py -> build/lib.linux-x86_64-cpython-37/asammdf/blocks
      copying asammdf/blocks/v2_v3_constants.py -> build/lib.linux-x86_64-cpython-37/asammdf/blocks
      copying asammdf/blocks/v4_blocks.py -> build/lib.linux-x86_64-cpython-37/asammdf/blocks
      copying asammdf/blocks/__init__.py -> build/lib.linux-x86_64-cpython-37/asammdf/blocks
      copying asammdf/blocks/mdf_v2.py -> build/lib.linux-x86_64-cpython-37/asammdf/blocks
      copying asammdf/blocks/mdf_v4.py -> build/lib.linux-x86_64-cpython-37/asammdf/blocks
      copying asammdf/blocks/utils.py -> build/lib.linux-x86_64-cpython-37/asammdf/blocks
      copying asammdf/blocks/encryption.py -> build/lib.linux-x86_64-cpython-37/asammdf/blocks
      copying asammdf/blocks/mdf_v3.py -> build/lib.linux-x86_64-cpython-37/asammdf/blocks
      copying asammdf/blocks/v4_constants.py -> build/lib.linux-x86_64-cpython-37/asammdf/blocks
      copying asammdf/blocks/bus_logging_utils.py -> build/lib.linux-x86_64-cpython-37/asammdf/blocks
      copying asammdf/blocks/source_utils.py -> build/lib.linux-x86_64-cpython-37/asammdf/blocks
      creating build/lib.linux-x86_64-cpython-37/asammdf/gui
      copying asammdf/gui/__init__.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui
      copying asammdf/gui/asammdfgui.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui
      copying asammdf/gui/utils.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui
      copying asammdf/gui/cx.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui
      copying asammdf/gui/plot.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui
      creating build/lib.linux-x86_64-cpython-37/asammdf/gui/ui
      copying asammdf/gui/ui/channel_display_widget.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/ui
      copying asammdf/gui/ui/main_window.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/ui
      copying asammdf/gui/ui/file_widget.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/ui
      copying asammdf/gui/ui/values_dialog.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/ui
      copying asammdf/gui/ui/channel_info_widget.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/ui
      copying asammdf/gui/ui/__init__.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/ui
      copying asammdf/gui/ui/windows_selection_dialog.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/ui
      copying asammdf/gui/ui/gps.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/ui
      copying asammdf/gui/ui/range_editor_dialog.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/ui
      copying asammdf/gui/ui/channel_group_info_widget.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/ui
      copying asammdf/gui/ui/error_dialog.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/ui
      copying asammdf/gui/ui/multi_search_dialog.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/ui
      copying asammdf/gui/ui/database_item.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/ui
      copying asammdf/gui/ui/resource_rc.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/ui
      copying asammdf/gui/ui/tabular.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/ui
      copying asammdf/gui/ui/attachment.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/ui
      copying asammdf/gui/ui/channel_bar_display_widget.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/ui
      copying asammdf/gui/ui/bar.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/ui
      copying asammdf/gui/ui/batch_widget.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/ui
      copying asammdf/gui/ui/channel_group_display_widget.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/ui
      copying asammdf/gui/ui/define_channel_dialog.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/ui
      copying asammdf/gui/ui/numeric.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/ui
      copying asammdf/gui/ui/search_dialog.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/ui
      copying asammdf/gui/ui/tabular_filter.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/ui
      copying asammdf/gui/ui/channel_stats.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/ui
      creating build/lib.linux-x86_64-cpython-37/asammdf/gui/widgets
      copying asammdf/gui/widgets/mdi_area.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/widgets
      copying asammdf/gui/widgets/batch.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/widgets
      copying asammdf/gui/widgets/tree_item.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/widgets
      copying asammdf/gui/widgets/__init__.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/widgets
      copying asammdf/gui/widgets/search.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/widgets
      copying asammdf/gui/widgets/channel_display.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/widgets
      copying asammdf/gui/widgets/list.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/widgets
      copying asammdf/gui/widgets/gps.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/widgets
      copying asammdf/gui/widgets/channel_bar_display.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/widgets
      copying asammdf/gui/widgets/list_item.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/widgets
      copying asammdf/gui/widgets/tabular_base.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/widgets
      copying asammdf/gui/widgets/main.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/widgets
      copying asammdf/gui/widgets/channel_group_display.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/widgets
      copying asammdf/gui/widgets/channel_group_info.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/widgets
      copying asammdf/gui/widgets/file.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/widgets
      copying asammdf/gui/widgets/cursor.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/widgets
      copying asammdf/gui/widgets/plot.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/widgets
      copying asammdf/gui/widgets/dict_to_tree.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/widgets
      copying asammdf/gui/widgets/database_item.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/widgets
      copying asammdf/gui/widgets/tabular.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/widgets
      copying asammdf/gui/widgets/lin_bus_trace.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/widgets
      copying asammdf/gui/widgets/attachment.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/widgets
      copying asammdf/gui/widgets/can_bus_trace.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/widgets
      copying asammdf/gui/widgets/bar.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/widgets
      copying asammdf/gui/widgets/formated_axis.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/widgets
      copying asammdf/gui/widgets/tree.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/widgets
      copying asammdf/gui/widgets/channel_info.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/widgets
      copying asammdf/gui/widgets/collapsiblebox.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/widgets
      copying asammdf/gui/widgets/numeric.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/widgets
      copying asammdf/gui/widgets/plot_standalone.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/widgets
      copying asammdf/gui/widgets/tabular_filter.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/widgets
      copying asammdf/gui/widgets/tree_numeric.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/widgets
      copying asammdf/gui/widgets/channel_stats.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/widgets
      creating build/lib.linux-x86_64-cpython-37/asammdf/gui/dialogs
      copying asammdf/gui/dialogs/__init__.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/dialogs
      copying asammdf/gui/dialogs/multi_search.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/dialogs
      copying asammdf/gui/dialogs/channel_group_info.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/dialogs
      copying asammdf/gui/dialogs/window_selection_dialog.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/dialogs
      copying asammdf/gui/dialogs/define_channel.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/dialogs
      copying asammdf/gui/dialogs/error_dialog.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/dialogs
      copying asammdf/gui/dialogs/tabular.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/dialogs
      copying asammdf/gui/dialogs/advanced_search.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/dialogs
      copying asammdf/gui/dialogs/channel_info.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/dialogs
      copying asammdf/gui/dialogs/range_editor.py -> build/lib.linux-x86_64-cpython-37/asammdf/gui/dialogs
      running egg_info
      writing asammdf.egg-info/PKG-INFO
      writing dependency_links to asammdf.egg-info/dependency_links.txt
      writing entry points to asammdf.egg-info/entry_points.txt
      writing requirements to asammdf.egg-info/requires.txt
      writing top-level names to asammdf.egg-info/top_level.txt
      reading manifest file 'asammdf.egg-info/SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      adding license file 'LICENSE'
      writing manifest file 'asammdf.egg-info/SOURCES.txt'
      copying asammdf/blocks/cutils.c -> build/lib.linux-x86_64-cpython-37/asammdf/blocks
      copying asammdf/gui/ui/attachment.ui -> build/lib.linux-x86_64-cpython-37/asammdf/gui/ui
      copying asammdf/gui/ui/bar.ui -> build/lib.linux-x86_64-cpython-37/asammdf/gui/ui
      copying asammdf/gui/ui/batch_widget.ui -> build/lib.linux-x86_64-cpython-37/asammdf/gui/ui
      copying asammdf/gui/ui/channel_bar_display_widget.ui -> build/lib.linux-x86_64-cpython-37/asammdf/gui/ui
      copying asammdf/gui/ui/channel_display_widget.ui -> build/lib.linux-x86_64-cpython-37/asammdf/gui/ui
      copying asammdf/gui/ui/channel_group_display_widget.ui -> build/lib.linux-x86_64-cpython-37/asammdf/gui/ui
      copying asammdf/gui/ui/channel_group_info_widget.ui -> build/lib.linux-x86_64-cpython-37/asammdf/gui/ui
      copying asammdf/gui/ui/channel_info_widget.ui -> build/lib.linux-x86_64-cpython-37/asammdf/gui/ui
      copying asammdf/gui/ui/channel_stats.ui -> build/lib.linux-x86_64-cpython-37/asammdf/gui/ui
      copying asammdf/gui/ui/database_item.ui -> build/lib.linux-x86_64-cpython-37/asammdf/gui/ui
      copying asammdf/gui/ui/define_channel_dialog.ui -> build/lib.linux-x86_64-cpython-37/asammdf/gui/ui
      copying asammdf/gui/ui/error_dialog.ui -> build/lib.linux-x86_64-cpython-37/asammdf/gui/ui
      copying asammdf/gui/ui/file_widget.ui -> build/lib.linux-x86_64-cpython-37/asammdf/gui/ui
      copying asammdf/gui/ui/gps.ui -> build/lib.linux-x86_64-cpython-37/asammdf/gui/ui
      copying asammdf/gui/ui/main_window.ui -> build/lib.linux-x86_64-cpython-37/asammdf/gui/ui
      copying asammdf/gui/ui/multi_search_dialog.ui -> build/lib.linux-x86_64-cpython-37/asammdf/gui/ui
      copying asammdf/gui/ui/numeric.ui -> build/lib.linux-x86_64-cpython-37/asammdf/gui/ui
      copying asammdf/gui/ui/range_editor_dialog.ui -> build/lib.linux-x86_64-cpython-37/asammdf/gui/ui
      copying asammdf/gui/ui/resource.qrc -> build/lib.linux-x86_64-cpython-37/asammdf/gui/ui
      copying asammdf/gui/ui/search_dialog.ui -> build/lib.linux-x86_64-cpython-37/asammdf/gui/ui
      copying asammdf/gui/ui/tabular.ui -> build/lib.linux-x86_64-cpython-37/asammdf/gui/ui
      copying asammdf/gui/ui/tabular_filter.ui -> build/lib.linux-x86_64-cpython-37/asammdf/gui/ui
      copying asammdf/gui/ui/values_dialog.ui -> build/lib.linux-x86_64-cpython-37/asammdf/gui/ui
      copying asammdf/gui/ui/windows_selection_dialog.ui -> build/lib.linux-x86_64-cpython-37/asammdf/gui/ui
      running build_ext
      building 'asammdf.blocks.cutils' extension
      creating build/temp.linux-x86_64-cpython-37
      creating build/temp.linux-x86_64-cpython-37/asammdf
      creating build/temp.linux-x86_64-cpython-37/asammdf/blocks
      gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tmp/pip-build-env-0x28p369/overlay/lib/python3.7/site-packages/numpy/core/include -I/usr/local/sbin/python-3.7/include/python3.7m -c asammdf/blocks/cutils.c -o build/temp.linux-x86_64-cpython-37/asammdf/blocks/cutils.o
      In file included from /tmp/pip-build-env-0x28p369/overlay/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1969:0,
                       from /tmp/pip-build-env-0x28p369/overlay/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,
                       from /tmp/pip-build-env-0x28p369/overlay/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,
                       from asammdf/blocks/cutils.c:2:
      /tmp/pip-build-env-0x28p369/overlay/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
       #warning "Using deprecated NumPy API, disable it with " \
        ^
      asammdf/blocks/cutils.c: In function 'sort_data_block':
      asammdf/blocks/cutils.c:69:13: error: 'for' loop initial declarations are only allowed in C99 mode
                   for (unsigned char i=0; i<id_size; i++, buf++) {
                   ^
      asammdf/blocks/cutils.c:69:13: note: use option -std=c99 or -std=gnu99 to compile your code
      asammdf/blocks/cutils.c:28:53: warning: unused variable 'tgt' [-Wunused-variable]
           unsigned long long id_size=0, position=0, size, tgt=10000;
                                                           ^
      asammdf/blocks/cutils.c: In function 'extract':
      asammdf/blocks/cutils.c:175:13: warning: unused variable 'retval' [-Wunused-variable]
               int retval = PyBytes_AsStringAndSize(signal_data, &buf, &max_size);
                   ^
      asammdf/blocks/cutils.c:163:11: warning: unused variable 'addr' [-Wunused-variable]
           void *addr;
                 ^
      asammdf/blocks/cutils.c: In function 'lengths':
      asammdf/blocks/cutils.c:274:9: warning: unused variable 'pos' [-Wunused-variable]
           int pos=0;
               ^
      asammdf/blocks/cutils.c: In function 'get_vlsd_offsets':
      asammdf/blocks/cutils.c:306:9: warning: unused variable 'pos' [-Wunused-variable]
           int pos=0;
               ^
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for asammdf
Failed to build asammdf
ERROR: Could not build wheels for asammdf, which is required to install pyproject.toml-based projects

Description

My docker container is based on centos7, and has been installed python 3.7, in which I failed to pip install asammdf==6.4.4.

danielhrisca commented 1 year ago

I guess you need to update gcc

JulienGrv commented 1 year ago

Hi @Baby-Anran,

look at the error. It's regarding the for loop. The variable declaration within the for loop is not supported. Just move unsigned char i to it's own line before the for loop and it should be good. You can open a pull request with this change if it worked

Edit: as Daniel pointed out, updating gcc would also be a good solution. Updating python would also be helpful if you want to use the latest releases of asammdf.

christoph2 commented 1 year ago

An update is probably not required -- the compiler is obviously running in C90 mode.
As a quick fix I would suggest:

Change setup.py from:

def _get_ext_modules():
    modules = [
        Extension(
            "asammdf.blocks.cutils",
            ["src/asammdf/blocks/cutils.c"],
            include_dirs=[get_include()],
        )
    ]

    return modules

to:

def _get_ext_modules():
    modules = [
        Extension(
            "asammdf.blocks.cutils",
            ["src/asammdf/blocks/cutils.c"],
            include_dirs=[get_include()],
            extra_compile_args=['-std=c99']
        )
    ]

    return modules

Works with gcc and clang, ignored (and not required) by MSVC.

danielhrisca commented 1 year ago

@Baby-Anran does the development branch code work now?