Richard W.M. Jones
2020-Mar-23 12:49 UTC
Re: [Libguestfs] [PATCH nbdkit 3/3] python: Remove extraneous static keyword
On Mon, Mar 23, 2020 at 12:28:12PM +0000, Richard W.M. Jones wrote:> From: Yifan Gu <gyf304@gmail.com> > > The create_nbdkit_module function is intended to be exported, therefore > the static keyword is not needed and prevents building on MSYS2. > --- > plugins/python/python.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/plugins/python/python.c b/plugins/python/python.c > index a1a0438b..adc1aaa5 100644 > --- a/plugins/python/python.c > +++ b/plugins/python/python.c > @@ -224,7 +224,7 @@ static struct PyModuleDef moduledef = { > NULL > }; > > -static PyMODINIT_FUNC > +PyMODINIT_FUNC > create_nbdkit_module (void) > { > PyObject *m; > --I don't believe this is correct. We call PyImport_AppendInittab ("nbdkit", create_nbdkit_module); later on so the function shouldn't need to public. What's the actual error when compiling this? Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 100 libraries supported. http://fedoraproject.org/wiki/MinGW
Frank Gu
2020-Mar-23 13:08 UTC
Re: [Libguestfs] [PATCH nbdkit 3/3] python: Remove extraneous static keyword
The error is the following libtool: link: (cd .libs/nbdkit-perl-plugin.lax/libutils.a && ar x "/c/Users/yifangu/Documents/devel/nbdkit/plugins/perl/../../common/utils/.libs/libutils.a") libtool: link: ar cru .libs/nbdkit-perl-plugin.a .libs/nbdkit_perl_plugin_la-perl.o .libs/nbdkit-perl-plugin.lax/libutils.a/libutils_la-cleanup-nbdkit.o .libs/nbdkit-perl-plugin.lax/libutils.a/libutils_la-cleanup.o .libs/nbdkit-perl-plugin.lax/libutils.a/libutils_la-quote.o .libs/nbdkit-perl-plugin.lax/libutils.a/libutils_la-utils.o libtool: link: ranlib .libs/nbdkit-perl-plugin.a libtool: link: rm -fr .libs/nbdkit-perl-plugin.lax libtool: link: ( cd ".libs" && rm -f "nbdkit-perl-plugin.la" && cp -pR "../ nbdkit-perl-plugin.la" "nbdkit-perl-plugin.la" ) make[3]: Leaving directory '/c/Users/yifangu/Documents/devel/nbdkit/plugins/perl' Making all in python make[3]: Entering directory '/c/Users/yifangu/Documents/devel/nbdkit/plugins/python' /bin/sh ../../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I../.. -I../../include -I../../common/utils -I/usr/include/python3.7m -g -O2 -MT nbdkit_python_plugin_la-python.lo -MD -MP -MF .deps/nbdkit_python_plugin_la-python.Tpo -c -o nbdkit_python_plugin_la-python.lo `test -f 'python.c' || echo './'`python.c libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../.. -I../../include -I../../common/utils -I/usr/include/python3.7m -g -O2 -MT nbdkit_python_plugin_la-python.lo -MD -MP -MF .deps/nbdkit_python_plugin_la-python.Tpo -c python.c -DDLL_EXPORT -DPIC -o .libs/nbdkit_python_plugin_la-python.o python.c:228:1: error: external linkage required for symbol ‘create_nbdkit_module’ because of ‘dllexport’ attribute 228 | create_nbdkit_module (void) | ^~~~~~~~~~~~~~~~~~~~ make[3]: *** [Makefile:638: nbdkit_python_plugin_la-python.lo] Error 1 make[3]: Leaving directory '/c/Users/yifangu/Documents/devel/nbdkit/plugins/python' make[2]: *** [Makefile:505: all-recursive] Error 1 make[2]: Leaving directory '/c/Users/yifangu/Documents/devel/nbdkit/plugins' make[1]: *** [Makefile:696: all-recursive] Error 1 make[1]: Leaving directory '/c/Users/yifangu/Documents/devel/nbdkit' make: *** [Makefile:562: all] Error 2 On Mon, Mar 23, 2020 at 8:49 AM Richard W.M. Jones <rjones@redhat.com> wrote:> On Mon, Mar 23, 2020 at 12:28:12PM +0000, Richard W.M. Jones wrote: > > From: Yifan Gu <gyf304@gmail.com> > > > > The create_nbdkit_module function is intended to be exported, therefore > > the static keyword is not needed and prevents building on MSYS2. > > --- > > plugins/python/python.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/plugins/python/python.c b/plugins/python/python.c > > index a1a0438b..adc1aaa5 100644 > > --- a/plugins/python/python.c > > +++ b/plugins/python/python.c > > @@ -224,7 +224,7 @@ static struct PyModuleDef moduledef = { > > NULL > > }; > > > > -static PyMODINIT_FUNC > > +PyMODINIT_FUNC > > create_nbdkit_module (void) > > { > > PyObject *m; > > -- > > I don't believe this is correct. We call > > PyImport_AppendInittab ("nbdkit", create_nbdkit_module); > > later on so the function shouldn't need to public. What's the actual > error when compiling this? > > Rich. > > -- > Richard Jones, Virtualization Group, Red Hat > http://people.redhat.com/~rjones > Read my programming and virtualization blog: http://rwmj.wordpress.com > Fedora Windows cross-compiler. Compile Windows programs, test, and > build Windows installers. Over 100 libraries supported. > http://fedoraproject.org/wiki/MinGW > >
Richard W.M. Jones
2020-Mar-23 14:19 UTC
Re: [Libguestfs] [PATCH nbdkit 3/3] python: Remove extraneous static keyword
On Mon, Mar 23, 2020 at 09:08:25AM -0400, Frank Gu wrote:> libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../.. -I../../include > -I../../common/utils -I/usr/include/python3.7m -g -O2 -MT > nbdkit_python_plugin_la-python.lo -MD -MP -MF > .deps/nbdkit_python_plugin_la-python.Tpo -c python.c -DDLL_EXPORT -DPIC -o > .libs/nbdkit_python_plugin_la-python.o > python.c:228:1: error: external linkage required for symbol > ‘create_nbdkit_module’ because of ‘dllexport’ attribute > 228 | create_nbdkit_module (void) > | ^~~~~~~~~~~~~~~~~~~~I see. I think this is actually a bug in the Python headers (look at how PyMODINIT_FUNC is defined), but as there's very little chance of fixing those any time soon, I will take your patch 3/3 into nbdkit in a minute. Thanks, Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://people.redhat.com/~rjones/virt-df/
Maybe Matching Threads
- Re: [PATCH nbdkit 3/3] python: Remove extraneous static keyword
- [PATCH nbdkit 3/3] python: Remove extraneous static keyword
- Re: issue when building/making package from git
- [PATCH nbdkit] python: Drop support for Python 2.
- issue when building/making package from git