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

Installation in Docker container with image python:3.7-alpine is not working #1

Closed
mvbrn opened this issue Aug 2, 2019 · 12 comments
Closed

Comments

@mvbrn
Copy link

mvbrn commented Aug 2, 2019

ERROR: Complete output from command /usr/local/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-web7qumj/pyheif/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-ue570lr7/install-record.txt --single-version-externally-managed --compile:
    ERROR: running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.7
    creating build/lib.linux-x86_64-3.7/pyheif
    copying pyheif/error.py -> build/lib.linux-x86_64-3.7/pyheif
    copying pyheif/reader.py -> build/lib.linux-x86_64-3.7/pyheif
    copying pyheif/constants.py -> build/lib.linux-x86_64-3.7/pyheif
    copying pyheif/__init__.py -> build/lib.linux-x86_64-3.7/pyheif
    copying pyheif/writer.py -> build/lib.linux-x86_64-3.7/pyheif
    running build_ext
    generating cffi module 'build/temp.linux-x86_64-3.7/_libheif_cffi.c'
    creating build/temp.linux-x86_64-3.7
    building '_libheif_cffi' extension
    creating build/temp.linux-x86_64-3.7/build
    creating build/temp.linux-x86_64-3.7/build/temp.linux-x86_64-3.7
    gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/local/include -I/usr/local/include/python3.7m -c build/temp.linux-x86_64-3.7/_libheif_cffi.c -o build/temp.linux-x86_64-3.7/build/temp.linux-x86_64-3.7/_libheif_cffi.o
    build/temp.linux-x86_64-3.7/_libheif_cffi.c:1063:37: error: return type is an incomplete type
     static enum heif_color_profile_type _cffi_d_heif_image_handle_get_color_profile_type(struct heif_image_handle const * x0)
                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    build/temp.linux-x86_64-3.7/_libheif_cffi.c: In function '_cffi_d_heif_image_handle_get_color_profile_type':
    build/temp.linux-x86_64-3.7/_libheif_cffi.c:1065:10: warning: implicit declaration of function 'heif_image_handle_get_color_profile_type'; did you mean '_cffi_d_heif_image_handle_get_color_profile_type'? [-Wimplicit-function-declaration]
       return heif_image_handle_get_color_profile_type(x0);
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
              _cffi_d_heif_image_handle_get_color_profile_type
    build/temp.linux-x86_64-3.7/_libheif_cffi.c:1065:10: warning: 'return' with a value, in function returning void
       return heif_image_handle_get_color_profile_type(x0);
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    build/temp.linux-x86_64-3.7/_libheif_cffi.c:1063:37: note: declared here
     static enum heif_color_profile_type _cffi_d_heif_image_handle_get_color_profile_type(struct heif_image_handle const * x0)
                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    build/temp.linux-x86_64-3.7/_libheif_cffi.c: In function '_cffi_f_heif_image_handle_get_color_profile_type':
    build/temp.linux-x86_64-3.7/_libheif_cffi.c:1073:32: error: storage size of 'result' isn't known
       enum heif_color_profile_type result;
                                    ^~~~~~
    build/temp.linux-x86_64-3.7/_libheif_cffi.c:1073:32: warning: unused variable 'result' [-Wunused-variable]
    build/temp.linux-x86_64-3.7/_libheif_cffi.c: In function '_cffi_d_heif_image_handle_get_raw_color_profile':
    build/temp.linux-x86_64-3.7/_libheif_cffi.c:1416:10: warning: implicit declaration of function 'heif_image_handle_get_raw_color_profile'; did you mean '_cffi_d_heif_image_handle_get_raw_color_profile'? [-Wimplicit-function-declaration]
       return heif_image_handle_get_raw_color_profile(x0, x1);
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
              _cffi_d_heif_image_handle_get_raw_color_profile
    build/temp.linux-x86_64-3.7/_libheif_cffi.c:1416:10: error: incompatible types when returning type 'int' but 'struct heif_error' was expected
       return heif_image_handle_get_raw_color_profile(x0, x1);
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    build/temp.linux-x86_64-3.7/_libheif_cffi.c: In function '_cffi_f_heif_image_handle_get_raw_color_profile':
    build/temp.linux-x86_64-3.7/_libheif_cffi.c:1456:12: error: incompatible types when assigning to type 'struct heif_error' from type 'int'
       { result = heif_image_handle_get_raw_color_profile(x0, x1); }
                ^
    build/temp.linux-x86_64-3.7/_libheif_cffi.c: In function '_cffi_d_heif_image_handle_get_raw_color_profile_size':
    build/temp.linux-x86_64-3.7/_libheif_cffi.c:1472:10: warning: implicit declaration of function 'heif_image_handle_get_raw_color_profile_size'; did you mean '_cffi_d_heif_image_handle_get_raw_color_profile_size'? [-Wimplicit-function-declaration]
       return heif_image_handle_get_raw_color_profile_size(x0);
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
              _cffi_d_heif_image_handle_get_raw_color_profile_size
    build/temp.linux-x86_64-3.7/_libheif_cffi.c: At top level:
    build/temp.linux-x86_64-3.7/_libheif_cffi.c:1750:58: error: invalid application of 'sizeof' to incomplete type 'enum heif_color_profile_type'
       { "heif_color_profile_type", 89, _cffi_prim_int(sizeof(enum heif_color_profile_type), ((enum heif_color_profile_type)-1) <= 0),
                                                              ^~~~
    build/temp.linux-x86_64-3.7/_libheif_cffi.c:464:7: note: in definition of macro '_cffi_prim_int'
         ((size) == 1 ? ((sign) ? _CFFI_PRIM_INT8  : _CFFI_PRIM_UINT8)  :    \
           ^~~~
    build/temp.linux-x86_64-3.7/_libheif_cffi.c:1750:96: error: conversion to incomplete type
       { "heif_color_profile_type", 89, _cffi_prim_int(sizeof(enum heif_color_profile_type), ((enum heif_color_profile_type)-1) <= 0),
                                                                                                    ^~~~~~~~~~~~~~~~~~~~~~~
    build/temp.linux-x86_64-3.7/_libheif_cffi.c:464:22: note: in definition of macro '_cffi_prim_int'
         ((size) == 1 ? ((sign) ? _CFFI_PRIM_INT8  : _CFFI_PRIM_UINT8)  :    \
                          ^~~~
    build/temp.linux-x86_64-3.7/_libheif_cffi.c:1750:58: error: invalid application of 'sizeof' to incomplete type 'enum heif_color_profile_type'
       { "heif_color_profile_type", 89, _cffi_prim_int(sizeof(enum heif_color_profile_type), ((enum heif_color_profile_type)-1) <= 0),
                                                              ^~~~
    build/temp.linux-x86_64-3.7/_libheif_cffi.c:465:7: note: in definition of macro '_cffi_prim_int'
          (size) == 2 ? ((sign) ? _CFFI_PRIM_INT16 : _CFFI_PRIM_UINT16) :    \
           ^~~~
    build/temp.linux-x86_64-3.7/_libheif_cffi.c:1750:96: error: conversion to incomplete type
       { "heif_color_profile_type", 89, _cffi_prim_int(sizeof(enum heif_color_profile_type), ((enum heif_color_profile_type)-1) <= 0),
                                                                                                    ^~~~~~~~~~~~~~~~~~~~~~~
    build/temp.linux-x86_64-3.7/_libheif_cffi.c:465:22: note: in definition of macro '_cffi_prim_int'
          (size) == 2 ? ((sign) ? _CFFI_PRIM_INT16 : _CFFI_PRIM_UINT16) :    \
                          ^~~~
    build/temp.linux-x86_64-3.7/_libheif_cffi.c:1750:58: error: invalid application of 'sizeof' to incomplete type 'enum heif_color_profile_type'
       { "heif_color_profile_type", 89, _cffi_prim_int(sizeof(enum heif_color_profile_type), ((enum heif_color_profile_type)-1) <= 0),
                                                              ^~~~
    build/temp.linux-x86_64-3.7/_libheif_cffi.c:466:7: note: in definition of macro '_cffi_prim_int'
          (size) == 4 ? ((sign) ? _CFFI_PRIM_INT32 : _CFFI_PRIM_UINT32) :    \
           ^~~~
    build/temp.linux-x86_64-3.7/_libheif_cffi.c:1750:96: error: conversion to incomplete type
       { "heif_color_profile_type", 89, _cffi_prim_int(sizeof(enum heif_color_profile_type), ((enum heif_color_profile_type)-1) <= 0),
                                                                                                    ^~~~~~~~~~~~~~~~~~~~~~~
    build/temp.linux-x86_64-3.7/_libheif_cffi.c:466:22: note: in definition of macro '_cffi_prim_int'
          (size) == 4 ? ((sign) ? _CFFI_PRIM_INT32 : _CFFI_PRIM_UINT32) :    \
                          ^~~~
    build/temp.linux-x86_64-3.7/_libheif_cffi.c:1750:58: error: invalid application of 'sizeof' to incomplete type 'enum heif_color_profile_type'
       { "heif_color_profile_type", 89, _cffi_prim_int(sizeof(enum heif_color_profile_type), ((enum heif_color_profile_type)-1) <= 0),
                                                              ^~~~
    build/temp.linux-x86_64-3.7/_libheif_cffi.c:467:7: note: in definition of macro '_cffi_prim_int'
          (size) == 8 ? ((sign) ? _CFFI_PRIM_INT64 : _CFFI_PRIM_UINT64) :    \
           ^~~~
    build/temp.linux-x86_64-3.7/_libheif_cffi.c:1750:96: error: conversion to incomplete type
       { "heif_color_profile_type", 89, _cffi_prim_int(sizeof(enum heif_color_profile_type), ((enum heif_color_profile_type)-1) <= 0),
                                                                                                    ^~~~~~~~~~~~~~~~~~~~~~~
    build/temp.linux-x86_64-3.7/_libheif_cffi.c:467:22: note: in definition of macro '_cffi_prim_int'
          (size) == 8 ? ((sign) ? _CFFI_PRIM_INT64 : _CFFI_PRIM_UINT64) :    \
                          ^~~~
    build/temp.linux-x86_64-3.7/_libheif_cffi.c: In function '_cffi_d_heif_image_handle_get_raw_color_profile':
    build/temp.linux-x86_64-3.7/_libheif_cffi.c:1417:1: warning: control reaches end of non-void function [-Wreturn-type]
     }
     ^
    build/temp.linux-x86_64-3.7/_libheif_cffi.c: In function '_cffi_f_heif_image_handle_get_color_profile_type':
    build/temp.linux-x86_64-3.7/_libheif_cffi.c:1094:1: warning: control reaches end of non-void function [-Wreturn-type]
     }
     ^
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command "/usr/local/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-web7qumj/pyheif/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-ue570lr7/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-web7qumj/pyheif/```
@ghost
Copy link

ghost commented Aug 3, 2019

Have you got libheif/heif.h in /usr/local/include? If it's located somewhere different correct the path at the bottom of libheif_build.py

@ghost ghost self-assigned this Aug 15, 2019
@fdoumet
Copy link

fdoumet commented Oct 22, 2019

Using the packaged libheif libraries (through apt-get) didn't work for me. Had to rebuild LibHeif in the Dockerfile as so before installing pyheif:

RUN git clone https://github.com/strukturag/libheif.git libheif \
    && cd libheif \
    && ./autogen.sh \
    && ./configure \
    && make -j4 \
    && make install \
    && ldconfig

@embolon
Copy link

embolon commented Nov 5, 2019

Got almost exactly the same error on rapsberry pi running debian buster. I install libheif-dev through apt-get. Didn't try rebuild libheif as @fdoumet mentioned.

@ghost
Copy link

ghost commented Nov 5, 2019

Please paste complete Dockerfile into the issue so I can reproduce.

@azin634
Copy link

azin634 commented Jan 27, 2020

I ran into this issue too using this docker image circleci/python:3.6-node. These are the packages I installed: libheif-dev libde265-dev x265

@azin634
Copy link

azin634 commented Jan 27, 2020

Also debian buster

@ghost
Copy link

ghost commented Feb 27, 2020

I've expanded the list of dirs searched for headers and libs by setup.py
Please try installing again directly from GitHub, e.g. pip install git+https://github.com/david-poirier-csn/pyheif.git

@buddylindsey
Copy link

I just wanted to add to this. Using pyheif and trying to install dependencies on github actions. I tried doing just using the github repo still had issues. I ended up needing to do the install and build from scratch per above. That combined with the git repo it worked well.

@ghost
Copy link

ghost commented Jul 7, 2020

Probably caused by an old version of libheif. Try updating or building from source if updates not available.

@ghost ghost closed this as completed Jul 7, 2020
@rajeabc
Copy link

rajeabc commented Jul 7, 2020

Hi
I am getting error on Mac. Could you please help me. Thanks


LIbheif.pdf

@azin634
Copy link

azin634 commented Jul 24, 2020

@david-poirier-csn something is still wrong on debian buster. Again it works if I manually build libheif-dev.

installing pyheif 0.5.1.
using this docker image circleci/python:3.6-node.
These are the packages I installed: libheif-dev libde265-dev x265 libffi-dev

I get this error:

  gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/include -I/usr/include -I/home/circleci/Cove/cove/venv/include -I/usr/local/include/python3.6m -c build/temp.linux-x86_64-3.6/_libheif_cffi.c -o build/temp.linux-x86_64-3.6/build/temp.linux-x86_64-3.6/_libheif_cffi.o
  build/temp.linux-x86_64-3.6/_libheif_cffi.c: In function ‘_cffi_const_heif_unknown_brand’:
  build/temp.linux-x86_64-3.6/_libheif_cffi.c:807:12: error: ‘heif_unknown_brand’ undeclared (first use in this function)
     int n = (heif_unknown_brand) <= 0;
              ^~~~~~~~~~~~~~~~~~
  build/temp.linux-x86_64-3.6/_libheif_cffi.c:807:12: note: each undeclared identifier is reported only once for each function it appears in
  build/temp.linux-x86_64-3.6/_libheif_cffi.c: In function ‘_cffi_const_heif_heic’:
  build/temp.linux-x86_64-3.6/_libheif_cffi.c:814:12: error: ‘heif_heic’ undeclared (first use in this function); did you mean ‘heif_writer’?
     int n = (heif_heic) <= 0;
              ^~~~~~~~~
              heif_writer
  build/temp.linux-x86_64-3.6/_libheif_cffi.c: In function ‘_cffi_const_heif_heix’:
  build/temp.linux-x86_64-3.6/_libheif_cffi.c:821:12: error: ‘heif_heix’ undeclared (first use in this function); did you mean ‘heif_writer’?
     int n = (heif_heix) <= 0;
              ^~~~~~~~~
              heif_writer
  build/temp.linux-x86_64-3.6/_libheif_cffi.c: In function ‘_cffi_const_heif_hevc’:
  build/temp.linux-x86_64-3.6/_libheif_cffi.c:828:12: error: ‘heif_hevc’ undeclared (first use in this function); did you mean ‘heif_chroma’?
     int n = (heif_hevc) <= 0;
              ^~~~~~~~~
              heif_chroma
  build/temp.linux-x86_64-3.6/_libheif_cffi.c: In function ‘_cffi_const_heif_hevx’:
  build/temp.linux-x86_64-3.6/_libheif_cffi.c:835:12: error: ‘heif_hevx’ undeclared (first use in this function); did you mean ‘heif_chroma’?
     int n = (heif_hevx) <= 0;
              ^~~~~~~~~
              heif_chroma
  build/temp.linux-x86_64-3.6/_libheif_cffi.c: In function ‘_cffi_const_heif_heim’:
  build/temp.linux-x86_64-3.6/_libheif_cffi.c:842:12: error: ‘heif_heim’ undeclared (first use in this function); did you mean ‘heif_chroma’?
     int n = (heif_heim) <= 0;
              ^~~~~~~~~
              heif_chroma
 <REDACTED. More of the above.>
    error: command 'gcc' failed with exit status 1

@sneawo
Copy link

sneawo commented Jul 26, 2020

I have the same errors in alpine

FROM python:3.7.6-alpine
RUN apk add --no-cache libffi-dev libheif-dev libde265-dev
RUN apk add --no-cache build-base
RUN pip3 install pyheif

ant32bit-carsales pushed a commit that referenced this issue Nov 16, 2021
Create profile from heif_color_profile_nclx struct, not pointer to pointer
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants