Skip to content

import xmlsec causes error #48

Closed
Closed

Description

@mosasiru

I installed python-xmlsec 1.0.5 with pip. (imported by python3-saml).
import xmlsec causes below error.

Python 3.5.2 (default, Mar  7 2017, 17:22:35)
[GCC 4.8.3 20140911 (Red Hat 4.8.3-9)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import xmlsec
func=xmlSecCryptoDLLoadLibrary:file=dl.c:line=445:obj=unknown:subj=crypto != NULL:error=100:assertion:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
SystemError: null argument to internal routine

OS: Amazon Linux 2016.09
python 3.5.2.
installed package is below.

$ yum list | grep libxml
libxml2.x86_64                         2.9.1-6.3.49.amzn1           installed
libxml2-devel.x86_64                   2.9.1-6.3.49.amzn1           @amzn-main
libxml2-python27.x86_64                2.9.1-6.3.49.amzn1           installed
libxml++.i686                          2.30.0-1.el6                 epel
libxml++.x86_64                        2.30.0-1.el6                 epel
libxml++-devel.i686                    2.30.0-1.el6                 epel
libxml++-devel.x86_64                  2.30.0-1.el6                 epel
libxml2.i686                           2.9.1-6.3.49.amzn1           amzn-main
libxml2-python26.x86_64                2.9.1-6.3.49.amzn1           amzn-main
libxml2-static.x86_64                  2.9.1-6.3.49.amzn1           amzn-main
nodejs-libxmljs.x86_64                 0.8.1-3.el6                  epel
perl-libxml-perl.noarch                0.08-19.8.amzn1              amzn-main
$ yum list | grep xmlsec
xmlsec1.x86_64                         1.2.20-5.2.amzn1             @amzn-updates
xmlsec1-devel.x86_64                   1.2.20-5.2.amzn1             @amzn-updates
xmlsec1-gcrypt.x86_64                  1.2.20-5.2.amzn1             @amzn-updates
xmlsec1-gcrypt-devel.x86_64            1.2.20-5.2.amzn1             @amzn-updates
xmlsec1-gnutls.x86_64                  1.2.20-5.2.amzn1             @amzn-updates
xmlsec1-gnutls-devel.x86_64            1.2.20-5.2.amzn1             @amzn-updates
xmlsec1-openssl.x86_64                 1.2.20-5.2.amzn1             @amzn-updates
xmlsec1-openssl-devel.x86_64           1.2.20-5.2.amzn1             @amzn-updates
php-robrichards-xmlseclibs.noarch      2.0.1-1.el6                  epel
php-robrichards-xmlseclibs1.noarch     1.4.2-1.el6                  epel
php-xmlseclibs.noarch                  1.3.1-3.el6                  epel
pyxmlsec.x86_64                        0.3.0-6.el6                  epel
xmlsec1.i686                           1.2.20-5.2.amzn1             amzn-updates
xmlsec1-gcrypt.i686                    1.2.20-5.2.amzn1             amzn-updates
xmlsec1-gnutls.i686                    1.2.20-5.2.amzn1             amzn-updates
xmlsec1-nss.i686                       1.2.20-5.2.amzn1             amzn-updates
xmlsec1-nss.x86_64                     1.2.20-5.2.amzn1             amzn-updates
xmlsec1-nss-devel.x86_64               1.2.20-5.2.amzn1             amzn-updates
xmlsec1-openssl.i686                   1.2.20-5.2.amzn1             amzn-updates

Activity

  1. changed the title [-]require "xmlsec" cause error[/-] [+]import "xmlsec" cause error[/+] on Mar 7, 2017
  2. changed the title [-]import "xmlsec" cause error[/-] [+]import xmlsec causes error[/+] on Mar 7, 2017
  3. bgaifullin commented on Mar 7, 2017

    @bgaifullin
    Collaborator

    Hi @mosasiru. Thank you for issue report.
    Could you also provide output from the following command:
    pkg-config --cflags xmlsec1

  4. mosasiru commented on Mar 7, 2017

    @mosasiru
    Author

    thank you.

    $ pkg-config --cflags xmlsec1
    -DXMLSEC_CRYPTO=\"openssl\" -DXMLSEC_CRYPTO_DYNAMIC_LOADING=1 -D__XMLSEC_FUNCTION__=__FUNCTION__ -DXMLSEC_NO_SIZE_T -DXMLSEC_NO_GOST=1 -DXMLSEC_NO_XKMS=1 -DXMLSEC_DL_LIBLTDL=1 -I/usr/include/xmlsec1 -I/usr/include/libxml2
    
  5. bgaifullin commented on Mar 7, 2017

    @bgaifullin
    Collaborator

    @mosasiru , could you please check this PR #49

  6. bgaifullin commented on Mar 7, 2017

    @bgaifullin
    Collaborator

    you need to checkout source, update main.c according to PR, build xmlsec from sources and try again.

  7. mosasiru commented on Mar 7, 2017

    @mosasiru
    Author

    pip install failed. here is the part of error message.

    $ pip install .
    .
    .
        In file included from ./src/main.c:11:0:
        ./src/main.c: In function ‘PyXmlSec_Init’:
        <command-line>:0:15: error: ‘openssl’ undeclared (first use in this function)
        ./src/platform.h:30:34: note: in definition of macro ‘XSTR’
         #define XSTR(c) (const xmlChar*)(c)
                                          ^
        ./src/main.c:49:40: note: in expansion of macro ‘XMLSEC_CRYPTO’
             if (xmlSecCryptoDLLoadLibrary(XSTR(XMLSEC_CRYPTO)) < 0) {
                                                ^
        <command-line>:0:15: note: each undeclared identifier is reported only once for each function it appears in
        ./src/platform.h:30:34: note: in definition of macro ‘XSTR’
         #define XSTR(c) (const xmlChar*)(c)
                                          ^
        ./src/main.c:49:40: note: in expansion of macro ‘XMLSEC_CRYPTO’
             if (xmlSecCryptoDLLoadLibrary(XSTR(XMLSEC_CRYPTO)) < 0) {
                                                ^
        error: command 'gcc' failed with exit status 1
    
        ----------------------------------------
      Rolling back uninstall of xmlsec
    Command "/.../bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-r_odhzdn-build/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-1d5856s1-record/install-record.txt --single-version-externally-managed --compile --install-headers /.../include/site/python3.5/xmlsec" failed with error code 1 in /tmp/pip-r_odhzdn-build/```
    
  8. bgaifullin commented on Mar 7, 2017

    @bgaifullin
    Collaborator

    I have updated PR.
    PS
    Unfortunately this branch is not covered by tests and I do not have machine were xmlsec is configured for using dynamic loading. :(

  9. mosasiru commented on Mar 7, 2017

    @mosasiru
    Author

    thank you. error message changed.

        <command-line>:0:15: error: ‘openssl’ undeclared (first use in this function)
        ./src/main.c:49:52: note: in expansion of macro ‘XMLSEC_CRYPTO’
             if (xmlSecCryptoDLLoadLibrary((const xmlChar*) XMLSEC_CRYPTO) < 0) {
                                                            ^
        <command-line>:0:15: note: each undeclared identifier is reported only once for each function it appears in
        ./src/main.c:49:52: note: in expansion of macro ‘XMLSEC_CRYPTO’
             if (xmlSecCryptoDLLoadLibrary((const xmlChar*) XMLSEC_CRYPTO) < 0) {
                                                            ^
        error: command 'gcc' failed with exit status 1
    
        ----------------------------------------
      Rolling back uninstall of xmlsec
    
  10. bgaifullin commented on Mar 7, 2017

    @bgaifullin
    Collaborator

    update again :)

  11. mosasiru commented on Mar 7, 2017

    @mosasiru
    Author

    It works!! import xmlsec successed!
    Thank you very much!

  12. bgaifullin commented on Mar 7, 2017

    @bgaifullin
    Collaborator

    Thank you for help with addressing this.
    I will release new version with fix.

  13. added a commit that references this issue on Mar 7, 2017
  14. bgaifullin commented on Mar 7, 2017

    @bgaifullin
    Collaborator

    fixed in 1.0.6

  15. sindrig commented on Mar 10, 2017

    @sindrig

    Getting the same error on Manjaro.
    xmlsec1 v1.2.23
    libxml2 v2.9.4

    (venv) sindri->~ $ xmlsec1-config --cflags
    -D__XMLSEC_FUNCTION__=__func__ -DXMLSEC_NO_SIZE_T -DXMLSEC_NO_GOST=1 -DXMLSEC_NO_GOST2012=1 -DXMLSEC_DL_LIBLTDL=1 -I/usr/include/xmlsec1 -I/usr/include/libxml2 -DXMLSEC_CRYPTO_DYNAMIC_LOADING=1
    (venv) sindri->~ $ xmlsec1-config --crypto
    openssl
    (venv) sindri->~ $ xmlsec1-config --libdir
    /usr/lib
    (venv) sindri->~ $ pkg-config --cflags xmlsec1
    -DXMLSEC_CRYPTO_DYNAMIC_LOADING=1 -D__XMLSEC_FUNCTION__=__func__ -DXMLSEC_NO_SIZE_T -DXMLSEC_NO_GOST=1 -DXMLSEC_NO_GOST2012=1 -DXMLSEC_DL_LIBLTDL=1 -I/usr/include/xmlsec1 -I/usr/include/libxml2
    (venv) sindri->~ $ python
    Python 3.6.0 (default, Jan 16 2017, 12:12:55) 
    [GCC 6.3.1 20170109] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import xmlsec
    func=xmlSecCryptoDLLibraryCreate:file=dl.c:line=146:obj=lt_dlopenext:subj=unknown:error=7:io function failed:filename=libxmlsec1-(xmlSecGetDefaultCrypto())
    func=xmlSecCryptoDLGetLibraryFunctions:file=dl.c:line=499:obj=unknown:subj=xmlSecCryptoDLLibraryCreate:error=1:xmlsec library function failed:crypto=(xmlSecGetDefaultCrypto())
    func=xmlSecCryptoDLLoadLibrary:file=dl.c:line=449:obj=unknown:subj=xmlSecCryptoDLGetLibraryFunctions:error=1:xmlsec library function failed: 
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    SystemError: null argument to internal routine
    

    Only difference I see from @mosasiru's config is that I don't have -DXMLSEC_CRYPTO=\"openssl\" in the cflags.

  16. bgaifullin commented on Mar 10, 2017

    @bgaifullin
    Collaborator

    @sindrig thank you for report. I will provide fix soon.

  17. sindrig commented on Mar 10, 2017

    @sindrig

    Thanks, let me know if I can provide more info or help in any way 👍

  18. bgaifullin commented on Mar 10, 2017

    @bgaifullin
    Collaborator

    there is PR. #51

  19. bgaifullin commented on Mar 10, 2017

    @bgaifullin
    Collaborator

    @sindrig it would be great if you check that this fix works for you

  20. sindrig commented on Mar 10, 2017

    @sindrig

    Confirmed it works. Thanks for the brilliantly fast response!

  21. bgaifullin commented on Mar 10, 2017

    @bgaifullin
    Collaborator

    Fix released 1.0.7

  22. vioan commented on Apr 7, 2017

    @vioan

    It seems that I have the same error on SLES12:
    xmlsec (1.0.7)

    Python 3.4.1 (default, Jun 19 2014, 14:40:48) [GCC] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import xmlsec
    func=xmlSecCryptoDLLibraryCreate:file=dl.c:line=146:obj=lt_dlopenext:subj=unknown:error=7:io function failed:filename=libxmlsec1-openssl
    func=xmlSecCryptoDLGetLibraryFunctions:file=dl.c:line=499:obj=unknown:subj=xmlSecCryptoDLLibraryCreate:error=1:xmlsec library function failed:crypto=openssl
    func=xmlSecCryptoDLLoadLibrary:file=dl.c:line=449:obj=unknown:subj=xmlSecCryptoDLGetLibraryFunctions:error=1:xmlsec library function failed:
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    SystemError: null argument to internal routine
  23. bgaifullin commented on Apr 7, 2017

    @bgaifullin
    Collaborator

    Hi @vioan
    Please provide output of command pkg-config --cflags xmlsec1
    and check that libxmlsec1-openssl is available from LD_LIBRARY_PATH

  24. vioan commented on Apr 7, 2017

    @vioan

    Thanks a lot for the fast reply. I just installed libxmlsec1-openssl and now the import works. Here is also the output for pkg-config --cflags xmlsec1 after the installation of the mentioned package:

    -DXMLSEC_CRYPTO_DYNAMIC_LOADING=1 -D__XMLSEC_FUNCTION__=__func__ -DXMLSEC_NO_SIZE_T -DXMLSEC_NO_GOST=1 -DXMLSEC_NO_GOST2012=1 -DXMLSEC_DL_LIBLTDL=1 -I/usr/include/xmlsec1 -I/usr/include/libxml2
    
  25. bgaifullin commented on Apr 7, 2017

    @bgaifullin
    Collaborator

    You are welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      ⌂ Proxy