I'm attaching the FLTK patches that are still necessary to produce a
working FLTK build on all supported platforms, as well as re-introduce
the functionality lost when FLTK was pulled out of the TigerVNC tree.
These should be applied against the 1.3.2 FLTK code after the other
TigerVNC-specific patches are applied. 0002 and 0003 really need to be
submitted upstream, but I have no cycles to do so. 0001 probably needs
to be checked into the TigerVNC repository and applied by the script in
BUILDING.txt. 0001 adds the BUILD_STATIC CMake option that is necessary
to produce a cross-compatible binary on Linux and a transportable binary
on Windows. Otherwise, TigerVNC (via FLTK) will depend on the libgcc or
libstdc++ dynamic libraries, which are not system-supplied on Windows
(and which vary in compatibility between Linux distros.)
I also find that I have to add the following patch to TigerVNC whenever
building FLTK with a system-installed version (i.e. a dynamic library
version) of libpng:
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt (revision 5051)
+++ CMakeLists.txt (working copy)
@@ -265,6 +265,7 @@
if(X11_Xcursor_FOUND)
set(FLTK_LIBRARIES ${FLTK_LIBRARIES} ${X11_Xcursor_LIB})
endif()
+ set(FLTK_LIBRARIES ${FLTK_LIBRARIES} png)
endif()
if(FLTK_FOUND)
The workaround is to build FLTK with -DOPTION_USE_SYSTEM_LIBPNG=0. On
Windows and Mac, I also pass -DOPTION_USE_SYSTEM_LIBJPEG=0
-DOPTION_USE_SYSTEM_ZLIB=0 to the FLTK build, and on Windows and Linux,
I use -DBUILD_STATIC=1 (see above.)
This information is provided as a courtesy. Suffice it to say that
these issues are easily reproducible by anyone attempting to build
32-bit and 64-bit binaries for OS X, Linux, and Windows. I am not
volunteering or accepting any responsibility for fixing the issues, nor
do I have time to debate them.
DRC
>From 7a15d1c9a908afe429c1aba1c27516d18bdea299 Mon Sep 17 00:00:00 2001
From: DRC <informat...@virtualgl.org>
Date: Tue, 26 Feb 2013 03:37:12 -0600
Subject: [PATCH 1/4] Add BUILD_STATIC feature from TigerVNC to (optionally)
prevent FLTK from depending on libgcc and libstdc++
---
CMakeLists.txt | 43 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a1ee285..7d9d94b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -150,6 +150,49 @@ mark_as_advanced(LIB_CAIRO LIB_fontconfig LIB_freetype)
mark_as_advanced(LIB_GL LIB_MesaGL)
mark_as_advanced(LIB_jpeg LIB_png LIB_zlib)
+# This ensures that we don't depend on libstdc++ or libgcc
+if(CMAKE_COMPILER_IS_GNUCXX AND NOT APPLE AND NOT CYGWIN)
+ option(BUILD_STATIC
+ "Link statically against libgcc and libstdc++, if possible" OFF)
+ if(BUILD_STATIC)
+ # For some reason, simply passing ${CMAKE_CXX_FLAGS} to the compiler in
+ # execute_process() doesn't work. Grrr...
+ if(CMAKE_SIZEOF_VOID_P MATCHES 8)
+ execute_process(COMMAND ${CMAKE_CXX_COMPILER} -m64
+ --print-file-name=libstdc++.a OUTPUT_VARIABLE LIBSTDCPLUSPLUS
+ RESULT_VARIABLE RESULT)
+ else()
+ execute_process(COMMAND ${CMAKE_CXX_COMPILER} -m32
+ --print-file-name=libstdc++.a OUTPUT_VARIABLE LIBSTDCPLUSPLUS
+ RESULT_VARIABLE RESULT)
+ endif()
+ string(REGEX REPLACE "\n" "" LIBSTDCPLUSPLUS ${LIBSTDCPLUSPLUS})
+ if(RESULT MATCHES 0 AND LIBSTDCPLUSPLUS)
+ message(STATUS "Linking with static libstdc++:\n ${LIBSTDCPLUSPLUS}")
+ file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/staticlib)
+ execute_process(COMMAND ${CMAKE_COMMAND} -E remove
+ ${CMAKE_BINARY_DIR}/staticlib/libstdc++.a)
+ if(MINGW)
+ execute_process(COMMAND ${CMAKE_COMMAND} -E copy
+ ${LIBSTDCPLUSPLUS} ${CMAKE_BINARY_DIR}/staticlib/libstdc++.a)
+ else()
+ execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
+ ${LIBSTDCPLUSPLUS} ${CMAKE_BINARY_DIR}/staticlib/libstdc++.a)
+ endif()
+ set(CMAKE_EXE_LINKER_FLAGS
+ "${CMAKE_EXE_LINKER_FLAGS} -L${CMAKE_BINARY_DIR}/staticlib")
+ set(CMAKE_SHARED_LINKER_FLAGS
+ "${CMAKE_SHARED_LINKER_FLAGS} -L${CMAKE_BINARY_DIR}/staticlib")
+ else()
+ message(WARNING Cannot find static libstdc++. TigerVNC will depend on
dynamic libstdc++.)
+ endif()
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc")
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc")
+ set(CMAKE_SHARED_LINKER_FLAGS
+ "${CMAKE_SHARED_LINKER_FLAGS} -static-libgcc")
+ endif()
+endif()
+
#######################################################################
# functions
include(CheckFunctionExists)
--
1.8.1.3
>From bf06cdf83375c11a47bddc3683143b3e2c0fdfcb Mon Sep 17 00:00:00 2001
From: DRC <informat...@virtualgl.org>
Date: Tue, 26 Feb 2013 03:38:45 -0600
Subject: [PATCH 2/4] Fl_cocoa.mm depends on some Carbon functions, so we need
to include that framework.
---
CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7d9d94b..cae895e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -51,7 +51,7 @@ if(APPLE)
set(HAVE_STRTOLL 1)
set(HAVE_STRCASECMP 1)
set(HAVE_DIRENT_H 1)
- set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework Cocoa")
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework Cocoa
-framework Carbon")
endif(APPLE)
if(WIN32)
--
1.8.1.3
>From bb02d8426a9a279df76376313349c17774030753 Mon Sep 17 00:00:00 2001
From: DRC <informat...@virtualgl.org>
Date: Tue, 26 Feb 2013 04:01:36 -0600
Subject: [PATCH 3/4] We need to unset CMAKE_REQUIRED_LIBRARIES after checking
for the libpng functions. Otherwise, under certain circumstances (known to
be an issue when building on OS X with the in-tree libpng implementation),
the scandir() function check will fail, leaving HAVE_SCANDIR unset, and the
build will subsequently fail.
---
CMakeLists.txt | 3 +++
1 file changed, 3 insertions(+)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index cae895e..0984aae 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -210,6 +210,9 @@ if(LIB_png)
endif(LIB_png)
CHECK_FUNCTION_EXISTS(png_get_valid HAVE_PNG_GET_VALID)
CHECK_FUNCTION_EXISTS(png_set_tRNS_to_alpha HAVE_PNG_SET_TRNS_TO_ALPHA)
+if(LIB_png)
+ set(CMAKE_REQUIRED_LIBRARIES "")
+endif(LIB_png)
CHECK_FUNCTION_EXISTS(scandir HAVE_SCANDIR)
CHECK_FUNCTION_EXISTS(snprintf HAVE_SNPRINTF)
--
1.8.1.3
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
Tigervnc-devel mailing list
Tigervnc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tigervnc-devel