FLTK logo

STR #3454

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 Home  |  Articles & FAQs  |  Bugs & Features  |  Documentation  |  Download  |  Screenshots  ]
 

Return to Bugs & Features | SVN ⇄ GIT ]

STR #3454

Application:FLTK Library
Status:1 - Closed w/Resolution
Priority:3 - Moderate, e.g. unable to compile the software
Scope:2 - Specific to an operating system
Subsystem:WIN32
Summary:MinGW build errors (undefined: S_OK and __FD_ISSET)
Version:1.4-current
Created By:AlbrechtS
Assigned To:AlbrechtS
Fix Version:1.3.5 (SVN: v12679)
Fix Commit:67fd2793a31accc0ac01db24dc11d10e0e6505d5
Update Notification:

Receive EMails Don't Receive EMails

Trouble Report Files:


Name/Time/Date Filename/Size  
 
#1 AlbrechtS
06:52 Feb 19, 2018
mingw-winsock-fltk-1.3_r12678.patch
4k
 
     

Trouble Report Comments:


Name/Time/Date Text  
 
#1 AlbrechtS
04:53 Feb 19, 2018
We got a report in fltk.general in thread "fltk 1.3.4-2 compile error on windows 7". It turned out that this is an issue of the latest MinGW version which is incompatible with previous versions and our usage of the MinGW/Windows headers and, last but not least, our attempt to load the winsock dll (actually winsock2, ws2_32.lib/.dll) dynamically to avoid link time dependencies.

The current MinGW headers have two issues, as I already wrote in fltk.general:

(1) The first issue is minor and can be fixed easily, although I do no yet understand why it happens. It looks as if the header ole2.h should #include <winerror.h> which defines S_OK. This worked in older MinGW versions but broke somehow in the latest version (or earlier, I don't know exactly which one).

>> Fl_win32.cxx:2712:97: error: 'S_OK' was not declared in this scope

This was the report of the OP. It does not manifest with FLTK 1.4, but I can confirm it exists with FLTK 1.3.4-svn. A simple patch is to #include <winerror.h> explicitly.


(2) After issue (1) is fixed (FLTK 1.3 only) we get this linker error:

Linking CXX executable ../bin/fluid.exe
../lib/libfltk.a(Fl_win32.cxx.obj): In function `_FD_SET':
c:/mingw_xx/include/winsock.h:174: undefined reference to `__FD_ISSET'
c:/mingw_xx/include/winsock.h:174: undefined reference to `__FD_ISSET'
c:/mingw_xx/include/winsock.h:174: undefined reference to `__FD_ISSET'
collect2.exe: error: ld returned 1 exit status

This error exists for FLTK 1.3 and 1.4 although we don't explicitly call FD_ISSET in our code.

For more information and discussion see thread:

[fltk.coredev] Latest MinGW: build errors (undefined: __FD_ISSET)

As discussed in fltk.coredev we decided to fix this in FLTK 1.3.5 with a patch that does not break the ABI, i.e. we must not link statically with ws2_32.lib/.dll. We #define FD_ISSET instead to use our internal mechanism to load the winsock dll dynamically.

FLTK 1.4 gets another fix: we do no longer load winsock functions dynamically and link the winsock dll statically which introduces a new static dependency on ws2_32.dll. However, the fix is simpler and does not use implementation details about system macros FD_SET and FD_ISSET which is generally the "better" approach.
 
 
#2 AlbrechtS
06:52 Feb 19, 2018
Fixed in Subversion repository.

See attached patch mingw-winsock-fltk-1.3_r12678.patch, committed as svn r12679.
 
 
#3 AlbrechtS
00:55 Jun 28, 2018
FTR: FLTK 1.4.0 got fixes in the following svn revisions:

r12946 - [Ian] quick fix
r12947 - [Albrecht] disable dynamic linking (old code disabled)
r12948 - [Albrecht] Fix CMake's fltk-config generation
 
 
#4 AlbrechtS
00:57 Jun 28, 2018
Note: still waiting for more test results so we can finally remove the old code and clean up the "real" code.  
 
#5 AlbrechtS
06:49 Jan 01, 2019
Moved to 1.4-current, reduced priority to 3 (moderate).

Info: This issue has been fixed in 1.3.5 (to be released soon) and was also fixed in the Git 'master' branch (1.4.0). I'm leaving this STR open because the code should be refactored (old code removed), but only in 1.4.x.
 
 
#6 AlbrechtS
10:14 Dec 04, 2021
Fixed in Git repository.

The issue has been resolved and there are enough hints in the code that point at this STR, hence if someone feels inclined to refactor the code as described above they may find this STR anyway.

FTR: svn revisions and Git commits:

svn r12679 = 67fd2793a31accc0ac01db24dc11d10e0e6505d5  (Feb 19, 2018) in branch-1.3

svn r12946 = 9e212ec6f9e30c85d0d59d8265d83e55a23346f8  (Jun 18, 2018)
svn r12947 = e34c06ffc90fc20258fcf9def7b820fd71a36055  (Jun 19, 2018)
svn r12948 = ba58edb33c3e8665cb872548270ee4e98c4ec150  (Jun 19, 2018)

Closing this STR now w/Resolution.
 
     

Return to Bugs & Features ]

 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.