unbit / uwsgi

uWSGI application server container
http://projects.unbit.it/uwsgi
Other
3.45k stars 691 forks source link

Cannot build embedded application based on documentation #1120

Closed kissgyorgy closed 8 years ago

kissgyorgy commented 8 years ago

I wanted to embed a flask application, and went through the documentation section Embedding an application in uWSGI, but the python uwsgiconfig.py --build flask step fails:

$ python uwsgiconfig.py --build flask
using profile: buildconf/flask.ini
detected include path: ['/usr/lib64/gcc/x86_64-suse-linux/4.8/include', '/usr/local/include', '/usr/lib64/gcc/x86_64-suse-linux/4.8/include-fixed', '/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/include', '/usr/include']
ld -r -b binary -o bootstrap_py.o bootstrap.py
ld -r -b binary -o myapp_py.o myapp.py
detected CPU cores: 4
configured CFLAGS: -O2 -I. -Wall -Werror -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fno-strict-aliasing -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wno-format -Wno-format-security -DUWSGI_HAS_IFADDRS -DUWSGI_ZLIB -DUWSGI_LOCK_USE_MUTEX -DUWSGI_EVENT_USE_EPOLL -DUWSGI_EVENT_TIMER_USE_TIMERFD -DUWSGI_EVENT_FILEMONITOR_USE_INOTIFY -DUWSGI_UUID -DUWSGI_VERSION="\"2.0.11.2\"" -DUWSGI_VERSION_BASE="2" -DUWSGI_VERSION_MAJOR="0" -DUWSGI_VERSION_MINOR="11" -DUWSGI_VERSION_REVISION="2" -DUWSGI_VERSION_CUSTOM="\"\""
*** uWSGI compiling server core ***
[thread 1][gcc -pthread] core/utils.o
[thread 2][gcc -pthread] core/protocol.o
[thread 0][gcc -pthread] core/socket.o
[thread 3][gcc -pthread] core/logging.o
[thread 2][gcc -pthread] core/master.o
[thread 3][gcc -pthread] core/master_utils.o
[thread 0][gcc -pthread] core/emperor.o
[thread 2][gcc -pthread] core/notify.o
[thread 2][gcc -pthread] core/mule.o
[thread 3][gcc -pthread] core/subscription.o
[thread 2][gcc -pthread] core/stats.o
[thread 1][gcc -pthread] core/sendfile.o
[thread 0][gcc -pthread] core/async.o
[thread 1][gcc -pthread] core/master_checks.o
[thread 2][gcc -pthread] core/fifo.o
[thread 3][gcc -pthread] core/offload.o
[thread 0][gcc -pthread] core/io.o
[thread 2][gcc -pthread] core/static.o
[thread 1][gcc -pthread] core/websockets.o
[thread 3][gcc -pthread] core/spooler.o
[thread 2][gcc -pthread] core/snmp.o
[thread 1][gcc -pthread] core/exceptions.o
[thread 2][gcc -pthread] core/config.o
[thread 3][gcc -pthread] core/setup_utils.o
[thread 0][gcc -pthread] core/clock.o
[thread 3][gcc -pthread] core/init.o
[thread 1][gcc -pthread] core/buffer.o
[thread 0][gcc -pthread] core/reader.o
[thread 3][gcc -pthread] core/writer.o
[thread 2][gcc -pthread] core/alarm.o
[thread 1][gcc -pthread] core/cron.o
[thread 0][gcc -pthread] core/hooks.o
[thread 2][gcc -pthread] core/plugins.o
[thread 1][gcc -pthread] core/lock.o
[thread 3][gcc -pthread] core/cache.o
core/plugins.c: In function ‘uwsgi_load_plugin’:
core/plugins.c:153:35: error: ‘UWSGI_PLUGIN_DIR’ undeclared (first use in this function)
   plugin_filename = uwsgi_concat3(UWSGI_PLUGIN_DIR, "/", plugin_name);
                                   ^
core/plugins.c:153:35: note: each undeclared identifier is reported only once for each function it appears in
core/plugins.c: In function ‘uwsgi_try_autoload’:
core/plugins.c:305:14: error: ‘UWSGI_PLUGIN_DIR’ undeclared (first use in this function)
  d = opendir(UWSGI_PLUGIN_DIR);

I tried with different versions by switching tags, downloading latest stable (2.0.11.2) but I always get this error message. What am I doing wrong?

xrmx commented 8 years ago

Looks like a bug in the build system. Also the documentation should be updated to use examples/bootstrap.py as path.

StefanoOrdine commented 8 years ago

Adding plugin_dir = . to flask.ini fixes the compilation error.

StefanoOrdine commented 8 years ago

A better solution would be build uwsgi with this flask.ini:

[uwsgi]
inherit = base
main_plugin = python
bin_name = myapp
embed_files = bootstrap.py,myapp.py