Page 1 of 3

Compiling wxWidgets 3.0.4 on Cygwin

Posted: Mon Jul 08, 2019 8:51 pm
by hamishmb
Hi all,

I've been trying to compile wxWidgets 3.0.4 on Cygwin, but keep encountering this error:

Code: Select all

error: ‘pthread_setconcurrency’ was not declared in this scope
I have checked the relevant .cpp file, and it is including pthread.h, which does define pthread_setconcurrency, so I'm kind of at a loss here. Is this a known issue with a workaround?

Hamish

Re: Compiling wxWidgets 3.0.4 on Cygwin

Posted: Tue Jul 09, 2019 2:20 pm
by ONEEYEMAN
Hi,
How exactly are you trying to build it?
Did you use configure? Which options did you pass?

Thank you.

Re: Compiling wxWidgets 3.0.4 on Cygwin

Posted: Fri Jul 12, 2019 10:46 am
by hamishmb
Hi,

I did use configure. Here are the steps I followed:
  • Unpack the source for wxwidgets 3.0.4.
  • Make a build dir for the base (trying a minimal build first). (mkdir base && cd base)
  • Run "../configure --enable-compat26 --enable-optimise --enable-shared --enable-unicode --disable-gui --disable-rpath --with-expat --with-libiconv --with-zlib".
  • Run "make -j4"
After a little while I get the error I described above. I'm sort of following the build procedure for the wxwidgets 3.0.3 cygport, but it doesn't quite seem to work with this version. I also tried a bunch of patches from that cygport, but they don't seem to have fixed it either, so I'll ignore the patches for now until I figure out if they're needed or not :)

Hamish

Re: Compiling wxWidgets 3.0.4 on Cygwin

Posted: Fri Jul 12, 2019 10:56 am
by hamishmb
CORRECTION: I tried each of these options with ./configure:

Code: Select all

../configure --with-x11 --enable-debug --enable-unicode --with-opengl

Code: Select all

../configure --with-x11 --enable-debug --enable-unicode --with-opengl --with-libjpeg=builtin --with-regex=builtin --with-tiff=builtin --enable-xrc --disable-precomp-headers --disable-threads

Code: Select all

../configure  --with-x11 --enable-debug --enable-unicode --disable-precomp-headers --disable-threads --disable-all-features --enable-palette
And finally:

Code: Select all

../configure --enable-compat26 --enable-optimise --enable-shared --enable-unicode --disable-gui --disable-rpath --with-expat --with-libiconv --with-zlib
The last one is the same as the one I had in the above post.

Re: Compiling wxWidgets 3.0.4 on Cygwin

Posted: Fri Jul 12, 2019 11:31 am
by doublemax
Is there a particular reason you're using Cygwin?
Which compiler/version is installed?

Start with the absolute minimum of parameters:

Code: Select all

../configure --enable-debug
If that doesn't work, stop fiddling with configure, the problem is somewhere else.

Even if you need Cygwin, can you try to build wxWidgets without it and through the makefiles?

All instructions are in <wxdir>/docs/msw/install.md

Re: Compiling wxWidgets 3.0.4 on Cygwin

Posted: Fri Jul 12, 2019 12:36 pm
by hamishmb
I'm using cygwin because I'm attempting to port my Linux/macOS-based GUI to Windows, and it also has dependencies that must be run in cygwin (GNU ddrescue), so I figure running the whole lot in Cygwin is probably the way to go. I want to build this to build wxPython for Python 3 under Cygwin - that way I can drop Python 2 support sooner.

The compiler is GCC 7.4.0
Even if you need Cygwin, can you try to build wxWidgets without it and through the makefiles?
I'm not sure what you mean by that. I'll try your idea anyway and see what happens.

Re: Compiling wxWidgets 3.0.4 on Cygwin

Posted: Fri Jul 12, 2019 12:50 pm
by doublemax

Code: Select all

The compiler is GCC 7.4.0
That's newer than wxWidgets 3.0.4, which sometimes causes issues.

Can you try with wxWidgets 3.1.2 or the latest version from GIT? I would suggest to use wx 3.1.2 in any case.

Re: Compiling wxWidgets 3.0.4 on Cygwin

Posted: Fri Jul 12, 2019 12:53 pm
by hamishmb
That's newer than wxWidgets 3.0.4, which sometimes causes issues.
Thanks, good to know. I might be able to use an older compiler, but I'll see if this works - still building. Compiling in Cygwin in a VM is dead slow :lol:
Can you try with wxWidgets 3.1.2 or the latest version from GIT? I would suggest to use wx 3.1.2 in any case.
Okay, I'll give that a try too. I don't think wxPython can use wxWidgets 3.1.x yet, but worth trying if all else fails :)

Thanks for all your help!

Re: Compiling wxWidgets 3.0.4 on Cygwin

Posted: Fri Jul 12, 2019 12:59 pm
by hamishmb
Okay, that got pretty far I think. It fails at (I think) the end with:

Code: Select all

g++ -shared -o /home/Hamish/wxwidgets-build/wxWidgets-3.0.4/lib/cygwxbase30u_gcc_custom-0.dll basedll_version_rc.o basedll_any.o basedll_appbase.o basedll_arcall.o basedll_arcfind.o basedll_archive.o basedll_arrstr.o basedll_base64.o basedll_clntdata.o basedll_cmdline.o basedll_config.o basedll_convauto.o basedll_datetime.o basedll_datetimefmt.o basedll_datstrm.o basedll_dircmn.o basedll_dynarray.o basedll_dynlib.o basedll_dynload.o basedll_encconv.o basedll_evtloopcmn.o basedll_extended.o basedll_ffile.o basedll_file.o basedll_fileback.o basedll_fileconf.o basedll_filefn.o basedll_filename.o basedll_filesys.o basedll_filtall.o basedll_filtfind.o basedll_fmapbase.o basedll_fs_arc.o basedll_fs_filter.o basedll_hash.o basedll_hashmap.o basedll_init.o basedll_intl.o basedll_ipcbase.o basedll_languageinfo.o basedll_list.o basedll_log.o basedll_longlong.o basedll_memory.o basedll_mimecmn.o basedll_module.o basedll_mstream.o basedll_numformatter.o basedll_object.o basedll_platinfo.o basedll_powercmn.o basedll_process.o basedll_regex.o basedll_stdpbase.o basedll_sstream.o basedll_stdstream.o basedll_stopwatch.o basedll_strconv.o basedll_stream.o basedll_string.o basedll_stringimpl.o basedll_stringops.o basedll_strvararg.o basedll_sysopt.o basedll_tarstrm.o basedll_textbuf.o basedll_textfile.o basedll_threadinfo.o basedll_common_time.o basedll_timercmn.o basedll_timerimpl.o basedll_tokenzr.o basedll_translation.o basedll_txtstrm.o basedll_unichar.o basedll_uri.o basedll_ustring.o basedll_variant.o basedll_wfstream.o basedll_wxcrt.o basedll_wxprintf.o basedll_xlocale.o basedll_xti.o basedll_xtistrm.o basedll_zipstrm.o basedll_zstream.o basedll_fswatchercmn.o basedll_fswatcherg.o basedll_basemsw.o basedll_crashrpt.o basedll_debughlp.o basedll_dde.o basedll_msw_dir.o basedll_dlmsw.o basedll_evtloopconsole.o basedll_msw_mimetype.o basedll_power.o basedll_regconf.o basedll_registry.o basedll_msw_snglinst.o basedll_msw_stackwalk.o basedll_msw_stdpaths.o basedll_msw_thread.o basedll_timer.o basedll_msw_utils.o basedll_msw_utilsexc.o basedll_fswatcher.o  basedll_event.o basedll_fs_mem.o basedll_msgout.o basedll_utilscmn.o basedll_main.o basedll_mslu.o basedll_volume.o     -L/home/Hamish/wxwidgets-build/wxWidgets-3.0.4/lib  -Wl,--out-implib=/home/Hamish/wxwidgets-build/wxWidgets-3.0.4/lib/libwx_baseu-3.0.dll.a      -lwxregexu-3.0  -lz -lrpcrt4 -loleaut32 -lole32 -luuid -lwinspool -lwinmm -lshell32 -lcomctl32 -lcomdlg32 -ladvapi32 -lwsock32 -lgdi32 -lkernel32 -luser32  -lz -lrpcrt4 -loleaut32 -lole32 -luuid -lwinspool -lwinmm -lshell32 -lcomctl32 -lcomdlg32 -ladvapi32 -lwsock32 -lgdi32 -lkernel32 -luser32
basedll_filename.o: In function `ZNK10wxFileName17GetShortcutTargetERK8wxStringRS0_PS0_':
/home/Hamish/wxwidgets-build/wxWidgets-3.0.4/./src/common/filename.cpp:1714: undefined reference to `IID_IShellLinkW'
/home/Hamish/wxwidgets-build/wxWidgets-3.0.4/./src/common/filename.cpp:1720: undefined reference to `IID_IPersistFile'
Looks like I'm just missing some linker flags, but I haven't got a clue what I need to include - Windows development is not something I'm at all familiar with. Any ideas?

EDIT: This looks promising: viewtopic.php?t=33849. I'll try that first.

Re: Compiling wxWidgets 3.0.4 on Cygwin

Posted: Fri Jul 12, 2019 1:07 pm
by doublemax
These symbols should be in uuid.lib / libuuid.a

Re: Compiling wxWidgets 3.0.4 on Cygwin

Posted: Fri Jul 12, 2019 3:07 pm
by hamishmb
Oops, posted this in the wrong place. Okay, so using these options helped:

Code: Select all

CPPFLAGS='-w -fpermissive -D__USE_W32_SOCKETS' LDFLAGS='-L /lib/w32api/' ./configure --enable-debug
But it now gets stuck a little bit later:

Code: Select all

g++ -shared -o /home/Hamish/wxwidgets-build/wxWidgets-3.0.4/lib/cygwxmsw30u_gl_gcc_custom-0.dll gldll_version_rc.o gldll_glcmn.o gldll_msw_glcanvas.o    -L/home/Hamish/wxwidgets-build/wxWidgets-3.0.4/lib  -Wl,--out-implib=/home/Hamish/wxwidgets-build/wxWidgets-3.0.4/lib/libwx_mswu_gl-3.0.dll.a   -L /lib/w32api/ -lGLU        -lpng -lz -ljpeg -ltiff  -lwxregexu-3.0  -L /lib/w32api/ -lGLU   -lz -lrpcrt4 -loleaut32 -lole32 -luuid -lwinspool -lwinmm -lshell32 -lcomctl32 -lcomdlg32 -ladvapi32 -lwsock32 -lgdi32 -lkernel32 -luser32  -lwx_mswu_core-3.0 -lwx_baseu-3.0  -lopengl32 -lglu32 -lz -lrpcrt4 -loleaut32 -lole32 -luuid -lwinspool -lwinmm -lshell32 -lcomctl32 -lcomdlg32 -ladvapi32 -lwsock32 -lgdi32 -lkernel32 -luser32
gldll_glcmn.o: In function `ZN14wxGLCanvasBase9SetColourERK8wxString':
/home/Hamish/wxwidgets-build/wxWidgets-3.0.4/./src/common/glcmn.cpp:76: undefined reference to `glGetBooleanv'
/home/Hamish/wxwidgets-build/wxWidgets-3.0.4/./src/common/glcmn.cpp:79: undefined reference to `glColor3f'
/home/Hamish/wxwidgets-build/wxWidgets-3.0.4/./src/common/glcmn.cpp:91: undefined reference to `glIndexi'
gldll_glcmn.o: In function `ZN7wxGLAPI9glFrustumEffffff':
/home/Hamish/wxwidgets-build/wxWidgets-3.0.4/./src/common/glcmn.cpp:217: undefined reference to `glFrustum'
gldll_glcmn.o: In function `ZN7wxGLAPI7glBeginEj':
/home/Hamish/wxwidgets-build/wxWidgets-3.0.4/./src/common/glcmn.cpp:239: undefined reference to `glBegin'
gldll_glcmn.o: In function `ZN7wxGLAPI12glTexCoord2fEff':
/home/Hamish/wxwidgets-build/wxWidgets-3.0.4/./src/common/glcmn.cpp:258: undefined reference to `glTexCoord2f'
gldll_glcmn.o: In function `ZN7wxGLAPI10glVertex3fEfff':
/home/Hamish/wxwidgets-build/wxWidgets-3.0.4/./src/common/glcmn.cpp:288: undefined reference to `glVertex3f'
gldll_glcmn.o: In function `ZN7wxGLAPI10glNormal3fEfff':
/home/Hamish/wxwidgets-build/wxWidgets-3.0.4/./src/common/glcmn.cpp:305: undefined reference to `glNormal3f'
gldll_glcmn.o: In function `ZN7wxGLAPI9glColor4fEffff':
/home/Hamish/wxwidgets-build/wxWidgets-3.0.4/./src/common/glcmn.cpp:323: undefined reference to `glColor4f'
gldll_glcmn.o: In function `ZN7wxGLAPI9glColor3fEfff':
/home/Hamish/wxwidgets-build/wxWidgets-3.0.4/./src/common/glcmn.cpp:332: undefined reference to `glColor3f'
gldll_glcmn.o: In function `ZN7wxGLAPI5glEndEv':
/home/Hamish/wxwidgets-build/wxWidgets-3.0.4/./src/common/glcmn.cpp:373: undefined reference to `glEnd'
collect2: error: ld returned 1 exit status
make: *** [Makefile:16113: /home/Hamish/wxwidgets-build/wxWidgets-3.0.4/lib/cygwxmsw30u_gl_gcc_custom-0.dll] Error 1
make: *** Waiting for unfinished jobs....
As far as I can tell, it's trying to build the wxmsw version, rather than the X11 version. Is this what I want to be doing, or do I need to tell it to build for X11?

Re: Compiling wxWidgets 3.0.4 on Cygwin

Posted: Fri Jul 12, 2019 3:22 pm
by hamishmb
Regardless, I'm pretty sure I need to compile with the --with-x11 flag in order to do what I need to do, which immediately takes me back to the pthread_setconcurrency error.

I'm assuming somewhere in the header files or configure script it's assuming it's building for Windows, rather than a Unix-like operating system, and it's not setting the #includes up properly?

I might be able to make a patch for this if so, but I'd need some pointers as to which header files are likely to be the ones I need to look at.

Re: Compiling wxWidgets 3.0.4 on Cygwin

Posted: Fri Jul 12, 2019 3:53 pm
by doublemax
Are you sure you need X11? Are you sure this worked with wx 3.0.3? If yes, you may want to open a ticket at http://trac.wxwidgets.org

This is probably a configuration that hardly anyone ever tests, so it's possible that it becomes broken unnoticed.

Re: Compiling wxWidgets 3.0.4 on Cygwin

Posted: Fri Jul 12, 2019 4:31 pm
by ONEEYEMAN
Hi,
The Cygwin environment was created to build and run program that was made for Windows.
Why do you think you need to configure for X11?

Besides building the X11 is not recommended - doing so will open you for a lot of bugs and non-implemented features and you will be on your own.

As doublemax said - on Windows you should build with "--with-msw", but Cygwin is an environment which is rarely used - 99% of people are using MinGW with Windows directly.

Thank you.

Re: Compiling wxWidgets 3.0.4 on Cygwin

Posted: Fri Jul 12, 2019 4:34 pm
by stahta01
What do you get at this stage before typing make?

Code: Select all

Configured wxWidgets 3.0.4 for `x86_64-unknown-cygwin'

  Which GUI toolkit should wxWidgets use?                 x11
  Should wxWidgets be compiled into single library?       no
  Should wxWidgets be linked as a shared library?         yes
  Should wxWidgets support Unicode?                       yes (using wchar_t)
  What level of wxWidgets compatibility should be enabled?
                                       wxWidgets 2.6      no
                                       wxWidgets 2.8      yes
  Which libraries should wxWidgets use?
                                       STL                no
                                       jpeg               builtin
                                       png                sys
                                       regex              builtin
                                       tiff               builtin
                                       xpm                yes
                                       zlib               sys
                                       expat              sys
                                       libmspack          no
                                       sdl                no