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

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));```

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 about making this work with a #include? It works fine when dropped straight into the code

I have a block of code that I want to #include in my z/OS Metal C program, it works fine when it's just part of the program, but when I put it into a .h file and #include it, the code won't compile.
I have successfully gotten this code to work without #include. I'm sure I'm overlooking something having to do with #include...
This code works:
#pragma margins(2,72)
*#if 0!=0
Test DSECT
Test# DS A
TestINT DS F
TestChar DS C
.ago end
*#endif
*struct Test {
* void *Test1;
* int TestInt;
* char TestChar;
*};
*#if 0!=0
.end
MEND
*#endif
#pragma nomargins
Giving compiler output that looks like this:
207 |#pragma margins(2,72)
207 +
208 |#if 0!=0
214 |#endif
215 |struct Test {
216 | void *Test1;
5650ZOS V2.1.1 z/OS XL C 'SSAF.METALC.C(CKKTHING)'
* * * * * S O U R C E * * * * *
LINE STMT
*...+....1....+....2....+....3....+....4....+....5....+....6....+
217 | int TestInt;
218 | char TestChar;
219 |};
220 |#if 0!=0
223 |#endif
224 |#pragma nomargins
But, when I put the code into an #include file like this:
EDIT SSAF.METALC.H(CKKTEST)
Command ===>
****** **************************
000001 *#if 0!=0
000002 Test DSECT
000003 Test# DS A
000004 TestINT DS F
000005 TestChar DS C
000006 .ago end
000007 *#endif
000008 *struct Test {
000009 * void *Test1;
000010 * int TestInt;
000011 * char TestChar;
000012 *};
000013 *#if 0!=0
000014 .end
000015 MEND
000016 *#endif
****** **************************
and include it in my Metal C program:
EDIT SSAF.METALC.C(CKLTHING) - 01.00
Command ===>
000205 #include"ckkprolg.h"
000206
000207 #pragma margins(2,72)
000208 #include"ckktest.h"
000209 #pragma nomargins
I get a bunch of error messages:
205 |#include"ckkprolg.h" /* Include assembler macros needed
206 | for Metal C prolog and epilog */
207 |#pragma margins(2,72)
207 +
208 |#include"ckktest.h"
*=ERROR===========> CCN3275 Unexpected text 'struct' encountered.
*=ERROR===========> CCN3166 Definition of function Test requires parentheses.
*=ERROR===========> CCN3275 Unexpected text 'void' encountered.
5650ZOS V2.1.1 z/OS XL C 'SSAF.METALC.C(CKLTHING)' 10/04/2019
* * * * * S O U R C E * * * * *
LINE STMT
*...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9...
*=ERROR===========> CCN3045 Undeclared identifier Test1.
*=ERROR===========> CCN3275 Unexpected text 'int' encountered.
*=ERROR===========> CCN3045 Undeclared identifier TestInt.
*=ERROR===========> CCN3275 Unexpected text 'char' encountered.
*=ERROR===========> CCN3045 Undeclared identifier TestChar.
*=ERROR===========> CCN3046 Syntax error.
*=ERROR===========> CCN3273 Missing type in declaration of theESTAEXStatic.
209 |#pragma nomargins
The include file is missing #pragma margins. Since it is a file level directive, it needs to be present in each source file. Please see IBM Knowledge Center, which says, "The setting specified by the #pragma margins directive applies only to the source file or include file in which it is found. It has no effect on other include files."

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.

Cannot install uwsgi on Alpine

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.

ROS Custom message with sensor_msgs/Image Publisher

I have a custom .msg file MyImage.msg
sensor_msgs/Image im
float32 age
string name
I have configured the custom .msg fle as illustrated in link:CreatingMsgAndSrv
Further, I am trying to write a simple publisher with this msg.
#include <ros/ros.h>
#include <custom_msg/MyImage.h>
#include <image_transport/image_transport.h>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/opencv.hpp>
#include <cv_bridge/cv_bridge.h>
int main( int argc, char ** argv )
{
ros::init(argc, argv, "publish_custom");
ros::NodeHandle nh;
ros::Publisher pub2 = nh.advertise<custom_msg::MyImage>("custom_image", 2 );
cv::Mat image = cv::imread( "Lenna.png", CV_LOAD_IMAGE_COLOR );
sensor_msgs::ImagePtr im_msg = cv_bridge::CvImage(std_msgs::Header(), "bgr8", image).toImageMsg();
ros::Rate rate( 2 );
while( ros::ok() )
{
ROS_INFO_STREAM_ONCE( "IN main loop");
custom_msg::MyImage msg2;
msg2.age=54.3;
msg2.im = im_msg;
msg2.name="Gena";
pub2.publish(msg2);
rate.sleep();
}
}
This does not seem to compile with catkin_make. The error messages are -
/home/eeuser/ros_workspaces/HeloRosProject/src/custom_msg/publish.cpp: In function ‘int main(int, char**)’:
/home/eeuser/ros_workspaces/HeloRosProject/src/custom_msg/publish.cpp:40:19: error: no match for ‘operator=’ in ‘msg2.custom_msg::MyImage_<std::allocator<void> >::im = im_msg’
/home/eeuser/ros_workspaces/HeloRosProject/src/custom_msg/publish.cpp:40:19: note: candidate is:
/opt/ros/hydro/include/sensor_msgs/Image.h:56:8: note: sensor_msgs::Image_<std::allocator<void> >& sensor_msgs::Image_<std::allocator<void> >::operator=(const sensor_msgs::Image_<std::allocator<void> >&)
/opt/ros/hydro/include/sensor_msgs/Image.h:56:8: note: no known conversion for argument 1 from ‘sensor_msgs::ImagePtr {aka boost::shared_ptr<sensor_msgs::Image_<std::allocator<void> > >}’ to ‘const sensor_msgs::Image_<std::allocator<void> >&’
make[2]: *** [custom_msg/CMakeFiles/publish.dir/publish.cpp.o] Error 1
make[1]: *** [custom_msg/CMakeFiles/publish.dir/all] Error 2
make: *** [all] Error 2
Invoking "make" failed
I can understand that msg2.im = im_msg; isn't correct. Please help me fix this.
You are trying to assign a sensor_msgs::ImagePtr (a pointer) to a sensor_msgs::Image field. Simply you can't. Just look at the fifth line of your error log:
no known conversion for argument 1 from ‘sensor_msgs::ImagePtr {aka boost::shared_ptr<sensor_msgs::Image_<std::allocator<void> > >}’ to ‘const sensor_msgs::Image_<std::allocator<void> >&’
To solve this simple issue, just add the dereference operator (*) to that pointer:
msg2.im = *im_msg;
I assume that there are no other errors in the code.

Resources