Cannot install uwsgi on Alpine - docker

I'm trying to install uwsgi using pip install uwsgi in my Alpine docker image but unfortunately it keeps failing weird no real error message to me:
Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-mEZegv/uwsgi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-c7XA_e-record/install-record.txt --single-version-externally-managed --compile:
running install
using profile: buildconf/default.ini
detected include path: ['/usr/include/fortify', '/usr/include', '/usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/include']
Patching "bin_name" to properly install_scripts dir
detected CPU cores: 1
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 -DUWSGI_HAS_IFADDRS -DUWSGI_ZLIB -DUWSGI_LOCK_USE_MUTEX -DUWSGI_EVENT_USE_EPOLL -DUWSGI_EVENT_TIMER_USE_TIMERFD -DUWSGI_EVENT_FILEMONITOR_USE_INOTIFY -DUWSGI_VERSION="\"2.0.12\"" -DUWSGI_VERSION_BASE="2" -DUWSGI_VERSION_MAJOR="0" -DUWSGI_VERSION_MINOR="12" -DUWSGI_VERSION_REVISION="0" -DUWSGI_VERSION_CUSTOM="\"\"" -DUWSGI_YAML -DUWSGI_PLUGIN_DIR="\".\"" -DUWSGI_DECLARE_EMBEDDED_PLUGINS="UDEP(python);UDEP(gevent);UDEP(ping);UDEP(cache);UDEP(nagios);UDEP(rrdtool);UDEP(carbon);UDEP(rpc);UDEP(corerouter);UDEP(fastrouter);UDEP(http);UDEP(ugreen);UDEP(signal);UDEP(syslog);UDEP(rsyslog);UDEP(logsocket);UDEP(router_uwsgi);UDEP(router_redirect);UDEP(router_basicauth);UDEP(zergpool);UDEP(redislog);UDEP(mongodblog);UDEP(router_rewrite);UDEP(router_http);UDEP(logfile);UDEP(router_cache);UDEP(rawrouter);UDEP(router_static);UDEP(sslrouter);UDEP(spooler);UDEP(cheaper_busyness);UDEP(symcall);UDEP(transformation_tofile);UDEP(transformation_gzip);UDEP(transformation_chunked);UDEP(transformation_offload);UDEP(router_memcached);UDEP(router_redis);UDEP(router_hash);UDEP(router_expires);UDEP(router_metrics);UDEP(transformation_template);UDEP(stats_pusher_socket);" -DUWSGI_LOAD_EMBEDDED_PLUGINS="ULEP(python);ULEP(gevent);ULEP(ping);ULEP(cache);ULEP(nagios);ULEP(rrdtool);ULEP(carbon);ULEP(rpc);ULEP(corerouter);ULEP(fastrouter);ULEP(http);ULEP(ugreen);ULEP(signal);ULEP(syslog);ULEP(rsyslog);ULEP(logsocket);ULEP(router_uwsgi);ULEP(router_redirect);ULEP(router_basicauth);ULEP(zergpool);ULEP(redislog);ULEP(mongodblog);ULEP(router_rewrite);ULEP(router_http);ULEP(logfile);ULEP(router_cache);ULEP(rawrouter);ULEP(router_static);ULEP(sslrouter);ULEP(spooler);ULEP(cheaper_busyness);ULEP(symcall);ULEP(transformation_tofile);ULEP(transformation_gzip);ULEP(transformation_chunked);ULEP(transformation_offload);ULEP(router_memcached);ULEP(router_redis);ULEP(router_hash);ULEP(router_expires);ULEP(router_metrics);ULEP(transformation_template);ULEP(stats_pusher_socket);"core/utils.c: In function 'uwsgi_as_root':
core/utils.c:344:7: error: implicit declaration of function 'unshare' [-Werror=implicit-function-declaration]
if (unshare(uwsgi.unshare)) {
^
core/utils.c:564:5: error: implicit declaration of function 'sigfillset' [-Werror=implicit-function-declaration]
sigfillset(&smask);
^
core/utils.c:565:5: error: implicit declaration of function 'sigprocmask' [-Werror=implicit-function-declaration]
sigprocmask(SIG_BLOCK, &smask, NULL);
^
core/utils.c:565:17: error: 'SIG_BLOCK' undeclared (first use in this function)
sigprocmask(SIG_BLOCK, &smask, NULL);
^
core/utils.c:565:17: note: each undeclared identifier is reported only once for each function it appears in
core/utils.c:586:7: error: implicit declaration of function 'chroot' [-Werror=implicit-function-declaration]
if (chroot(uwsgi.chroot)) {
^
core/utils.c:791:5: error: unknown type name 'ushort'
ushort *array;
^
core/utils.c:833:8: error: implicit declaration of function 'setgroups' [-Werror=implicit-function-declaration]
if (setgroups(0, NULL)) {
^
core/utils.c:848:8: error: implicit declaration of function 'initgroups' [-Werror=implicit-function-declaration]
if (initgroups(uidname, uwsgi.gid)) {
^
core/utils.c: In function 'uwsgi_close_request':
core/utils.c:1145:18: error: 'WAIT_ANY' undeclared (first use in this function)
while (waitpid(WAIT_ANY, &waitpid_status, WNOHANG) > 0);
^
core/utils.c: In function 'uwsgi_resolve_ip':
core/utils.c:1802:7: error: implicit declaration of function 'gethostbyname' [-Werror=implicit-function-declaration]
he = gethostbyname(domain);
^
core/utils.c:1802:5: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
he = gethostbyname(domain);
^
core/utils.c: In function 'uwsgi_unix_signal':
core/utils.c:1936:19: error: storage size of 'sa' isn't known
struct sigaction sa;
^
core/utils.c:1938:24: error: invalid application of 'sizeof' to incomplete type 'struct sigaction'
memset(&sa, 0, sizeof(struct sigaction));
^
core/utils.c:1942:2: error: implicit declaration of function 'sigemptyset' [-Werror=implicit-function-declaration]
sigemptyset(&sa.sa_mask);
^
core/utils.c:1944:6: error: implicit declaration of function 'sigaction' [-Werror=implicit-function-declaration]
if (sigaction(signum, &sa, NULL) < 0) {
^
core/utils.c:1936:19: error: unused variable 'sa' [-Werror=unused-variable]
struct sigaction sa;
^
In file included from core/utils.c:1:0:
core/utils.c: In function 'uwsgi_list_has_num':
./uwsgi.h:140:47: error: implicit declaration of function 'strtok_r' [-Werror=implicit-function-declaration]
#define uwsgi_foreach_token(x, y, z, w) for(z=strtok_r(x, y, &w);z;z = strtok_r(NULL, y, &w))
^
core/utils.c:1953:2: note: in expansion of macro 'uwsgi_foreach_token'
uwsgi_foreach_token(list2, ",", p, ctx) {
^
./uwsgi.h:140:46: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
#define uwsgi_foreach_token(x, y, z, w) for(z=strtok_r(x, y, &w);z;z = strtok_r(NULL, y, &w))
^
core/utils.c:1953:2: note: in expansion of macro 'uwsgi_foreach_token'
uwsgi_foreach_token(list2, ",", p, ctx) {
^
./uwsgi.h:140:70: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
#define uwsgi_foreach_token(x, y, z, w) for(z=strtok_r(x, y, &w);z;z = strtok_r(NULL, y, &w))
^
core/utils.c:1953:2: note: in expansion of macro 'uwsgi_foreach_token'
uwsgi_foreach_token(list2, ",", p, ctx) {
^
core/utils.c: In function 'uwsgi_list_has_str':
./uwsgi.h:140:46: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
#define uwsgi_foreach_token(x, y, z, w) for(z=strtok_r(x, y, &w);z;z = strtok_r(NULL, y, &w))
^
core/utils.c:1968:2: note: in expansion of macro 'uwsgi_foreach_token'
uwsgi_foreach_token(list2, " ", p, ctx) {
^
./uwsgi.h:140:70: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
#define uwsgi_foreach_token(x, y, z, w) for(z=strtok_r(x, y, &w);z;z = strtok_r(NULL, y, &w))
^
core/utils.c:1968:2: note: in expansion of macro 'uwsgi_foreach_token'
uwsgi_foreach_token(list2, " ", p, ctx) {
^
core/utils.c:1969:8: error: implicit declaration of function 'strcasecmp' [-Werror=implicit-function-declaration]
if (!strcasecmp(p, str)) {
^
core/utils.c: In function 'uwsgi_sig_pause':
core/utils.c:2361:2: error: implicit declaration of function 'sigsuspend' [-Werror=implicit-function-declaration]
sigsuspend(&mask);
^
core/utils.c: In function 'uwsgi_run_command_putenv_and_wait':
core/utils.c:2453:7: error: implicit declaration of function 'putenv' [-Werror=implicit-function-declaration]
if (putenv(envs[i])) {
^
In file included from core/utils.c:1:0:
core/utils.c: In function 'uwsgi_build_unshare':
./uwsgi.h:140:46: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
#define uwsgi_foreach_token(x, y, z, w) for(z=strtok_r(x, y, &w);z;z = strtok_r(NULL, y, &w))
^
core/utils.c:2855:2: note: in expansion of macro 'uwsgi_foreach_token'
uwsgi_foreach_token(list, ",", p, ctx) {
^
./uwsgi.h:140:70: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
#define uwsgi_foreach_token(x, y, z, w) for(z=strtok_r(x, y, &w);z;z = strtok_r(NULL, y, &w))
^
core/utils.c:2855:2: note: in expansion of macro 'uwsgi_foreach_token'
uwsgi_foreach_token(list, ",", p, ctx) {
^
core/utils.c: In function 'uwsgi_tmpfd':
core/utils.c:3533:7: error: implicit declaration of function 'mkstemp' [-Werror=implicit-function-declaration]
fd = mkstemp(template);
^
core/utils.c: In function 'uwsgi_expand_path':
core/utils.c:3615:7: error: implicit declaration of function 'realpath' [-Werror=implicit-function-declaration]
if (!realpath(src, dst)) {
^
core/utils.c: In function 'uwsgi_set_cpu_affinity':
core/utils.c:3641:3: error: unknown type name 'cpu_set_t'
cpu_set_t cpuset;
^
core/utils.c:3646:3: error: implicit declaration of function 'CPU_ZERO' [-Werror=implicit-function-declaration]
CPU_ZERO(&cpuset);
^
core/utils.c:3651:4: error: implicit declaration of function 'CPU_SET' [-Werror=implicit-function-declaration]
CPU_SET(base_cpu, &cpuset);
^
core/utils.c:3662:7: error: implicit declaration of function 'sched_setaffinity' [-Werror=implicit-function-declaration]
if (sched_setaffinity(0, sizeof(cpu_set_t), &cpuset)) {
^
core/utils.c:3662:35: error: 'cpu_set_t' undeclared (first use in this function)
if (sched_setaffinity(0, sizeof(cpu_set_t), &cpuset)) {
^
core/utils.c: In function 'uwsgi_thread_run':
core/utils.c:3782:2: error: implicit declaration of function 'pthread_sigmask' [-Werror=implicit-function-declaration]
pthread_sigmask(SIG_BLOCK, &smask, NULL);
^
core/utils.c:3782:18: error: 'SIG_BLOCK' undeclared (first use in this function)
pthread_sigmask(SIG_BLOCK, &smask, NULL);
^
core/utils.c: In function 'uwsgi_envdir':
core/utils.c:4349:8: error: implicit declaration of function 'unsetenv' [-Werror=implicit-function-declaration]
if (unsetenv(de->d_name)) {
^
core/utils.c:4380:7: error: implicit declaration of function 'setenv' [-Werror=implicit-function-declaration]
if (setenv(de->d_name, content, 1)) {
^
cc1: all warnings being treated as errors
*** uWSGI compiling server core ***
Any idea what could cause this? I'm installing the following dependencies beforehand:
RUN apk --update add \
bash \
python \
python-dev \
py-pip \
gcc \
zlib-dev \
git \
linux-headers \
build-base \
musl \
musl-dev \
memcached \
libmemcached-dev

I found this on a GitHub thread. Modified it a bit and works perfectly fine for me on Python 3.5
apk add python3-dev build-base linux-headers pcre-dev
pip install uwsgi

Unfortunately the latest release of uwsgi does not support musl, a glibc alternative that alpine and a couple other distros use. Uwsgi will not build with musl when the ugreen plugin is included (see https://github.com/unbit/uwsgi/pull/522), so you still cannot pip install uwsgi. However, if you build uwsgi with the environment variable UWSGI_PROFILE=corethe build should succeed; but if will fail at runtime due to the issues solved here (https://github.com/unbit/uwsgi/pull/1210). This probably grim news -- I know it was for me -- but at least it looks like the uwsgi team is taking time to address its issues running on musl. Hopefully it will work in the next release.

This is a bit old and this was not exactly the case of the OP. In my case upgrading the version on requirements.txt to uwsgi==2.0.17.1 worked, as I found here.

have you tried
http://github.com/unbit/uwsgi/archive/uwsgi-2.0.zip
in your requirements.txt ?
you'll need the pcre-dev package installed

Upgrading uWSGI from 2.0.14 to 2.0.19.1 did the trick for me.

Related

Why `string` `vector` etc does not work in union in bison?

I was trying to write a parser for a subset of C language . But when I include string or vector inside the %union , it throws error . Using char* or array seems to be fine .
%union{
string s;
vector<int>v;
}
I have seen in some place that it is related to a header issue where they suggest to do include this
%code requires{
#include <string>
}
for string case . but this also does not work for me .
The error i get is
y.tab.c:1174:9: error: use of deleted function ‘YYSTYPE::YYSTYPE()’
YYSTYPE yylval;
^~~~~~
y.tab.c:223:7: note: ‘YYSTYPE::YYSTYPE()’ is implicitly deleted because the default definition would be ill-formed:
union YYSTYPE
^~~~~~~
demo.y:48:12: error: union member ‘YYSTYPE::s’ with non-trivial ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string() [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’
string s;
^
demo.y:49:16: error: union member ‘YYSTYPE::v’ with non-trivial ‘std::vector<_Tp, _Alloc>::vector() [with _Tp = int; _Alloc = std::allocator<int>]’
vector<int>v;
^
y.tab.c: In function ‘int yyparse()’:
y.tab.c:1203:30: error: use of deleted function ‘YYSTYPE::YYSTYPE()’
YYSTYPE yyvsa[YYINITDEPTH];
^
y.tab.c:1203:30: error: use of deleted function ‘YYSTYPE::~YYSTYPE()’
y.tab.c:223:7: note: ‘YYSTYPE::~YYSTYPE()’ is implicitly deleted because the default definition would be ill-formed:
union YYSTYPE
^~~~~~~
demo.y:48:12: error: union member ‘YYSTYPE::s’ with non-trivial ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::~basic_string() [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’
string s;
^
demo.y:49:16: error: union member ‘YYSTYPE::v’ with non-trivial ‘std::vector<_Tp, _Alloc>::~vector() [with _Tp = int; _Alloc = std::allocator<int>]’
vector<int>v;
^
y.tab.c:1203:30: error: use of deleted function ‘YYSTYPE::~YYSTYPE()’
YYSTYPE yyvsa[YYINITDEPTH];
^
y.tab.c:1215:11: error: use of deleted function ‘YYSTYPE::YYSTYPE()’
YYSTYPE yyval;
^~~~~
y.tab.c:1215:11: error: use of deleted function ‘YYSTYPE::~YYSTYPE()’
y.tab.c:1381:14: error: use of deleted function ‘YYSTYPE& YYSTYPE::operator=(const YYSTYPE&)’
*++yyvsp = yylval;
^~~~~~
y.tab.c:223:7: note: ‘YYSTYPE& YYSTYPE::operator=(const YYSTYPE&)’ is implicitly deleted because the default definition would be ill-formed:
union YYSTYPE
^~~~~~~
demo.y:48:12: error: union member ‘YYSTYPE::s’ with non-trivial ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’
string s;
^
demo.y:49:16: error: union member ‘YYSTYPE::v’ with non-trivial ‘std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]’
vector<int>v;
^
y.tab.c:1412:24: error: use of deleted function ‘YYSTYPE& YYSTYPE::operator=(const YYSTYPE&)’
yyval = yyvsp[1-yylen];
^
y.tab.c:1569:14: error: use of deleted function ‘YYSTYPE& YYSTYPE::operator=(const YYSTYPE&)’
*++yyvsp = yyval;
^~~~~
y.tab.c:1713:14: error: use of deleted function ‘YYSTYPE& YYSTYPE::operator=(const YYSTYPE&)’
*++yyvsp = yylval;
^~~~~~
y.tab.c: In function ‘void __static_initialization_and_destruction_0(int, int)’:
y.tab.c:1174:9: error: use of deleted function ‘YYSTYPE::~YYSTYPE()’
YYSTYPE yylval;
^~~~~~

How do I go build a Go GTK 2 app for Windows from Linux? Is there a Docker image?

I am trying to cross-compile a .go file for the GTK binding package Linux => Windows and can't figure it out. Tried going the route of setting up MSYS on Win but it was god-awful.
I looked for a Docker image but there is none.
$ ~/go/src/gui$ GOOS=windows CGO_ENABLED=1 GOARCH= CC=x86_64-w64-mingw32-gcc go build
# github.com/mattn/go-gtk/glib
In file included from /usr/lib/x86_64-linux-gnu/glib-2.0/include/glibconfig.h:9:0,
from /usr/include/glib-2.0/glib/gtypes.h:32,
from /usr/include/glib-2.0/glib/galloca.h:32,
from /usr/include/glib-2.0/glib.h:30,
from ./glib.go.h:4,
from ../github.com/mattn/go-gtk/glib/glib.go:5:
/usr/include/glib-2.0/glib/gtypes.h: In function '_GLIB_CHECKED_ADD_U64':
/usr/include/glib-2.0/glib/gmacros.h:241:53: error: size of array '_GStaticAssertCompileTimeAssertion_0' is negative
#define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1] G_GNUC_UNUSED
^
/usr/include/glib-2.0/glib/gmacros.h:238:47: note: in definition of macro 'G_PASTE_ARGS'
#define G_PASTE_ARGS(identifier1,identifier2) identifier1 ## identifier2
^~~~~~~~~~~
/usr/include/glib-2.0/glib/gmacros.h:241:44: note: in expansion of macro 'G_PASTE'
#define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1] G_GNUC_UNUSED
^~~~~~~
/usr/include/glib-2.0/glib/gtypes.h:423:3: note: in expansion of macro 'G_STATIC_ASSERT'
G_STATIC_ASSERT(sizeof (unsigned long long) == sizeof (guint64));
^~~~~~~~~~~~~~~
# github.com/mattn/go-gtk/pango
In file included from /usr/lib/x86_64-linux-gnu/glib-2.0/include/glibconfig.h:9:0,
from /usr/include/glib-2.0/glib/gtypes.h:32,
from /usr/include/glib-2.0/glib/galloca.h:32,
from /usr/include/glib-2.0/glib.h:30,
from /usr/include/pango-1.0/pango/pango-coverage.h:25,
from /usr/include/pango-1.0/pango/pango-font.h:25,
from /usr/include/pango-1.0/pango/pango-attributes.h:25,
from /usr/include/pango-1.0/pango/pango.h:25,
from ./pango.go.h:7,
from ../github.com/mattn/go-gtk/pango/pango.go:5:
/usr/include/glib-2.0/glib/gtypes.h: In function '_GLIB_CHECKED_ADD_U64':
/usr/include/glib-2.0/glib/gmacros.h:241:53: error: size of array '_GStaticAssertCompileTimeAssertion_0' is negative
#define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1] G_GNUC_UNUSED
^
/usr/include/glib-2.0/glib/gmacros.h:238:47: note: in definition of macro 'G_PASTE_ARGS'
#define G_PASTE_ARGS(identifier1,identifier2) identifier1 ## identifier2
^~~~~~~~~~~
/usr/include/glib-2.0/glib/gmacros.h:241:44: note: in expansion of macro 'G_PASTE'
#define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1] G_GNUC_UNUSED
^~~~~~~
/usr/include/glib-2.0/glib/gtypes.h:423:3: note: in expansion of macro 'G_STATIC_ASSERT'
G_STATIC_ASSERT(sizeof (unsigned long long) == sizeof (guint64));```

How can I fix this error on the compilation of OpenCV through mingw32-make?

I'm trying to compile the latest version of opencv 3 in windows for Mingw64, using cmake-gui and I've been encountering some errors in the compiling the source files.
I have had a number of problems I've addressed so far through reading solutions for other people, but I've run into one that I can't fix. I have been unable to compile the highgui library, and if I leave it out, the compilation turns out fine.
I used the regular mingw32-make, from Mingw 64.
Here's the error log, it's pretty long and cumbersome but I hope it can provide some insight:
Scanning dependencies of target opencv_highgui
[ 83%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/window.cpp.obj
[ 83%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/roiSelector.cpp.obj
[ 83%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/window_w32.cpp.obj
In file included from C:\opencv\sources\modules\highgui\src\window_w32.cpp:56:
C:/mingw/mingw64/x86_64-w64-mingw32/include/commctrl.h:8: error: unterminated #ifndef
#ifndef _INC_COMMCTRL
C:\opencv\sources\modules\highgui\src\window_w32.cpp: In function 'void icvLoadWindowPos(const char*, CvRect&)':
C:\opencv\sources\modules\highgui\src\window_w32.cpp:311:46: error: invalid conversion from 'int' to 'const char*' [-fpermissive]
strcpy( szKey, 1024, icvWindowPosRootKey );
^
C:\opencv\sources\modules\highgui\src\window_w32.cpp:311:46: error: too many arguments to function 'char* strcpy(char*, const char*)'
In file included from C:/mingw/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/cstring:42,
from C:/opencv/sources/modules/core/include/opencv2/core/cvstd.hpp:53,
from C:/opencv/sources/modules/core/include/opencv2/core/base.hpp:58,
from C:/opencv/sources/modules/core/include/opencv2/core.hpp:54,
from C:/opencv/sources/modules/highgui/include/opencv2/highgui.hpp:46,
from C:\opencv\sources\modules\highgui\src\precomp.hpp:45,
from C:\opencv\sources\modules\highgui\src\window_w32.cpp:42:
C:/mingw/mingw64/x86_64-w64-mingw32/include/string.h:61:18: note: declared here
char * __cdecl strcpy(char * __restrict__ _Dest,const char * __restrict__ _Source);
^~~~~~
C:\opencv\sources\modules\highgui\src\window_w32.cpp:312:31: error: invalid conversion from 'int' to 'const char*' [-fpermissive]
strcat( szKey, 1024, name );
^
C:\opencv\sources\modules\highgui\src\window_w32.cpp:312:31: error: too many arguments to function 'char* strcat(char*, const char*)'
In file included from C:/mingw/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/cstring:42,
from C:/opencv/sources/modules/core/include/opencv2/core/cvstd.hpp:53,
from C:/opencv/sources/modules/core/include/opencv2/core/base.hpp:58,
from C:/opencv/sources/modules/core/include/opencv2/core.hpp:54,
from C:/opencv/sources/modules/highgui/include/opencv2/highgui.hpp:46,
from C:\opencv\sources\modules\highgui\src\precomp.hpp:45,
from C:\opencv\sources\modules\highgui\src\window_w32.cpp:42:
C:/mingw/mingw64/x86_64-w64-mingw32/include/string.h:62:18: note: declared here
char * __cdecl strcat(char * __restrict__ _Dest,const char * __restrict__ _Source);
^~~~~~
C:\opencv\sources\modules\highgui\src\window_w32.cpp: In function 'void icvSaveWindowPos(const char*, CvRect)':
C:\opencv\sources\modules\highgui\src\window_w32.cpp:372:46: error: invalid conversion from 'int' to 'const char*' [-fpermissive]
strcpy( szKey, 1024, icvWindowPosRootKey );
^
C:\opencv\sources\modules\highgui\src\window_w32.cpp:372:46: error: too many arguments to function 'char* strcpy(char*, const char*)'
In file included from C:/mingw/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/cstring:42,
from C:/opencv/sources/modules/core/include/opencv2/core/cvstd.hpp:53,
from C:/opencv/sources/modules/core/include/opencv2/core/base.hpp:58,
from C:/opencv/sources/modules/core/include/opencv2/core.hpp:54,
from C:/opencv/sources/modules/highgui/include/opencv2/highgui.hpp:46,
from C:\opencv\sources\modules\highgui\src\precomp.hpp:45,
from C:\opencv\sources\modules\highgui\src\window_w32.cpp:42:
C:/mingw/mingw64/x86_64-w64-mingw32/include/string.h:61:18: note: declared here
char * __cdecl strcpy(char * __restrict__ _Dest,const char * __restrict__ _Source);
^~~~~~
C:\opencv\sources\modules\highgui\src\window_w32.cpp:373:31: error: invalid conversion from 'int' to 'const char*' [-fpermissive]
strcat( szKey, 1024, name );
^
C:\opencv\sources\modules\highgui\src\window_w32.cpp:373:31: error: too many arguments to function 'char* strcat(char*, const char*)'
In file included from C:/mingw/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/cstring:42,
from C:/opencv/sources/modules/core/include/opencv2/core/cvstd.hpp:53,
from C:/opencv/sources/modules/core/include/opencv2/core/base.hpp:58,
from C:/opencv/sources/modules/core/include/opencv2/core.hpp:54,
from C:/opencv/sources/modules/highgui/include/opencv2/highgui.hpp:46,
from C:\opencv\sources\modules\highgui\src\precomp.hpp:45,
from C:\opencv\sources\modules\highgui\src\window_w32.cpp:42:
C:/mingw/mingw64/x86_64-w64-mingw32/include/string.h:62:18: note: declared here
char * __cdecl strcat(char * __restrict__ _Dest,const char * __restrict__ _Source);
^~~~~~
C:\opencv\sources\modules\highgui\src\window_w32.cpp:383:52: error: invalid conversion from 'int' to 'const char*' [-fpermissive]
strcpy( rootKey, 1024, icvWindowPosRootKey );
^
C:\opencv\sources\modules\highgui\src\window_w32.cpp:383:52: error: too many arguments to function 'char* strcpy(char*, const char*)'
In file included from C:/mingw/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/cstring:42,
from C:/opencv/sources/modules/core/include/opencv2/core/cvstd.hpp:53,
from C:/opencv/sources/modules/core/include/opencv2/core/base.hpp:58,
from C:/opencv/sources/modules/core/include/opencv2/core.hpp:54,
from C:/opencv/sources/modules/highgui/include/opencv2/highgui.hpp:46,
from C:\opencv\sources\modules\highgui\src\precomp.hpp:45,
from C:\opencv\sources\modules\highgui\src\window_w32.cpp:42:
C:/mingw/mingw64/x86_64-w64-mingw32/include/string.h:61:18: note: declared here
char * __cdecl strcpy(char * __restrict__ _Dest,const char * __restrict__ _Source);
^~~~~~
C:\opencv\sources\modules\highgui\src\window_w32.cpp:402:53: error: invalid conversion from 'int' to 'const char*' [-fpermissive]
strcpy( oldestKey, 1024, currentKey );
^
C:\opencv\sources\modules\highgui\src\window_w32.cpp:402:53: error: too many arguments to function 'char* strcpy(char*, const char*)'
In file included from C:/mingw/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/cstring:42,
from C:/opencv/sources/modules/core/include/opencv2/core/cvstd.hpp:53,
from C:/opencv/sources/modules/core/include/opencv2/core/base.hpp:58,
from C:/opencv/sources/modules/core/include/opencv2/core.hpp:54,
from C:/opencv/sources/modules/highgui/include/opencv2/highgui.hpp:46,
from C:\opencv\sources\modules\highgui\src\precomp.hpp:45,
from C:\opencv\sources\modules\highgui\src\window_w32.cpp:42:
C:/mingw/mingw64/x86_64-w64-mingw32/include/string.h:61:18: note: declared here
char * __cdecl strcpy(char * __restrict__ _Dest,const char * __restrict__ _Source);
^~~~~~
C:\opencv\sources\modules\highgui\src\window_w32.cpp: In function 'LRESULT HighGUIProc(HWND, UINT, WPARAM, LPARAM)':
C:\opencv\sources\modules\highgui\src\window_w32.cpp:1629:24: warning: left operand of comma operator has no effect [-Wunused-value]
} while (0,0); // (0,0) instead of (0) to avoid MSVC compiler warning C4127: "conditional expression is constant"
^
C:\opencv\sources\modules\highgui\src\window_w32.cpp: In function 'LRESULT MainWindowProc(HWND, UINT, WPARAM, LPARAM)':
C:\opencv\sources\modules\highgui\src\window_w32.cpp:1460:55: warning: this statement may fall through [-Wimplicit-fallthrough=]
pos->y = mi.rcMonitor.bottom - pos->cy; // snap to bottom edge
^
C:\opencv\sources\modules\highgui\src\window_w32.cpp:1463:5: note: here
case WM_ACTIVATE:
^~~~
C:\opencv\sources\modules\highgui\src\window_w32.cpp: In function 'int cvWaitKey(int)':
C:\opencv\sources\modules\highgui\src\window_w32.cpp:2075:21: warning: this statement may fall through [-Wimplicit-fallthrough=]
if ('S' == message.wParam && (::GetKeyState(VK_CONTROL)>>15))
^~
C:\opencv\sources\modules\highgui\src\window_w32.cpp:2078:17: note: here
default:
^~~~~~~
mingw32-make[2]: *** [modules\highgui\CMakeFiles\opencv_highgui.dir\build.make:91: modules/highgui/CMakeFiles/opencv_highgui.dir/src/window_w32.cpp.obj] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:1832: modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2
mingw32-make: *** [Makefile:162: all] Error 2
Thanks in advance for your help!
EDIT:
I reverted strcpy and strcat to strcpy_s and strcat_s because of argument issues causing the error, and went back to this:
Scanning dependencies of target opencv_highgui
[ 81%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/window.cpp.obj
[ 82%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/roiSelector.cpp.obj
[ 82%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/window_w32.cpp.obj
In file included from C:\opencv\sources\modules\highgui\src\window_w32.cpp:56:
C:/mingw/mingw64/x86_64-w64-mingw32/include/commctrl.h:8: error: unterminated #ifndef
#ifndef _INC_COMMCTRL
C:\opencv\sources\modules\highgui\src\window_w32.cpp: In function 'LRESULT HighGUIProc(HWND, UINT, WPARAM, LPARAM)':
C:\opencv\sources\modules\highgui\src\window_w32.cpp:1629:24: warning: left operand of comma operator has no effect [-Wunused-value]
} while (0,0); // (0,0) instead of (0) to avoid MSVC compiler warning C4127: "conditional expression is constant"
^
C:\opencv\sources\modules\highgui\src\window_w32.cpp: In function 'LRESULT MainWindowProc(HWND, UINT, WPARAM, LPARAM)':
C:\opencv\sources\modules\highgui\src\window_w32.cpp:1460:55: warning: this statement may fall through [-Wimplicit-fallthrough=]
pos->y = mi.rcMonitor.bottom - pos->cy; // snap to bottom edge
^
C:\opencv\sources\modules\highgui\src\window_w32.cpp:1463:5: note: here
case WM_ACTIVATE:
^~~~
C:\opencv\sources\modules\highgui\src\window_w32.cpp: In function 'int cvWaitKey(int)':
C:\opencv\sources\modules\highgui\src\window_w32.cpp:2075:21: warning: this statement may fall through [-Wimplicit-fallthrough=]
if ('S' == message.wParam && (::GetKeyState(VK_CONTROL)>>15))
^~
C:\opencv\sources\modules\highgui\src\window_w32.cpp:2078:17: note: here
default:
^~~~~~~
mingw32-make[2]: *** [modules\highgui\CMakeFiles\opencv_highgui.dir\build.make:91: modules/highgui/CMakeFiles/opencv_highgui.dir/src/window_w32.cpp.obj] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:1880: modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2
mingw32-make: *** [Makefile:162: all] Error 2
EDIT 2: Finally fixed it, thanks for your help. The commctrl.h file needed an extra endif in the end.

install error for nmatrix gem in windows 8

I am trying to install the nmatrix gem. i have the gcc compiler installed:
C:\dev\DNA>gcc --version
gcc (GCC) 4.9.3
Copyright (C) 2015 Free Software Foundation, Inc.
then I have the following error on install:
C:\dev\DNA>gem install nmatrix
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing nmatrix:
ERROR: Failed to build gem native extension.
C:/Ruby21/bin/ruby.exe extconf.rb
using C++ standard... c++11
g++ reports version... 4.7.2
checking for rb_array_const_ptr() in ruby.h... no
checking for FIX_CONST_VALUE_PTR in ruby.h... no
checking for RARRAY_CONST_PTR in ruby.h... yes
checking for RARRAY_AREF in ruby.h... yes
creating nmatrix_config.h
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
generating nmatrix-i386-mingw32.def
compiling nmatrix.cpp
In file included from ./storage/storage.h:48:0,
from util/io.h:38,
from nmatrix.cpp:46:
./storage/common.h:155:3: error: 'u_int8_t' has not been declared
./storage/common.h:157:3: error: redefinition of 'VALUE nm::ew_op_switch(LDType,
RDType) [with nm::ewop_t op = (nm::ewop_t)3u; LDType = signed char; RDType = in
t; VALUE = long unsigned int]'
./storage/common.h:155:3: error: 'VALUE nm::ew_op_switch(LDType, RDType) [with n
m::ewop_t op = (nm::ewop_t)3u; LDType = signed char; RDType = int; VALUE = long
unsigned int]' previously declared here
./storage/common.h:165:3: error: 'u_int8_t' has not been declared
./storage/common.h:167:3: error: redefinition of 'VALUE nm::ew_op_switch(LDType,
RDType) [with nm::ewop_t op = (nm::ewop_t)3u; LDType = float; RDType = int; VAL
UE = long unsigned int]'
./storage/common.h:165:3: error: 'VALUE nm::ew_op_switch(LDType, RDType) [with n
m::ewop_t op = (nm::ewop_t)3u; LDType = float; RDType = int; VALUE = long unsign
ed int]' previously declared here
./storage/common.h:170:3: error: 'u_int8_t' has not been declared
./storage/common.h:172:3: error: redefinition of 'VALUE nm::ew_op_switch(LDType,
RDType) [with nm::ewop_t op = (nm::ewop_t)3u; LDType = double; RDType = int; VA
LUE = long unsigned int]'
./storage/common.h:170:3: error: 'VALUE nm::ew_op_switch(LDType, RDType) [with n
m::ewop_t op = (nm::ewop_t)3u; LDType = double; RDType = int; VALUE = long unsig
ned int]' previously declared here
In file included from nmatrix.cpp:283:0:
ruby_nmatrix.c: In function 'VALUE nm_reshape_bang(VALUE, VALUE)':
ruby_nmatrix.c:1102:11: warning: unused variable 'elem' [-Wunused-variable]
ruby_nmatrix.c: In function 'VALUE nm_mset(int, VALUE*, VALUE)':
ruby_nmatrix.c:2013:109: warning: format '%lu' expects argument of type 'long un
signed int', but argument 4 has type 'size_t {aka unsigned int}' [-Wformat]
ruby_nmatrix.c: In function 'VALUE nm_xslice(int, VALUE*, void* (*)(const STORAG
E*, SLICE*), void (*)(NMATRIX*), VALUE)':
ruby_nmatrix.c:2251:92: warning: format '%lu' expects argument of type 'long uns
igned int', but argument 4 has type 'size_t {aka unsigned int}' [-Wformat]
ruby_nmatrix.c: In function 'SLICE* get_slice(size_t, int, VALUE*, size_t*)':
ruby_nmatrix.c:2729:106: warning: format '%lu' expects argument of type 'long un
signed int', but argument 3 has type 'size_t {aka unsigned int}' [-Wformat]
ruby_nmatrix.c:2729:106: warning: format '%lu' expects argument of type 'long un
signed int', but argument 4 has type 'size_t {aka unsigned int}' [-Wformat]
ruby_nmatrix.c: In function 'void* interpret_initial_value(VALUE, nm::dtype_t)':
ruby_nmatrix.c:2800:29: warning: comparison between signed and unsigned integer
expressions [-Wsign-compare]
make: *** [nmatrix.o] Error 1
make failed, exit code 2
Gem files will remain installed in C:/Ruby21/lib/ruby/gems/2.1.0/gems/nmatrix-0.
2.1 for inspection.
Results logged to C:/Ruby21/lib/ruby/gems/2.1.0/extensions/x86-mingw32/2.1.0/nma
trix-0.2.1/gem_make.out
Would be really great to try out this library! Any ideas how to make the install succesful? thanks

Can't compile OpenCV 2.4.6 with CUDA 5.5 on Fedora 19

OpenCV 2.4.6 adds support for CUDA 5.5, but attempts to build it fail. CUDA is installed from the repository for Fedora 18. OpenCV itself without the support of CUDA is also going well.
[ 1%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/gpumat.cpp.o
/home/lucky/programming/sphinx/build/3rdparty/opencv/opencv-2.4.6.1/modules/core/src/gpumat.cpp:288:52: error: 'bool cv::gpu::deviceSupports(cv::gpu::FeatureSet)' should have been declared inside 'cv::gpu'
bool cv::gpu::deviceSupports(FeatureSet feature_set)
^
/home/lucky/programming/sphinx/build/3rdparty/opencv/opencv-2.4.6.1/modules/core/src/gpumat.cpp: In function 'bool cv::gpu::deviceSupports(cv::gpu::FeatureSet)':
/home/lucky/programming/sphinx/build/3rdparty/opencv/opencv-2.4.6.1/modules/core/src/gpumat.cpp:288:6: warning: no previous declaration for 'bool cv::gpu::deviceSupports(cv::gpu::FeatureSet)' [-Wmissing-declarations]
bool cv::gpu::deviceSupports(FeatureSet feature_set)
^
/home/lucky/programming/sphinx/build/3rdparty/opencv/opencv-2.4.6.1/modules/core/src/gpumat.cpp: At global scope:
/home/lucky/programming/sphinx/build/3rdparty/opencv/opencv-2.4.6.1/modules/core/src/gpumat.cpp:359:49: error: no 'size_t cv::gpu::DeviceInfo::sharedMemPerBlock() const' member function declared in class 'cv::gpu::DeviceInfo'
size_t cv::gpu::DeviceInfo::sharedMemPerBlock() const
^
/home/lucky/programming/sphinx/build/3rdparty/opencv/opencv-2.4.6.1/modules/core/src/gpumat.cpp: In function 'void cv::gpu::createContinuous(int, int, int, cv::gpu::GpuMat&)':
/home/lucky/programming/sphinx/build/3rdparty/opencv/opencv-2.4.6.1/modules/core/src/gpumat.cpp:794:6: error: redefinition of 'void cv::gpu::createContinuous(int, int, int, cv::gpu::GpuMat&)'
void cv::gpu::createContinuous(int rows, int cols, int type, GpuMat& m)
^
In file included from /home/lucky/programming/sphinx/build/3rdparty/opencv/opencv-2.4.6.1/modules/core/src/gpumat.cpp:44:0:
/home/lucky/programming/sphinx/build/output/include/opencv2/core/gpumat.hpp:551:17: error: 'void cv::gpu::createContinuous(int, int, int, cv::gpu::GpuMat&)' previously defined here
inline void createContinuous(int rows, int cols, int type, GpuMat& m)
^
/home/lucky/programming/sphinx/build/3rdparty/opencv/opencv-2.4.6.1/modules/core/src/gpumat.cpp: In function 'void cv::gpu::ensureSizeIsEnough(int, int, int, cv::gpu::GpuMat&)':
/home/lucky/programming/sphinx/build/3rdparty/opencv/opencv-2.4.6.1/modules/core/src/gpumat.cpp:806:6: error: redefinition of 'void cv::gpu::ensureSizeIsEnough(int, int, int, cv::gpu::GpuMat&)'
void cv::gpu::ensureSizeIsEnough(int rows, int cols, int type, GpuMat& m)
^
In file included from /home/lucky/programming/sphinx/build/3rdparty/opencv/opencv-2.4.6.1/modules/core/src/gpumat.cpp:44:0:
/home/lucky/programming/sphinx/build/output/include/opencv2/core/gpumat.hpp:559:17: error: 'void cv::gpu::ensureSizeIsEnough(int, int, int, cv::gpu::GpuMat&)' previously defined here
inline void ensureSizeIsEnough(int rows, int cols, int type, GpuMat& m)
^
/home/lucky/programming/sphinx/build/3rdparty/opencv/opencv-2.4.6.1/modules/core/src/gpumat.cpp: In function 'cv::gpu::GpuMat cv::gpu::allocMatFromBuf(int, int, int, cv::gpu::GpuMat&)':
/home/lucky/programming/sphinx/build/3rdparty/opencv/opencv-2.4.6.1/modules/core/src/gpumat.cpp:831:8: error: redefinition of 'cv::gpu::GpuMat cv::gpu::allocMatFromBuf(int, int, int, cv::gpu::GpuMat&)'
GpuMat cv::gpu::allocMatFromBuf(int rows, int cols, int type, GpuMat &mat)
^
In file included from /home/lucky/programming/sphinx/build/3rdparty/opencv/opencv-2.4.6.1/modules/core/src/gpumat.cpp:44:0:
/home/lucky/programming/sphinx/build/output/include/opencv2/core/gpumat.hpp:567:19: error: 'cv::gpu::GpuMat cv::gpu::allocMatFromBuf(int, int, int, cv::gpu::GpuMat&)' previously defined here
inline GpuMat allocMatFromBuf(int rows, int cols, int type, GpuMat &mat)
^
At global scope:
cc1plus: warning: unrecognized command line option "-Wno-unnamed-type-template-args" [enabled by default]
make[2]: *** [modules/core/CMakeFiles/opencv_core.dir/src/gpumat.cpp.o] Error 1
make[1]: *** [modules/core/CMakeFiles/opencv_core.dir/all] Error 2
make: *** [all] Error 2
Is there a way to solve the problem? Or is it a problem too new version of GCC?
It seems #jet47 has elected not to respond to my request in the comments, so I'm posting this answer so that we can call this question answered (which it clearly has been in the comments.)
Make sure that you only have one installed OpenCV version, if you experience a problem like this. If you locate other installed versions besides the one intended, remove them.

Resources