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

link_objects in setup.cfg crashes build #44861

Closed
mschatte mannequin opened this issue Apr 18, 2007 · 11 comments
Closed

link_objects in setup.cfg crashes build #44861

mschatte mannequin opened this issue Apr 18, 2007 · 11 comments
Assignees
Labels
easy stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@mschatte
Copy link
Mannequin

mschatte mannequin commented Apr 18, 2007

BPO 1703178
Nosy @terryjreedy, @merwok, @bitdancer, @dstufft
Files
  • build_ext.diff
  • build_ext_v2.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/merwok'
    closed_at = <Date 2016-09-29.06:17:26.279>
    created_at = <Date 2007-04-18.19:03:11.000>
    labels = ['easy', 'type-bug', 'library']
    title = 'link_objects in setup.cfg crashes build'
    updated_at = <Date 2016-09-29.06:17:26.276>
    user = 'https://bugs.python.org/mschatte'

    bugs.python.org fields:

    activity = <Date 2016-09-29.06:17:26.276>
    actor = 'python-dev'
    assignee = 'eric.araujo'
    closed = True
    closed_date = <Date 2016-09-29.06:17:26.279>
    closer = 'python-dev'
    components = ['Distutils']
    creation = <Date 2007-04-18.19:03:11.000>
    creator = 'mschatte'
    dependencies = []
    files = ['36861', '37403']
    hgrepos = []
    issue_num = 1703178
    keywords = ['patch', 'easy']
    message_count = 11.0
    messages = ['31832', '113017', '158948', '228973', '229009', '232331', '232333', '232357', '232401', '233092', '277684']
    nosy_count = 9.0
    nosy_names = ['terry.reedy', 'mschatte', 'eric.araujo', 'r.david.murray', 'alexis', 'python-dev', 'dstufft', 'lambertv', 'bru']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue1703178'
    versions = ['Python 2.7', 'Python 3.4', 'Python 3.5']

    @mschatte
    Copy link
    Mannequin Author

    mschatte mannequin commented Apr 18, 2007

    When I put the following into setup.cfg:

    ---

    [build_ext]
    include_dirs = /home/mschatte/myPackages/XSB/config/i686-pc-linux-gnu:/home/mschatte/myPackages/XSB/emu
    link_objects = /home/mschatte/myPackages/XSB/config/i686-pc-linux-gnu/saved.o/xsb.o

    ---

    in order to link a c extension to another object which should reside on the users computer, I get the following error (tested on two kubuntu machines, python 2.4):

    # python setup.py build
    Distribution.parse_config_files():
      reading setup.cfg
    options (after parsing config files):
    option dict for 'build_ext' command:
      {'include_dirs': ('setup.cfg',
                        '/home/mschatte/myPackages/XSB/config/i686-pc-linux-gnu:/home/mschatte/myPackages/XSB/emu'),
       'link_objects': ('setup.cfg',
                        '/home/mschatte/myPackages/XSB/config/i686-pc-linux-gnu/saved.o/xsb.o')}
    options (after parsing command line):
    option dict for 'build' command:
      {}
    option dict for 'build_ext' command:
      {'include_dirs': ('setup.cfg',
                        '/home/mschatte/myPackages/XSB/config/i686-pc-linux-gnu:/home/mschatte/myPackages/XSB/emu'),
       'link_objects': ('setup.cfg',
                        '/home/mschatte/myPackages/XSB/config/i686-pc-linux-gnu/saved.o/xsb.o')}
    running build
    Distribution.get_command_obj(): creating 'build' command object
    running build_py
    Distribution.get_command_obj(): creating 'build_py' command object
    creating build
    creating build/lib.linux-i686-2.4
    copying dbms.py -> build/lib.linux-i686-2.4
    copying __init__.py -> build/lib.linux-i686-2.4
    copying f.py -> build/lib.linux-i686-2.4
    copying interface.py -> build/lib.linux-i686-2.4
    copying py2f.py -> build/lib.linux-i686-2.4
    copying reasonable.py -> build/lib.linux-i686-2.4
    creating build/lib.linux-i686-2.4/xsb_swig
    copying xsb_swig/__init__.py -> build/lib.linux-i686-2.4/xsb_swig
    copying xsb_swig/xsb.py -> build/lib.linux-i686-2.4/xsb_swig
    running build_ext
    Distribution.get_command_obj(): creating 'build_ext' command object
      setting options for 'build_ext' command:
        link_objects = /home/mschatte/myPackages/XSB/config/i686-pc-linux-gnu/saved.o/xsb.o (from setup.cfg)
        include_dirs = /home/mschatte/myPackages/XSB/config/i686-pc-linux-gnu:/home/mschatte/myPackages/XSB/emu (from setup.cfg)
    building 'xsb_swig._xsb' extension
    creating build/temp.linux-i686-2.4
    creating build/temp.linux-i686-2.4/xsb_swig
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O2 -Wall -Wstrict-prototypes -fPIC -I/home/mschatte/myPackages/XSB/config/i686-pc-linux-gnu -I/home/mschatte/myPackages/XSB/emu -I/usr/include/python2.4 -c xsb_swig/swig_xsb_wrap.c -o build/temp.linux-i686-2.4/xsb_swig/swig_xsb_wrap.o
    In file included from xsb_swig/swig_xsb.h:25,
                     from xsb_swig/swig_xsb_wrap.c:2346:
    /home/mschatte/myPackages/XSB/emu/cinterf.h:259: warning: function declaration isn’t a prototype
    /home/mschatte/myPackages/XSB/emu/cinterf.h:262: warning: function declaration isn’t a prototype
    /home/mschatte/myPackages/XSB/emu/cinterf.h:285: warning: function declaration isn’t a prototype
    /home/mschatte/myPackages/XSB/emu/cinterf.h:286: warning: function declaration isn’t a prototype
    /home/mschatte/myPackages/XSB/emu/cinterf.h:294: warning: function declaration isn’t a prototype
    /home/mschatte/myPackages/XSB/emu/cinterf.h:296: warning: function declaration isn’t a prototype
    /home/mschatte/myPackages/XSB/emu/cinterf.h:300: warning: function declaration isn’t a prototype
    /home/mschatte/myPackages/XSB/emu/cinterf.h:304: warning: function declaration isn’t a prototype
    /home/mschatte/myPackages/XSB/emu/cinterf.h:305: warning: function declaration isn’t a prototype
    In file included from xsb_swig/swig_xsb_wrap.c:2346:
    xsb_swig/swig_xsb.h:101: warning: function declaration isn’t a prototype
    xsb_swig/swig_xsb.h:135: warning: function declaration isn’t a prototype
    xsb_swig/swig_xsb.h:137: warning: function declaration isn’t a prototype
    xsb_swig/swig_xsb.h:141: warning: function declaration isn’t a prototype
    xsb_swig/swig_xsb.h:145: warning: function declaration isn’t a prototype
    xsb_swig/swig_xsb.h:146: warning: function declaration isn’t a prototype
    xsb_swig/swig_xsb_wrap.c:2498: warning: function declaration isn’t a prototype
    xsb_swig/swig_xsb_wrap.c:5124: warning: function declaration isn’t a prototype
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O2 -Wall -Wstrict-prototypes -fPIC -I/home/mschatte/myPackages/XSB/config/i686-pc-linux-gnu -I/home/mschatte/myPackages/XSB/emu -I/usr/include/python2.4 -c xsb_swig/swig_xsb.c -o build/temp.linux-i686-2.4/xsb_swig/swig_xsb.o
    In file included from xsb_swig/swig_xsb.h:25,
                     from xsb_swig/swig_xsb.c:28:
    /home/mschatte/myPackages/XSB/emu/cinterf.h:259: warning: function declaration isn’t a prototype
    /home/mschatte/myPackages/XSB/emu/cinterf.h:262: warning: function declaration isn’t a prototype
    /home/mschatte/myPackages/XSB/emu/cinterf.h:285: warning: function declaration isn’t a prototype
    /home/mschatte/myPackages/XSB/emu/cinterf.h:286: warning: function declaration isn’t a prototype
    /home/mschatte/myPackages/XSB/emu/cinterf.h:294: warning: function declaration isn’t a prototype
    /home/mschatte/myPackages/XSB/emu/cinterf.h:296: warning: function declaration isn’t a prototype
    /home/mschatte/myPackages/XSB/emu/cinterf.h:300: warning: function declaration isn’t a prototype
    /home/mschatte/myPackages/XSB/emu/cinterf.h:304: warning: function declaration isn’t a prototype
    /home/mschatte/myPackages/XSB/emu/cinterf.h:305: warning: function declaration isn’t a prototype
    In file included from xsb_swig/swig_xsb.c:28:
    xsb_swig/swig_xsb.h:101: warning: function declaration isn’t a prototype
    xsb_swig/swig_xsb.h:135: warning: function declaration isn’t a prototype
    xsb_swig/swig_xsb.h:137: warning: function declaration isn’t a prototype
    xsb_swig/swig_xsb.h:141: warning: function declaration isn’t a prototype
    xsb_swig/swig_xsb.h:145: warning: function declaration isn’t a prototype
    xsb_swig/swig_xsb.h:146: warning: function declaration isn’t a prototype
    xsb_swig/swig_xsb.c: In function ‘intpointer’:
    xsb_swig/swig_xsb.c:84: warning: function returns address of local variable
    xsb_swig/swig_xsb.c: At top level:
    xsb_swig/swig_xsb.c:140: warning: function declaration isn’t a prototype
    xsb_swig/swig_xsb.c:174: warning: function declaration isn’t a prototype
    xsb_swig/swig_xsb.c:176: warning: function declaration isn’t a prototype
    xsb_swig/swig_xsb.c:180: warning: function declaration isn’t a prototype
    xsb_swig/swig_xsb.c:184: warning: function declaration isn’t a prototype
    xsb_swig/swig_xsb.c:185: warning: function declaration isn’t a prototype
    Traceback (most recent call last):
      File "setup.py", line 11, in ?
        [ "xsb_swig/swig_xsb_wrap.c", "xsb_swig/swig_xsb.c" ]
      File "distutils/core.py", line 149, in setup
      File "distutils/dist.py", line 946, in run_commands
      File "distutils/dist.py", line 966, in run_command
      File "distutils/command/build.py", line 112, in run
      File "/usr/lib/python2.4/cmd.py", line 333, in run_command
        del help[cmd]
      File "distutils/dist.py", line 966, in run_command
      File "distutils/command/build_ext.py", line 279, in run
      File "distutils/command/build_ext.py", line 405, in build_extensions
      File "distutils/command/build_ext.py", line 502, in build_extension
      File "distutils/ccompiler.py", line 847, in link_shared_object
      File "distutils/unixccompiler.py", line 211, in link
    TypeError: can only concatenate list (not "str") to list

    maybe it isn't a bug, but link_objects is not well documented, so I wasn't able to find the appropriate syntax for setup.cfg

    Best regards,

    --
    Markus Schatten, dipl. inf.
    e-mail: markus.schatten@foi.hr
    Faculty of Organization and Informatics
    Varaždin, Croatia

    @devdanzin devdanzin mannequin added build The build process and cross-build stdlib Python modules in the Lib dir labels Mar 30, 2009
    @devdanzin devdanzin mannequin assigned tarekziade Mar 30, 2009
    @devdanzin devdanzin mannequin added type-bug An unexpected behavior, bug, or error build The build process and cross-build stdlib Python modules in the Lib dir labels Mar 30, 2009
    @devdanzin devdanzin mannequin assigned tarekziade Mar 30, 2009
    @devdanzin devdanzin mannequin added the type-bug An unexpected behavior, bug, or error label Mar 30, 2009
    @terryjreedy
    Copy link
    Member

    Is there still a problem with 2.7 or 3.x?

    @merwok
    Copy link
    Member

    merwok commented Apr 22, 2012

    The code in build_ext is missing a few ensure_string_list calls; it is a method that converts a string (from the setup.cfg file or command line) into a list, or if the attribute is already a list (if it was given in setup.py) then leave it alone. Recently I fixed the same bug with the build_ext --libraries option (bpo-1326113), so it’s easy to make a patch with the same kind of tests and the code fix.

    @merwok merwok added easy and removed build The build process and cross-build labels Apr 22, 2012
    @merwok merwok assigned merwok and unassigned tarekziade Apr 22, 2012
    @merwok merwok added easy and removed build The build process and cross-build labels Apr 22, 2012
    @merwok merwok assigned merwok and unassigned tarekziade Apr 22, 2012
    @lambertv
    Copy link
    Mannequin

    lambertv mannequin commented Oct 10, 2014

    Here is a simple one-line-fix patch with a test.

    Except for the libraries option, other options separate using ':'. The documentation didn't seem to say much, so I wasn't sure if link_objects should be consistent with that or if it should follow libraries's example and instead allow spaces and commas for separation. This patch uses ensure_string_list as suggested, but let me know if using .split(os.pathsep) is a better idea.

    @terryjreedy
    Copy link
    Member

    Valerie, I cannot review this. If Éric does not respond in a month or two, you might enquire on python-dev or core-mentorship lists.

    @terryjreedy
    Copy link
    Member

    Donald, can you look at this one-line patch? Éric has not responded.

    @merwok
    Copy link
    Member

    merwok commented Dec 8, 2014

    Thanks for the patch. It looks good to me.

    @bru
    Copy link
    Mannequin

    bru mannequin commented Dec 9, 2014

    There's a small typo in the comments:

    + # make sure cmd.link_objects is turned into a list
    + # is it's a string

    Should be:

    + # make sure cmd.link_objects is turned into a list
    + # if it's a string

    @lambertv
    Copy link
    Mannequin

    lambertv mannequin commented Dec 9, 2014

    Fixed the typo and reuploaded. Thanks for spotting that!

    @bitdancer
    Copy link
    Member

    This issue is marked for 2.7, 3.4, and 3.5, but the test runs only on 3.5.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Sep 29, 2016

    New changeset 520ca3652422 by Benjamin Peterson in branch '2.7':
    build_ext: correctly parse the link_objects user option (closes bpo-1703178)
    https://hg.python.org/cpython/rev/520ca3652422

    New changeset b2f0a31fa441 by Benjamin Peterson in branch '3.5':
    build_ext: correctly parse the link_objects user option (closes bpo-1703178)
    https://hg.python.org/cpython/rev/b2f0a31fa441

    New changeset eac20127d51e by Benjamin Peterson in branch '3.6':
    merge 3.5 (bpo-1703178)
    https://hg.python.org/cpython/rev/eac20127d51e

    New changeset 9485165435e4 by Benjamin Peterson in branch 'default':
    merge 3.6 (bpo-1703178)
    https://hg.python.org/cpython/rev/9485165435e4

    @python-dev python-dev mannequin closed this as completed Sep 29, 2016
    @python-dev python-dev mannequin closed this as completed Sep 29, 2016
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    easy stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants