Skip to contentSkip to conversation

New package: uwsgi

PATCH New Andrea Cappelli 3 participants 6 messages Dec 31, 2015 – Feb 26, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 New package: uwsgi

---
 package/Config.in                                  |    1 +
 ...-environment-variables-for-config-scripts.patch |   85 ++++++++++++++++++++
 package/uwsgi/Config.in                            |    6 ++
 package/uwsgi/uwsgi.mk                             |   36 +++++++++
 4 files changed, 128 insertions(+)
 create mode 100644 package/uwsgi/0001-Added-environment-variables-for-config-scripts.patch
 create mode 100644 package/uwsgi/Config.in
 create mode 100644 package/uwsgi/uwsgi.mk
package/Config.in +1 -0
index 9145d15..e018355 100644
@@ -1457,6 +1457,7 @@ endif
 	source "package/ulogd/Config.in"
 	source "package/ushare/Config.in"
 	source "package/ussp-push/Config.in"
+	source "package/uwsgi/Config.in"
 	source "package/vde2/Config.in"
 	source "package/vnstat/Config.in"
 	source "package/vpnc/Config.in"
package/uwsgi/0001-Added-environment-variables-for-config-scripts.patch new file +85 -0

85 lines not on this page · raw message

package/uwsgi/Config.in new file +6 -0
new file mode 100644
index 0000000..6537d1a
@@ -0,0 +1,6 @@
+config BR2_PACKAGE_UWSGI
+	bool "uwsgi"
+    select BR2_PACKAGE_LIBXML2
+	help
+        The uWSGI project aims at developing a full stack for building hosting services.
+        https://uwsgi-docs.readthedocs.org/en/latest/
\ No newline at end of file
package/uwsgi/uwsgi.mk new file +36 -0
new file mode 100644
index 0000000..2d1f11a
@@ -0,0 +1,36 @@
+################################################################################
+#
+# uwsgi
+#
+################################################################################
+
+UWSGI_VERSION = 2.0.12
+UWSGI_SOURCE = uwsgi-$(UWSGI_VERSION).tar.gz
+UWSGI_SITE = https://pypi.python.org/packages/source/u/uWSGI
+UWSGI_LICENSE = GPLv2
+UWSGI_LICENSE_FILES = LICENSE
+
+UWSGI_DEPENDENCIES = libxml2 host-python
+
+UWSGI_ENV = \
+	PATH=$(BR_PATH) \
+	CC="$(TARGET_CC)" \
+	CFLAGS="$(TARGET_CFLAGS)" \
+	LDFLAGS="$(TARGET_LDFLAGS)" \
+	LDSHARED="$(TARGET_CROSS)gcc -shared" \
+	PYTHONPATH="$(if $(BR2_PACKAGE_PYTHON3),$(PYTHON3_PATH),$(PYTHON_PATH))" \
+	_python_sysroot=$(STAGING_DIR) \
+	_python_prefix=/usr \
+	_python_exec_prefix=/usr \
+	PCRE_CONFIG="$(STAGING_DIR)/usr/bin/pcre-config" \
+	XML2_CONFIG="$(STAGING_DIR)/usr/bin/xml2-config"
+
+define UWSGI_BUILD_CMDS
+	$(MAKE) $(UWSGI_ENV) -C $(@D)
+endef
+
+define UWSGI_INSTALL_TARGET_CMDS
+	$(INSTALL) -D -m 755 $(@D)/uwsgi  $(TARGET_DIR)/usr/bin/uwsgi
+endef
+
+$(eval $(generic-package))
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/1 New package: uwsgi

Hi Andrea,

I see that your patch has not yet been included in the master branch, and I was wondering if it has anything to do with the failure to compile when using uclibc?

When I add your patch I get the following build error:

[/home/echaudron/buildroot/output/host/usr/bin/arm-buildroot-linux-uclibcgnueabihf-gcc] core/uwsgi.o core/uwsgi.c: In function ?uwsgi_backtrace?:
core/uwsgi.c:1786:22: fatal error: execinfo.h: No such file or directory

 #include <execinfo.h>
                      ^

compilation terminated.
Makefile:4: recipe for target 'all' failed
make[2]: *** [all] Error 1

Before I try to make it work, have you (or anyone else) seen/fixed this?

//Eelco

Quoted 179 lines · Andrea Cappelli

---

package/Config.in                                  |    1 +
...-environment-variables-for-config-scripts.patch |   85 ++++++++++++++++++++
package/uwsgi/Config.in                            |    6 ++
package/uwsgi/uwsgi.mk                             |   36 +++++++++
4 files changed, 128 insertions(+)

create mode 100644 package/uwsgi/0001-Added-environment-variables-for-config-scripts.patch create mode 100644 package/uwsgi/Config.in
create mode 100644 package/uwsgi/uwsgi.mk

package/Config.in +1 -0
index 9145d15..e018355 100644
@@ -1457,6 +1457,7 @@ endif
 	source "package/ulogd/Config.in"
 	source "package/ushare/Config.in"
 	source "package/ussp-push/Config.in"
+	source "package/uwsgi/Config.in"
 	source "package/vde2/Config.in"
 	source "package/vnstat/Config.in"
 	source "package/vpnc/Config.in"
package/uwsgi/0001-Added-environment-variables-for-config-scripts.patch new file +85 -0
new file mode 100644
index 0000000..a5c79a5
@@ -0,0 +1,85 @@
+Added environment variables to choose right -config script during cross compilation (suggested by Thomas)
+
+diff --git a/uwsgiconfig.py b/uwsgiconfig.py
+index 542d9e7..2695893 100644
+--- a/uwsgiconfig.py
++++ b/uwsgiconfig.py
+@@ -31,6 +31,9 @@ GCC = os.environ.get('CC', sysconfig.get_config_var('CC'))
+ if not GCC:
+     GCC = 'gcc'
+ 
++PCRE_CONFIG = os.environ.get('PCRE_CONFIG', 'pcre-config')
++XML2_CONFIG = os.environ.get('XML2_CONFIG', 'xml2-config')
++
+ def get_preprocessor():
+     if 'clang' in GCC:
+         return 'clang -xc core/clang_fake.c'
+@@ -546,6 +549,11 @@ def build_uwsgi(uc, print_only=False, gcll=None):
+             t.join()
+ 
+     print("*** uWSGI linking ***")
++    try:
++        if os.environ['LDFLAGS'] == '':
++            ldflags = []
++    except:
++        pass
+     ldline = "%s -o %s %s %s %s" % (GCC, bin_name, ' '.join(uniq_warnings(ldflags)),
+         ' '.join(map(add_o, gcc_list)), ' '.join(uniq_warnings(libs)))
+     print(ldline)
+@@ -1017,23 +1025,23 @@ class uConf(object):
+         # re-enable after pcre fix
+         if self.get('pcre'):
+             if self.get('pcre') == 'auto':
+-                pcreconf = spcall('pcre-config --libs')
++                pcreconf = spcall('%s --libs' % PCRE_CONFIG)
+                 if pcreconf:
+                     self.libs.append(pcreconf)
+-                    pcreconf = spcall("pcre-config --cflags")
++                    pcreconf = spcall("%s --cflags" % PCRE_CONFIG)
+                     self.cflags.append(pcreconf)
+                     self.gcc_list.append('core/regexp')
+                     self.cflags.append("-DUWSGI_PCRE")
+                     has_pcre = True
+ 
+             else:
+-                pcreconf = spcall('pcre-config --libs')
++                pcreconf = spcall('%s --libs' % PCRE_CONFIG)
+                 if pcreconf is None:
+                     print("*** libpcre headers unavailable. uWSGI build is interrupted. You have to install pcre development package or disable pcre")
+                     sys.exit(1)
+                 else:
+                     self.libs.append(pcreconf)
+-                    pcreconf = spcall("pcre-config --cflags")
++                    pcreconf = spcall("%s --cflags" % PCRE_CONFIG)
+                     self.cflags.append(pcreconf)
+                     self.gcc_list.append('core/regexp')
+                     self.cflags.append("-DUWSGI_PCRE")
+@@ -1248,10 +1256,10 @@ class uConf(object):
+ 
+         if self.get('xml'):
+             if self.get('xml') == 'auto':
+-                xmlconf = spcall('xml2-config --libs')
++                xmlconf = spcall('%s --libs' % XML2_CONFIG)
+                 if xmlconf:
+                     self.libs.append(xmlconf)
+-                    xmlconf = spcall("xml2-config --cflags")
++                    xmlconf = spcall("%s --cflags" % XML2_CONFIG)
+                     self.cflags.append(xmlconf)
+                     self.cflags.append("-DUWSGI_XML -DUWSGI_XML_LIBXML2")
+                     self.gcc_list.append('core/xmlconf')
+@@ -1262,13 +1270,13 @@ class uConf(object):
+                     self.gcc_list.append('core/xmlconf')
+                     report['xml'] = 'expat'
+             elif self.get('xml') == 'libxml2':
+-                xmlconf = spcall('xml2-config --libs')
++                xmlconf = spcall('%s --libs' % XML2_CONFIG)
+                 if xmlconf is None:
+                     print("*** libxml2 headers unavailable. uWSGI build is interrupted. You have to install libxml2 development package or use libexpat or disable XML")
+                     sys.exit(1)
+                 else:
+                     self.libs.append(xmlconf)
+-                    xmlconf = spcall("xml2-config --cflags")
++                    xmlconf = spcall("%s --cflags" % XML2_CONFIG)
+                     if xmlconf is None:
+                         print("*** libxml2 headers unavailable. uWSGI build is interrupted. You have to install libxml2 development package or use libexpat or disable XML")
+                         sys.exit(1)
package/uwsgi/Config.in new file +6 -0
new file mode 100644
index 0000000..6537d1a
@@ -0,0 +1,6 @@
+config BR2_PACKAGE_UWSGI
+	bool "uwsgi"
+    select BR2_PACKAGE_LIBXML2
+	help
+        The uWSGI project aims at developing a full stack for building hosting services.
+        https://uwsgi-docs.readthedocs.org/en/latest/
\ No newline at end of file
package/uwsgi/uwsgi.mk new file +36 -0
new file mode 100644
index 0000000..2d1f11a
@@ -0,0 +1,36 @@
+################################################################################
+#
+# uwsgi
+#
+################################################################################
+
+UWSGI_VERSION = 2.0.12
+UWSGI_SOURCE = uwsgi-$(UWSGI_VERSION).tar.gz
+UWSGI_SITE = https://pypi.python.org/packages/source/u/uWSGI
+UWSGI_LICENSE = GPLv2
+UWSGI_LICENSE_FILES = LICENSE
+
+UWSGI_DEPENDENCIES = libxml2 host-python
+
+UWSGI_ENV = \
+	PATH=$(BR_PATH) \
+	CC="$(TARGET_CC)" \
+	CFLAGS="$(TARGET_CFLAGS)" \
+	LDFLAGS="$(TARGET_LDFLAGS)" \
+	LDSHARED="$(TARGET_CROSS)gcc -shared" \
+	PYTHONPATH="$(if $(BR2_PACKAGE_PYTHON3),$(PYTHON3_PATH),$(PYTHON_PATH))" \
+	_python_sysroot=$(STAGING_DIR) \
+	_python_prefix=/usr \
+	_python_exec_prefix=/usr \
+	PCRE_CONFIG="$(STAGING_DIR)/usr/bin/pcre-config" \
+	XML2_CONFIG="$(STAGING_DIR)/usr/bin/xml2-config"
+
+define UWSGI_BUILD_CMDS
+	$(MAKE) $(UWSGI_ENV) -C $(@D)
+endef
+
+define UWSGI_INSTALL_TARGET_CMDS
+	$(INSTALL) -D -m 755 $(@D)/uwsgi  $(TARGET_DIR)/usr/bin/uwsgi
+endef
+
+$(eval $(generic-package))
Signature · 6 lines
1.7.9.5

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20160225/8bd677ee/attachment-0001.html>

#2 lore raw

PATCH 1/1 New package: uwsgi

Quoted 7 lines · Eelco Chaudron

Hi Andrea,

I see that your patch has not yet been included in the master branch, and I was wondering if it has anything to do with the failure to compile when using uclibc?

When I add your patch I get the following build error:

Quoted 9 lines

[/home/echaudron/buildroot/output/host/usr/bin/arm-buildroot-linux-uclibcgnueabihf-gcc] core/uwsgi.o
core/uwsgi.c: In function ?uwsgi_backtrace?:
core/uwsgi.c:1786:22: fatal error: execinfo.h: No such file or directory
#include <execinfo.h>
^
compilation terminated.
Makefile:4: recipe for target 'all' failed
make[2]: *** [all] Error 1

uClibc doesn't have execinfo.h or backtrace(). This should either be made
configurable, or the package should be disabled on uClibc.

Quoted 3 lines

Before I try to make it work, have you (or anyone else) seen/fixed this?

Probably not, since there was no reaction on the patch. I think you can safely
take over this patch, unless Andrea reacts within a day or so. If you take over, you'll have to keep Andrea's Signed-off-by in addition to your own.

But now that I'm here, I'll also give some review comments. Note that many of
the things below are explained in the manual, so refer to it for details.

Quoted 6 lines

//Eelco

Quoted 3 lines

On 31 Dec 2015, at 17:02, Andrea Cappelli <[email protected] <mailto:[email protected]>> wrote:

The subject line of the patch should be:

uwsgi: new package

It should also have been sent with --subject-prefix='PATCH v2'.

The body of the commit message should explain why the python infrastructure
can't be used.

Quoted 3 lines
Quoted 3 lines

<mailto:[email protected]>>

There should be a patch changelog here:

---
Changes v2: add patch to specify -config script through environment vars

Quoted 25 lines
Quoted 25 lines

---

package/Config.in                                  |    1 +
...-environment-variables-for-config-scripts.patch |   85 ++++++++++++++++++++
package/uwsgi/Config.in                            |    6 ++
package/uwsgi/uwsgi.mk                             |   36 +++++++++
4 files changed, 128 insertions(+)

create mode 100644 package/uwsgi/0001-Added-environment-variables-for-config-scripts.patch create mode 100644 package/uwsgi/Config.in
create mode 100644 package/uwsgi/uwsgi.mk

package/Config.in +0 -0
index 9145d15..e018355 100644
@@ -1457,6 +1457,7 @@ endif

source "package/ulogd/Config.in"
source "package/ushare/Config.in"
source "package/ussp-push/Config.in"
+source "package/uwsgi/Config.in"
source "package/vde2/Config.in"
source "package/vnstat/Config.in"
source "package/vpnc/Config.in"
diff --git a/package/uwsgi/0001-Added-environment-variables-for-config-scripts.patch

Quoted 8 lines
Quoted 8 lines

b/package/uwsgi/0001-Added-environment-variables-for-config-scripts.patch new file mode 100644
index 0000000..a5c79a5

package/uwsgi/0001-Added-environment-variables-for-config-scripts.patch new file +1 -0
@@ -0,0 +1,85 @@
+Added environment variables to choose right -config script during cross

compilation (suggested by Thomas)

Since this patch comes out of git, just generate it with 'git format-patch -N'.

The commit message should be formatted as always:

short subject line

body text explaining the details

Signed-off-by ...
Quoted 14 lines
Quoted 14 lines
package/uwsgi/0001-Added-environment-variables-for-config-scripts.patch new file +14 -0
+
+diff --git a/uwsgiconfig.py b/uwsgiconfig.py
+index 542d9e7..2695893 100644
+--- a/uwsgiconfig.py
++++ b/uwsgiconfig.py
+@@ -31,6 +31,9 @@ GCC = os.environ.get('CC', sysconfig.get_config_var('CC'))
+ if not GCC:
+     GCC = 'gcc'
+
++PCRE_CONFIG = os.environ.get('PCRE_CONFIG', 'pcre-config')
++XML2_CONFIG = os.environ.get('XML2_CONFIG', 'xml2-config')
++
+ def get_preprocessor():
+     if 'clang' in GCC:
Quoted 8 lines

package/uwsgi/0001-Added-environment-variables-for-config-scripts.patch line 23

Quoted 8 lines
package/uwsgi/0001-Added-environment-variables-for-config-scripts.patch new file +8 -0
+         return 'clang -xc core/clang_fake.c'
+@@ -546,6 +549,11 @@ def build_uwsgi(uc, print_only=False, gcll=None):
+             t.join()
+
+     print("*** uWSGI linking ***")
++    try:
++        if os.environ['LDFLAGS'] == '':
++            ldflags = []

This should just be:

ldflags = os.environ.get('LDFLAGS')

(adapted so it is a list and supports the default ldflags).

Quoted 68 lines
Quoted 68 lines

++ except:
++ pass
+ ldline = "%s -o %s %s %s %s" % (GCC, bin_name, '
'.join(uniq_warnings(ldflags)),

package/uwsgi/0001-Added-environment-variables-for-config-scripts.patch new file +22 -0
+         ' '.join(map(add_o, gcc_list)), ' '.join(uniq_warnings(libs)))
+     print(ldline)
+@@ -1017,23 +1025,23 @@ class uConf(object):
+         # re-enable after pcre fix
+         if self.get('pcre'):
+             if self.get('pcre') == 'auto':
+-                pcreconf = spcall('pcre-config --libs')
++                pcreconf = spcall('%s --libs' % PCRE_CONFIG)
+                 if pcreconf:
+                     self.libs.append(pcreconf)
+-                    pcreconf = spcall("pcre-config --cflags")
++                    pcreconf = spcall("%s --cflags" % PCRE_CONFIG)
+                     self.cflags.append(pcreconf)
+                     self.gcc_list.append('core/regexp')
+                     self.cflags.append("-DUWSGI_PCRE")
+                     has_pcre = True
+
+             else:
+-                pcreconf = spcall('pcre-config --libs')
++                pcreconf = spcall('%s --libs' % PCRE_CONFIG)
+                 if pcreconf is None:
+                     print("*** libpcre headers unavailable. uWSGI build is

interrupted. You have to install pcre development package or disable pcre")

package/uwsgi/0001-Added-environment-variables-for-config-scripts.patch new file +29 -0
+                     sys.exit(1)
+                 else:
+                     self.libs.append(pcreconf)
+-                    pcreconf = spcall("pcre-config --cflags")
++                    pcreconf = spcall("%s --cflags" % PCRE_CONFIG)
+                     self.cflags.append(pcreconf)
+                     self.gcc_list.append('core/regexp')
+                     self.cflags.append("-DUWSGI_PCRE")
+@@ -1248,10 +1256,10 @@ class uConf(object):
+
+         if self.get('xml'):
+             if self.get('xml') == 'auto':
+-                xmlconf = spcall('xml2-config --libs')
++                xmlconf = spcall('%s --libs' % XML2_CONFIG)
+                 if xmlconf:
+                     self.libs.append(xmlconf)
+-                    xmlconf = spcall("xml2-config --cflags")
++                    xmlconf = spcall("%s --cflags" % XML2_CONFIG)
+                     self.cflags.append(xmlconf)
+                     self.cflags.append("-DUWSGI_XML -DUWSGI_XML_LIBXML2")
+                     self.gcc_list.append('core/xmlconf')
+@@ -1262,13 +1270,13 @@ class uConf(object):
+                     self.gcc_list.append('core/xmlconf')
+                     report['xml'] = 'expat'
+             elif self.get('xml') == 'libxml2':
+-                xmlconf = spcall('xml2-config --libs')
++                xmlconf = spcall('%s --libs' % XML2_CONFIG)
+                 if xmlconf is None:
+                     print("*** libxml2 headers unavailable. uWSGI build is

interrupted. You have to install libxml2 development package or use libexpat or disable XML")

package/uwsgi/0001-Added-environment-variables-for-config-scripts.patch new file +7 -0
+                     sys.exit(1)
+                 else:
+                     self.libs.append(xmlconf)
+-                    xmlconf = spcall("xml2-config --cflags")
++                    xmlconf = spcall("%s --cflags" % XML2_CONFIG)
+                     if xmlconf is None:
+                         print("*** libxml2 headers unavailable. uWSGI build

is interrupted. You have to install libxml2 development package or use libexpat or disable XML")
+ sys.exit(1)

Quoted 8 lines

package/uwsgi/Config.in line 2

Quoted 8 lines
package/uwsgi/Config.in new file +2 -0
new file mode 100644
index 0000000..6537d1a
@@ -0,0 +1,6 @@
+config BR2_PACKAGE_UWSGI
+bool "uwsgi"

This should be indented with a tab.

Quoted 2 lines

package/uwsgi/Config.in line 4

Quoted 2 lines
package/uwsgi/Config.in new file +2 -0
+    select BR2_PACKAGE_LIBXML2
+help

Here as well.

Quoted 1 line

package/uwsgi/Config.in line 5

Quoted 1 line
package/uwsgi/Config.in new file +1 -0
+        The uWSGI project aims at developing a full stack for building

Here a tab + 2 spaces and wrap at 72 columns (where the tab counts for 8).

Quoted 1 line
Quoted 1 line

hosting services.

Empty line needed here.

Quoted 2 lines
Quoted 2 lines

+ https://uwsgi-docs.readthedocs.org/en/latest/
\ No newline at end of file

And a newline at the end.

Quoted 17 lines
Quoted 17 lines
package/uwsgi/uwsgi.mk new file +11 -0
new file mode 100644
index 0000000..2d1f11a
@@ -0,0 +1,36 @@
+################################################################################
+#
+# uwsgi
+#
+################################################################################
+
+UWSGI_VERSION = 2.0.12
+UWSGI_SOURCE = uwsgi-$(UWSGI_VERSION).tar.gz
+UWSGI_SITE = https://pypi.python.org/packages/source/u/uWSGI
+UWSGI_LICENSE = GPLv2
+UWSGI_LICENSE_FILES = LICENSE
Quoted 8 lines

package/uwsgi/uwsgi.mk line 19

Quoted 8 lines
package/uwsgi/uwsgi.mk new file +8 -0
+
+UWSGI_DEPENDENCIES = libxml2 host-python
+
+UWSGI_ENV = \
+PATH=$(BR_PATH) \
+CC="$(TARGET_CC)" \
+CFLAGS="$(TARGET_CFLAGS)" \
+LDFLAGS="$(TARGET_LDFLAGS)" \

$(TARGET_CONF_OPTS) should be used here.

Quoted 9 lines
Quoted 9 lines
package/uwsgi/uwsgi.mk new file +9 -0
+LDSHARED="$(TARGET_CROSS)gcc -shared" \
+PYTHONPATH="$(if $(BR2_PACKAGE_PYTHON3),$(PYTHON3_PATH),$(PYTHON_PATH))" \
+_python_sysroot=$(STAGING_DIR) \
+_python_prefix=/usr \
+_python_exec_prefix=/usr \
+PCRE_CONFIG="$(STAGING_DIR)/usr/bin/pcre-config" \
+XML2_CONFIG="$(STAGING_DIR)/usr/bin/xml2-config"
+
+define UWSGI_BUILD_CMDS
Quoted 8 lines

package/uwsgi/uwsgi.mk line 36

Quoted 8 lines
package/uwsgi/uwsgi.mk new file +8 -0
+$(MAKE) $(UWSGI_ENV) -C $(@D)
+endef
+
+define UWSGI_INSTALL_TARGET_CMDS
+$(INSTALL) -D -m 755 $(@D)/uwsgi  $(TARGET_DIR)/usr/bin/uwsgi
+endef
+
+$(eval $(generic-package))

In addition, there should be a hash file.

I've marked this patch as 'Changes Requested' in patchwork, so we will forget
about it unless a v3 is sent.

Regards,
Arnout

Quoted 15 lines
Quoted 7 lines
Signature · 6 lines
1.7.9.5

_______________________________________________
buildroot mailing list
buildroot at busybox.net <mailto:[email protected]>
http://lists.busybox.net/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#3 lore raw

PATCH 1/1 New package: uwsgi

Hi Arnout,

For now I fixed it by changing the uclib configuration to include backtrace() support.

+++ uClibc-ng.config
@@ -39,3 +39,4 @@ DEVEL_PREFIX="/usr/"
UCLIBC_HAS_SSP=y
UCLIBC_BUILD_NOW=y
# DOSTRIP is not set
+UCLIBC_HAS_BACKTRACE=y

Cheers,

Eelco

Quoted 294 lines · Arnout Vandecappelle
Quoted 10 lines · Eelco Chaudron

Hi Andrea,

I see that your patch has not yet been included in the master branch, and I was wondering if it has anything to do with the failure to compile when using uclibc?

When I add your patch I get the following build error:

[/home/echaudron/buildroot/output/host/usr/bin/arm-buildroot-linux-uclibcgnueabihf-gcc] core/uwsgi.o
core/uwsgi.c: In function ?uwsgi_backtrace?:

Quoted 6 lines
   core/uwsgi.c:1786:22: fatal error: execinfo.h: No such file or directory
    #include <execinfo.h>
                         ^
   compilation terminated.
   Makefile:4: recipe for target 'all' failed
   make[2]: *** [all] Error 1

uClibc doesn't have execinfo.h or backtrace(). This should either be made configurable, or the package should be disabled on uClibc.

Quoted 3 lines

Before I try to make it work, have you (or anyone else) seen/fixed this?

Probably not, since there was no reaction on the patch. I think you can safely take over this patch, unless Andrea reacts within a day or so. If you take over, you'll have to keep Andrea's Signed-off-by in addition to your own.

But now that I'm here, I'll also give some review comments. Note that many of the things below are explained in the manual, so refer to it for details.

Quoted 6 lines

//Eelco

Quoted 3 lines

On 31 Dec 2015, at 17:02, Andrea Cappelli <a.cappelli at gmail.com <mailto:[email protected]> <mailto:a.cappelli at gmail.com <mailto:[email protected]>>> wrote:

The subject line of the patch should be:

uwsgi: new package

It should also have been sent with --subject-prefix='PATCH v2'.

The body of the commit message should explain why the python infrastructure can't be used.

Quoted 3 lines
Quoted 3 lines
Signed-off-by Andrea Cappelli <a.cappelli at gmail.com <mailto:[email protected]>

<mailto:a.cappelli at gmail.com <mailto:[email protected]>>>

There should be a patch changelog here:

---
Changes v2: add patch to specify -config script through environment vars

Quoted 25 lines
Quoted 25 lines

---

package/Config.in                                  |    1 +
...-environment-variables-for-config-scripts.patch |   85 ++++++++++++++++++++
package/uwsgi/Config.in                            |    6 ++
package/uwsgi/uwsgi.mk                             |   36 +++++++++
4 files changed, 128 insertions(+)

create mode 100644 package/uwsgi/0001-Added-environment-variables-for-config-scripts.patch create mode 100644 package/uwsgi/Config.in
create mode 100644 package/uwsgi/uwsgi.mk

package/Config.in +0 -0
index 9145d15..e018355 100644
@@ -1457,6 +1457,7 @@ endif

source "package/ulogd/Config.in"
source "package/ushare/Config.in"
source "package/ussp-push/Config.in"
+source "package/uwsgi/Config.in"
source "package/vde2/Config.in"
source "package/vnstat/Config.in"
source "package/vpnc/Config.in"
diff --git a/package/uwsgi/0001-Added-environment-variables-for-config-scripts.patch

Quoted 8 lines
Quoted 8 lines

b/package/uwsgi/0001-Added-environment-variables-for-config-scripts.patch new file mode 100644
index 0000000..a5c79a5

package/uwsgi/0001-Added-environment-variables-for-config-scripts.patch new file +1 -0
@@ -0,0 +1,85 @@
+Added environment variables to choose right -config script during cross

compilation (suggested by Thomas)

Since this patch comes out of git, just generate it with 'git format-patch -N'.

The commit message should be formatted as always:

short subject line

body text explaining the details

Signed-off-by ...
Quoted 14 lines
Quoted 14 lines
package/uwsgi/0001-Added-environment-variables-for-config-scripts.patch new file +14 -0
+
+diff --git a/uwsgiconfig.py b/uwsgiconfig.py
+index 542d9e7..2695893 100644
+--- a/uwsgiconfig.py
++++ b/uwsgiconfig.py
+@@ -31,6 +31,9 @@ GCC = os.environ.get('CC', sysconfig.get_config_var('CC'))
+ if not GCC:
+     GCC = 'gcc'
+
++PCRE_CONFIG = os.environ.get('PCRE_CONFIG', 'pcre-config')
++XML2_CONFIG = os.environ.get('XML2_CONFIG', 'xml2-config')
++
+ def get_preprocessor():
+     if 'clang' in GCC:
Quoted 8 lines

package/uwsgi/0001-Added-environment-variables-for-config-scripts.patch line 23

Quoted 8 lines
package/uwsgi/0001-Added-environment-variables-for-config-scripts.patch new file +8 -0
+         return 'clang -xc core/clang_fake.c'
+@@ -546,6 +549,11 @@ def build_uwsgi(uc, print_only=False, gcll=None):
+             t.join()
+
+     print("*** uWSGI linking ***")
++    try:
++        if os.environ['LDFLAGS'] == '':
++            ldflags = []

This should just be:

ldflags = os.environ.get('LDFLAGS')

(adapted so it is a list and supports the default ldflags).

Quoted 68 lines
Quoted 68 lines

++ except:
++ pass
+ ldline = "%s -o %s %s %s %s" % (GCC, bin_name, '
'.join(uniq_warnings(ldflags)),

package/uwsgi/0001-Added-environment-variables-for-config-scripts.patch new file +22 -0
+         ' '.join(map(add_o, gcc_list)), ' '.join(uniq_warnings(libs)))
+     print(ldline)
+@@ -1017,23 +1025,23 @@ class uConf(object):
+         # re-enable after pcre fix
+         if self.get('pcre'):
+             if self.get('pcre') == 'auto':
+-                pcreconf = spcall('pcre-config --libs')
++                pcreconf = spcall('%s --libs' % PCRE_CONFIG)
+                 if pcreconf:
+                     self.libs.append(pcreconf)
+-                    pcreconf = spcall("pcre-config --cflags")
++                    pcreconf = spcall("%s --cflags" % PCRE_CONFIG)
+                     self.cflags.append(pcreconf)
+                     self.gcc_list.append('core/regexp')
+                     self.cflags.append("-DUWSGI_PCRE")
+                     has_pcre = True
+
+             else:
+-                pcreconf = spcall('pcre-config --libs')
++                pcreconf = spcall('%s --libs' % PCRE_CONFIG)
+                 if pcreconf is None:
+                     print("*** libpcre headers unavailable. uWSGI build is

interrupted. You have to install pcre development package or disable pcre")

package/uwsgi/0001-Added-environment-variables-for-config-scripts.patch new file +29 -0
+                     sys.exit(1)
+                 else:
+                     self.libs.append(pcreconf)
+-                    pcreconf = spcall("pcre-config --cflags")
++                    pcreconf = spcall("%s --cflags" % PCRE_CONFIG)
+                     self.cflags.append(pcreconf)
+                     self.gcc_list.append('core/regexp')
+                     self.cflags.append("-DUWSGI_PCRE")
+@@ -1248,10 +1256,10 @@ class uConf(object):
+
+         if self.get('xml'):
+             if self.get('xml') == 'auto':
+-                xmlconf = spcall('xml2-config --libs')
++                xmlconf = spcall('%s --libs' % XML2_CONFIG)
+                 if xmlconf:
+                     self.libs.append(xmlconf)
+-                    xmlconf = spcall("xml2-config --cflags")
++                    xmlconf = spcall("%s --cflags" % XML2_CONFIG)
+                     self.cflags.append(xmlconf)
+                     self.cflags.append("-DUWSGI_XML -DUWSGI_XML_LIBXML2")
+                     self.gcc_list.append('core/xmlconf')
+@@ -1262,13 +1270,13 @@ class uConf(object):
+                     self.gcc_list.append('core/xmlconf')
+                     report['xml'] = 'expat'
+             elif self.get('xml') == 'libxml2':
+-                xmlconf = spcall('xml2-config --libs')
++                xmlconf = spcall('%s --libs' % XML2_CONFIG)
+                 if xmlconf is None:
+                     print("*** libxml2 headers unavailable. uWSGI build is

interrupted. You have to install libxml2 development package or use libexpat or disable XML")

package/uwsgi/0001-Added-environment-variables-for-config-scripts.patch new file +7 -0
+                     sys.exit(1)
+                 else:
+                     self.libs.append(xmlconf)
+-                    xmlconf = spcall("xml2-config --cflags")
++                    xmlconf = spcall("%s --cflags" % XML2_CONFIG)
+                     if xmlconf is None:
+                         print("*** libxml2 headers unavailable. uWSGI build

is interrupted. You have to install libxml2 development package or use libexpat or disable XML")
+ sys.exit(1)

Quoted 8 lines

package/uwsgi/Config.in line 2

Quoted 8 lines
package/uwsgi/Config.in new file +2 -0
new file mode 100644
index 0000000..6537d1a
@@ -0,0 +1,6 @@
+config BR2_PACKAGE_UWSGI
+bool "uwsgi"

This should be indented with a tab.

Quoted 2 lines

package/uwsgi/Config.in line 4

Quoted 2 lines
package/uwsgi/Config.in new file +2 -0
+    select BR2_PACKAGE_LIBXML2
+help

Here as well.

Quoted 1 line

package/uwsgi/Config.in line 5

Quoted 1 line
package/uwsgi/Config.in new file +1 -0
+        The uWSGI project aims at developing a full stack for building

Here a tab + 2 spaces and wrap at 72 columns (where the tab counts for 8).

Quoted 1 line
Quoted 1 line

hosting services.

Empty line needed here.

Quoted 2 lines
Quoted 2 lines

+ https://uwsgi-docs.readthedocs.org/en/latest/ <https://uwsgi-docs.readthedocs.org/en/latest/>
\ No newline at end of file

And a newline at the end.

Quoted 17 lines
Quoted 17 lines
package/uwsgi/uwsgi.mk new file +11 -0
new file mode 100644
index 0000000..2d1f11a
@@ -0,0 +1,36 @@
+################################################################################
+#
+# uwsgi
+#
+################################################################################
+
+UWSGI_VERSION = 2.0.12
+UWSGI_SOURCE = uwsgi-$(UWSGI_VERSION).tar.gz
+UWSGI_SITE = https://pypi.python.org/packages/source/u/uWSGI
+UWSGI_LICENSE = GPLv2
+UWSGI_LICENSE_FILES = LICENSE
Quoted 8 lines

package/uwsgi/uwsgi.mk line 19

Quoted 8 lines
package/uwsgi/uwsgi.mk new file +8 -0
+
+UWSGI_DEPENDENCIES = libxml2 host-python
+
+UWSGI_ENV = \
+PATH=$(BR_PATH) \
+CC="$(TARGET_CC)" \
+CFLAGS="$(TARGET_CFLAGS)" \
+LDFLAGS="$(TARGET_LDFLAGS)" \

$(TARGET_CONF_OPTS) should be used here.

Quoted 9 lines
Quoted 9 lines
package/uwsgi/uwsgi.mk new file +9 -0
+LDSHARED="$(TARGET_CROSS)gcc -shared" \
+PYTHONPATH="$(if $(BR2_PACKAGE_PYTHON3),$(PYTHON3_PATH),$(PYTHON_PATH))" \
+_python_sysroot=$(STAGING_DIR) \
+_python_prefix=/usr \
+_python_exec_prefix=/usr \
+PCRE_CONFIG="$(STAGING_DIR)/usr/bin/pcre-config" \
+XML2_CONFIG="$(STAGING_DIR)/usr/bin/xml2-config"
+
+define UWSGI_BUILD_CMDS
Quoted 8 lines

package/uwsgi/uwsgi.mk line 36

Quoted 8 lines
package/uwsgi/uwsgi.mk new file +8 -0
+$(MAKE) $(UWSGI_ENV) -C $(@D)
+endef
+
+define UWSGI_INSTALL_TARGET_CMDS
+$(INSTALL) -D -m 755 $(@D)/uwsgi  $(TARGET_DIR)/usr/bin/uwsgi
+endef
+
+$(eval $(generic-package))

In addition, there should be a hash file.

I've marked this patch as 'Changes Requested' in patchwork, so we will forget about it unless a v3 is sent.

Regards,
Arnout

Quoted 10 lines
Quoted 7 lines
Signature · 6 lines
1.7.9.5

_______________________________________________
buildroot mailing list
buildroot at busybox.net <mailto:[email protected]> <mailto:buildroot at busybox.net <mailto:[email protected]>>
http://lists.busybox.net/mailman/listinfo/buildroot <http://lists.busybox.net/mailman/listinfo/buildroot>
Quoted 18 lines
Quoted 5 lines

_______________________________________________
buildroot mailing list
buildroot at busybox.net <mailto:[email protected]>
http://lists.busybox.net/mailman/listinfo/buildroot <http://lists.busybox.net/mailman/listinfo/buildroot>

Signature · 10 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be <http://www.mind.be/>
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle <http://www.linkedin.com/in/arnoutvandecappelle>
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
_______________________________________________
buildroot mailing list
buildroot at busybox.net <mailto:[email protected]>
http://lists.busybox.net/mailman/listinfo/buildroot <http://lists.busybox.net/mailman/listinfo/buildroot>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20160226/9ec24a33/attachment-0001.html>

#4 lore raw

PATCH 1/1 New package: uwsgi

Review DEVEL_PREFIX="/usr/" · line 42

Quoted 11 lines · Eelco Chaudron

Hi Arnout,

For now I fixed it by changing the uclib configuration to include backtrace() support.

+++ uClibc-ng.config

(quoted diff) +1 -0
@@ -39,3 +39,4 @@ DEVEL_PREFIX="/usr/"
 UCLIBC_HAS_SSP=y
 UCLIBC_BUILD_NOW=y
 # DOSTRIP is not set
+UCLIBC_HAS_BACKTRACE=y

Since uClibc _can_ be configured without backtrace, the package must either
detect missing backtrace support and work around it, or be disabled completely on uClibc. We can't detect the backtrace support at Kconfig level, so it really has to be conditional in the package configure/make itself.

For an example, look at package/clamav/0003-backtrace-uClibc.patch

Regards,
Arnout

Quoted 4 lines

Cheers,

Eelco

[snip]

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#5 lore raw

PATCH 1/1 New package: uwsgi

In reply to Eelco Chaudron

2016-02-25 21:21 GMT+01:00 Eelco Chaudron <[email protected]>:

Quoted 2 lines

Hi Andrea,

Hi Eelco

Quoted 5 lines

I see that your patch has not yet been included in the master branch, and I was wondering if it has anything to do with the failure to compile when using uclibc?

I think the main problem is that I didn't have time to rework the patch applying all style recommendations (I only changed the patch according to Thomas suggestion, but i know I miss something)

Quoted 6 lines

When I add your patch I get the following build error:

[/home/echaudron/buildroot/output/host/usr/bin/arm-buildroot-linux-uclibcgnueabihf-gcc] core/uwsgi.o
core/uwsgi.c: In function ?uwsgi_backtrace?:
core/uwsgi.c:1786:22: fatal error: execinfo.h: No such file or directory

Quoted 9 lines
 #include <execinfo.h>
                      ^

compilation terminated.
Makefile:4: recipe for target 'all' failed
make[2]: *** [all] Error 1

Before I try to make it work, have you (or anyone else) seen/fixed this?

I compiled it on tag 2015.11.1 (9f0610c188007ee481508d453b062d77614c153d) because I have some devices in production using that version, and the build was successfull; I didn't see this error before, but I can try to investigate it on my dev board tomorrow

Best regards

Signature · 4 lines
Andrea Cappelli
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20160226/3d037e55/attachment-0001.html>