building lxml package on windows and python 3.13

Bug #2072404 reported by endmarsfr
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lxml
New
Undecided
Unassigned

Bug Description

When I run python setup.py build on windows 10 and python 3.13 :
Python : sys.version_info(major=3, minor=13, micro=0, releaselevel='beta', serial=3)
>>> print("%-20s: %s" % ('Python', sys.version_info))
Python : sys.version_info(major=3, minor=13, micro=0, releaselevel='beta', serial=3)
>>> print("%-20s: %s" % ('lxml.etree', etree.LXML_VERSION))
lxml.etree : (5, 2, 2, 0)
>>> print("%-20s: %s" % ('libxml used', etree.LIBXML_VERSION))
libxml used : (2, 11, 7)
>>> print("%-20s: %s" % ('libxml compiled', etree.LIBXML_COMPILED_VERSION))
libxml compiled : (2, 11, 7)
>>> print("%-20s: %s" % ('libxslt used', etree.LIBXSLT_VERSION))
libxslt used : (1, 1, 35)
>>> print("%-20s: %s" % ('libxslt compiled', etree.LIBXSLT_COMPILED_VERSION))
libxslt compiled : (1, 1, 35)

I got theses error, cannot link to lzma lib:

LINK : warning LNK4098: conflit entre la bibliothèque par défaut 'LIBCMT' et les autres bibliothèques ; utilisez /NODEFAULTLIB:library
libxml2.lib(xzlib.c.obj) : error LNK2001: symbole externe non résolu lzma_code
libxml2.lib(xzlib.c.obj) : error LNK2001: symbole externe non résolu lzma_end
libxml2.lib(xzlib.c.obj) : error LNK2001: symbole externe non résolu lzma_properties_decode
libxml2.lib(xzlib.c.obj) : error LNK2001: symbole externe non résolu lzma_auto_decoder
build\lib.win-amd64-cpython-313\lxml\etree.cp313-win_amd64.pyd : fatal error LNK1120: 4 externes non résolus
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.40.33807\\bin\\HostX86\\x64\\link.exe' failed with exit code 1120

I fixed the error with adding 'lzma' on libs in setupinfo.py :

if sys.platform in ('win32',):
        libs = ['libxslt', 'libexslt', 'libxml2', 'iconv', 'lzma']
        if OPTION_STATIC:
            libs = ['%s_a' % lib for lib in libs]
        libs.extend(['zlib', 'WS2_32'])
    elif OPTION_STATIC:
        libs = standard_libs
    else:
        libs = ['xslt', 'exslt', 'xml2'] + standard_libs
    return libs

Revision history for this message
endmarsfr (endmarsfr) wrote :
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.