can't compile a file containting C-API

Bug #1939031 reported by Balsa Sarenac
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lxml
Fix Released
Medium
scoder

Bug Description

I was following a tutorial on writing external modules with Cython: https://lxml.de/capi.html#writing-external-modules-in-cython and couldn't compile the given example. Here is the error:

> python setup.py build_ext --inplace
running build_ext
building 'helloworld' extension
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30037\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -IC:\Users\Balsa\Envs\oll\lib\site-packages\lxml -IC:\Users\Balsa\Envs\oll\lib\site-packages\lxml\includes -IC:\Users\Balsa\Envs\oll\include -Ic:\users\balsa\appdata\local\programs\python\python36\include -Ic:\users\balsa\appdata\local\programs\python\python36\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30037\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30037\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt" /Tchelloworld.c /Fobuild\temp.win-amd64-3.6\Release\helloworld.obj
helloworld.c
C:\Users\Balsa\Envs\oll\lib\site-packages\lxml\includes\libxml/encoding.h(28): fatal error C1083: Cannot open include file: 'iconv.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Tools\\MSVC\\14.29.30037\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2

Versions:

Python : sys.version_info(major=3, minor=6, micro=8, releaselevel='final', serial=0)
lxml.etree : (4, 3, 2, 0)
libxml used : (2, 9, 5)
libxml compiled : (2, 9, 5)
libxslt used : (1, 1, 30)
libxslt compiled : (1, 1, 30)

Note: I have also tried with the newest version of lxml and the same error happened.

Balsa Sarenac (sarenac)
summary: - can't compile file with C-API
+ can't compile a file containting C-API
Revision history for this message
scoder (scoder) wrote :

Thanks for the report. It seems reasonable to include the libiconv header files in the static wheels, if they are a direct dependency of the libxml2 headers.

PR welcome. See "setup_extra_options()" in setup.py. Currently, it only includes the header files of libxml2 and libxslt, which etree directly depends on. libiconv should be added.

Changed in lxml:
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
scoder (scoder) wrote :
Changed in lxml:
assignee: nobody → scoder (scoder)
milestone: none → 4.7.0
status: Confirmed → Fix Committed
scoder (scoder)
Changed in lxml:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.