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
Comments
When I put the following into setup.cfg: --- [build_ext] --- 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, -- |
Is there still a problem with 2.7 or 3.x? |
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. |
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. |
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. |
Donald, can you look at this one-line patch? Éric has not responded. |
Thanks for the patch. It looks good to me. |
There's a small typo in the comments: + # make sure cmd.link_objects is turned into a list Should be: + # make sure cmd.link_objects is turned into a list |
Fixed the typo and reuploaded. Thanks for spotting that! |
This issue is marked for 2.7, 3.4, and 3.5, but the test runs only on 3.5. |
New changeset 520ca3652422 by Benjamin Peterson in branch '2.7': New changeset b2f0a31fa441 by Benjamin Peterson in branch '3.5': New changeset eac20127d51e by Benjamin Peterson in branch '3.6': New changeset 9485165435e4 by Benjamin Peterson in branch 'default': |
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:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: