Compatibility header for libtool on Windows?

In my strive to create a Windows Docker container with updated dependencies, I’m trying to remove the dependency on https://github.com/ErwinJanssen/graphviz-windows-dependencies and instead install stuff with chocolatey or vcpkg, but this file seems home-cooked: https://github.com/ErwinJanssen/graphviz-windows-dependencies/blob/master/x64/include/ltdl.h. Should we incorporate it into the graphviz repo instead?

Any other comments around this would be very appreciated. I’m learning these tools and CMake as I go. I may be on the wrong track.

This is the current state without the dependencies above, but not in a Docker container:

+ rm -rf build
+ mkdir build
+ cd build
+ cmake -G 'Visual Studio 16 2019' -A x64 ..
-- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.20150.
-- The C compiler identification is MSVC 19.26.28806.0
-- The CXX compiler identification is MSVC 19.26.28806.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.26.28801/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.26.28801/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found AWK: C:/Program Files/Git/usr/bin/gawk.exe  
-- Found BISON: C:/Users/magja/graphviz-dependencies/windows/dependencies/graphviz-build-utilities/bison.exe (found version "2.7") 
-- Found FLEX: C:/Users/magja/graphviz-dependencies/windows/dependencies/graphviz-build-utilities/flex.exe (found version "2.5.37") 
-- Found Git: C:/Program Files/Git/mingw64/bin/git.exe (found version "2.27.0.windows.1") 
-- Found Perl: C:/Program Files/Git/usr/bin/perl.exe (found version "5.30.2") 
-- Could NOT find ANN (missing: ANN_LIBRARY ANN_INCLUDE_DIR) 
CMake Warning (dev) at C:/Program Files/CMake/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:273 (message):
  The package name passed to `find_package_handle_standard_args` (CAIRO) does
  not match the name of the calling package (Cairo).  This can lead to
  problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  cmake/FindCairo.cmake:12 (find_package_handle_standard_args)
  CMakeLists.txt:83 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found CAIRO: C:/Users/magja/vcpkg/installed/x86-windows/include  
-- Found EXPAT: C:/Users/magja/vcpkg/installed/x86-windows/lib/expat.lib (found version "2.2.7") 
-- Could NOT find GD (missing: GD_LIBRARY GD_INCLUDE_DIR GD_RUNTIME_LIBRARY) 
-- Could NOT find LTDL (missing: LTDL_INCLUDE_DIR) 
CMake Warning (dev) at C:/Program Files/CMake/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:273 (message):
  The package name passed to `find_package_handle_standard_args` (PANGOCAIRO)
  does not match the name of the calling package (PangoCairo).  This can lead
  to problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  cmake/FindPangoCairo.cmake:20 (find_package_handle_standard_args)
  CMakeLists.txt:87 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found PANGOCAIRO: C:/Users/magja/vcpkg/installed/x86-windows/include  
-- Found ZLIB: C:/Users/magja/vcpkg/installed/x86-windows/lib/zlib.lib (found version "1.2.11") 
-- CMAKE_INCLUDE_PATH: C:/Users/magja/graphviz-docker/windows/dependencies/libraries/x64/include;C:/Users/magja/graphviz-docker/windows/dependencies/libraries/x64/bin;C:/Users/magja/graphviz-docker/../vcpkg/installed/x86-windows/include
-- CMAKE_LIBRARY_PATH: C:/Users/magja/graphviz-docker/windows/dependencies/libraries/x64/lib;C:/Users/magja/graphviz-docker/../vcpkg/installed/x86-windows/lib
-- RXSPENCER_INCLUDE_DIR: C:/Users/magja/emacs/include
-- RXSPENCER_LIBRARY: C:/Users/magja/vcpkg/installed/x86-windows/lib/rxspencer.lib
CMake Warning (dev) at C:/Program Files/CMake/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:273 (message):
  The package name passed to `find_package_handle_standard_args` (RXSPENCER)
  does not match the name of the calling package (RxSpencer).  This can lead
  to problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  cmake/FindRxSpencer.cmake:10 (find_package_handle_standard_args)
  CMakeLists.txt:92 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found RXSPENCER: C:/Users/magja/vcpkg/installed/x86-windows/lib/rxspencer.lib  
-- Graphviz version: 2.45.20200710.1606
-- Looking for getopt.h
-- Looking for getopt.h - not found
-- Looking for crt_externs.h
-- Looking for crt_externs.h - not found
-- Looking for fcntl
-- Looking for fcntl - not found
-- Looking for malloc.h
-- Looking for malloc.h - found
-- Looking for search.h
-- Looking for search.h - found
-- Looking for stat.h
-- Looking for stat.h - not found
-- Looking for strings.h
-- Looking for strings.h - not found
-- Looking for sys/inotify.h
-- Looking for sys/inotify.h - not found
-- Looking for sys/ioctl.h
-- Looking for sys/ioctl.h - not found
-- Looking for sys/mman.h
-- Looking for sys/mman.h - not found
-- Looking for sys/select.h
-- Looking for sys/select.h - not found
-- Looking for sys/stat.h
-- Looking for sys/stat.h - found
-- Looking for sys/time.h
-- Looking for sys/time.h - not found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for sys/vfork.h
-- Looking for sys/vfork.h - not found
-- Looking for termios.h
-- Looking for termios.h - not found
-- Looking for unistd.h
-- Looking for unistd.h - not found
-- Looking for vfork.h
-- Looking for vfork.h - not found
-- Looking for X11/Intrinsic.h
-- Looking for X11/Intrinsic.h - not found
-- Looking for X11/Xaw/Text.h
-- Looking for X11/Xaw/Text.h - not found
-- Looking for _NSGetEnviron
-- Looking for _NSGetEnviron - not found
-- Looking for drand48
-- Looking for drand48 - not found
-- Looking for cbrt
-- Looking for cbrt - found
-- Looking for getpagesize
-- Looking for getpagesize - not found
-- Looking for getenv
-- Looking for getenv - found
-- Looking for lrand48
-- Looking for lrand48 - not found
-- Looking for mallinfo
-- Looking for mallinfo - not found
-- Looking for mallopt
-- Looking for mallopt - not found
-- Looking for mstats
-- Looking for mstats - not found
-- Looking for setenv
-- Looking for setenv - not found
-- Looking for setmode
-- Looking for setmode - found
-- Looking for sincos
-- Looking for sincos - not found
-- Looking for srand48
-- Looking for srand48 - not found
-- Looking for strcasecmp
-- Looking for strcasecmp - not found
-- Looking for strncasecmp
-- Looking for strncasecmp - not found
-- Looking for vsnprintf
-- Looking for vsnprintf - not found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of ssize_t
-- Check size of ssize_t - failed
-- Check size of intptr_t
-- Check size of intptr_t - done
-- Found NSIS: C:/Program Files (x86)/NSIS/Bin/makensis.exe  
-- Found PythonInterp: C:/Users/magja/emacs/bin/python.exe (found version "2.7.14") 
-- The following OPTIONAL packages have been found:

 * Cairo
 * EXPAT
 * PangoCairo
 * ZLIB
 * NSIS
 * PythonInterp

-- The following REQUIRED packages have been found:

 * AWK
 * BISON
 * FLEX
 * Git
 * Perl
 * RxSpencer

-- The following OPTIONAL packages have not been found:

 * ANN
 * PkgConfig
 * GD
 * LTDL

-- Configuring done
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
LTDL_INCLUDE_DIR (ADVANCED)
   used as include directory in directory C:/Users/magja/graphviz-docker/lib/gvc
   used as include directory in directory C:/Users/magja/graphviz-docker/lib/gvc
   used as include directory in directory C:/Users/magja/graphviz-docker/lib/gvc
   used as include directory in directory C:/Users/magja/graphviz-docker/lib/gvc

CMake Warning (dev) in lib/gvc/CMakeLists.txt:
  Policy CMP0021 is not set: Fatal error on relative paths in
  INCLUDE_DIRECTORIES target property.  Run "cmake --help-policy CMP0021" for
  policy details.  Use the cmake_policy command to set the policy and
  suppress this warning.

  Found relative path while evaluating include directories of "gvc":

    "LTDL_INCLUDE_DIR-NOTFOUND"

This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) in lib/gvc/CMakeLists.txt:
  Policy CMP0021 is not set: Fatal error on relative paths in
  INCLUDE_DIRECTORIES target property.  Run "cmake --help-policy CMP0021" for
  policy details.  Use the cmake_policy command to set the policy and
  suppress this warning.

  Found relative path while evaluating include directories of "gvc":

    "LTDL_INCLUDE_DIR-NOTFOUND"

This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) in lib/gvc/CMakeLists.txt:
  Policy CMP0021 is not set: Fatal error on relative paths in
  INCLUDE_DIRECTORIES target property.  Run "cmake --help-policy CMP0021" for
  policy details.  Use the cmake_policy command to set the policy and
  suppress this warning.

  Found relative path while evaluating include directories of "gvc":

    "LTDL_INCLUDE_DIR-NOTFOUND"

This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) in lib/gvc/CMakeLists.txt:
  Policy CMP0021 is not set: Fatal error on relative paths in
  INCLUDE_DIRECTORIES target property.  Run "cmake --help-policy CMP0021" for
  policy details.  Use the cmake_policy command to set the policy and
  suppress this warning.

  Found relative path while evaluating include directories of "gvc":

    "LTDL_INCLUDE_DIR-NOTFOUND"

This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) in lib/gvc/CMakeLists.txt:
  Policy CMP0021 is not set: Fatal error on relative paths in
  INCLUDE_DIRECTORIES target property.  Run "cmake --help-policy CMP0021" for
  policy details.  Use the cmake_policy command to set the policy and
  suppress this warning.

  Found relative path while evaluating include directories of "gvc":

    "LTDL_INCLUDE_DIR-NOTFOUND"

This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) in lib/gvc/CMakeLists.txt:
  Policy CMP0021 is not set: Fatal error on relative paths in
  INCLUDE_DIRECTORIES target property.  Run "cmake --help-policy CMP0021" for
  policy details.  Use the cmake_policy command to set the policy and
  suppress this warning.

  Found relative path while evaluating include directories of "gvc":

    "LTDL_INCLUDE_DIR-NOTFOUND"

This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) in lib/gvc/CMakeLists.txt:
  Policy CMP0021 is not set: Fatal error on relative paths in
  INCLUDE_DIRECTORIES target property.  Run "cmake --help-policy CMP0021" for
  policy details.  Use the cmake_policy command to set the policy and
  suppress this warning.

  Found relative path while evaluating include directories of "gvc":

    "LTDL_INCLUDE_DIR-NOTFOUND"

This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) in lib/gvc/CMakeLists.txt:
  Policy CMP0021 is not set: Fatal error on relative paths in
  INCLUDE_DIRECTORIES target property.  Run "cmake --help-policy CMP0021" for
  policy details.  Use the cmake_policy command to set the policy and
  suppress this warning.

  Found relative path while evaluating include directories of "gvc":

    "LTDL_INCLUDE_DIR-NOTFOUND"

This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) in lib/gvc/CMakeLists.txt:
  Policy CMP0021 is not set: Fatal error on relative paths in
  INCLUDE_DIRECTORIES target property.  Run "cmake --help-policy CMP0021" for
  policy details.  Use the cmake_policy command to set the policy and
  suppress this warning.

  Found relative path while evaluating include directories of "gvc":

    "LTDL_INCLUDE_DIR-NOTFOUND"

This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) in lib/gvc/CMakeLists.txt:
  Policy CMP0021 is not set: Fatal error on relative paths in
  INCLUDE_DIRECTORIES target property.  Run "cmake --help-policy CMP0021" for
  policy details.  Use the cmake_policy command to set the policy and
  suppress this warning.

  Found relative path while evaluating include directories of "gvc":

    "LTDL_INCLUDE_DIR-NOTFOUND"

This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) in lib/gvc/CMakeLists.txt:
  Policy CMP0021 is not set: Fatal error on relative paths in
  INCLUDE_DIRECTORIES target property.  Run "cmake --help-policy CMP0021" for
  policy details.  Use the cmake_policy command to set the policy and
  suppress this warning.

  Found relative path while evaluating include directories of "gvc":

    "LTDL_INCLUDE_DIR-NOTFOUND"

This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) in lib/gvc/CMakeLists.txt:
  Policy CMP0021 is not set: Fatal error on relative paths in
  INCLUDE_DIRECTORIES target property.  Run "cmake --help-policy CMP0021" for
  policy details.  Use the cmake_policy command to set the policy and
  suppress this warning.

  Found relative path while evaluating include directories of "gvc":

    "LTDL_INCLUDE_DIR-NOTFOUND"

This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) in lib/gvc/CMakeLists.txt:
  Policy CMP0021 is not set: Fatal error on relative paths in
  INCLUDE_DIRECTORIES target property.  Run "cmake --help-policy CMP0021" for
  policy details.  Use the cmake_policy command to set the policy and
  suppress this warning.

  Found relative path while evaluating include directories of "PACKAGE":

    "LTDL_INCLUDE_DIR-NOTFOUND"

This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) in lib/gvc/CMakeLists.txt:
  Policy CMP0021 is not set: Fatal error on relative paths in
  INCLUDE_DIRECTORIES target property.  Run "cmake --help-policy CMP0021" for
  policy details.  Use the cmake_policy command to set the policy and
  suppress this warning.

  Found relative path while evaluating include directories of "PACKAGE":

    "LTDL_INCLUDE_DIR-NOTFOUND"

This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) in lib/gvc/CMakeLists.txt:
  Policy CMP0021 is not set: Fatal error on relative paths in
  INCLUDE_DIRECTORIES target property.  Run "cmake --help-policy CMP0021" for
  policy details.  Use the cmake_policy command to set the policy and
  suppress this warning.

  Found relative path while evaluating include directories of "PACKAGE":

    "LTDL_INCLUDE_DIR-NOTFOUND"

This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) in lib/gvc/CMakeLists.txt:
  Policy CMP0021 is not set: Fatal error on relative paths in
  INCLUDE_DIRECTORIES target property.  Run "cmake --help-policy CMP0021" for
  policy details.  Use the cmake_policy command to set the policy and
  suppress this warning.

  Found relative path while evaluating include directories of "PACKAGE":

    "LTDL_INCLUDE_DIR-NOTFOUND"

This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) in lib/gvc/CMakeLists.txt:
  Policy CMP0021 is not set: Fatal error on relative paths in
  INCLUDE_DIRECTORIES target property.  Run "cmake --help-policy CMP0021" for
  policy details.  Use the cmake_policy command to set the policy and
  suppress this warning.

  Found relative path while evaluating include directories of "INSTALL":

    "LTDL_INCLUDE_DIR-NOTFOUND"

This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) in lib/gvc/CMakeLists.txt:
  Policy CMP0021 is not set: Fatal error on relative paths in
  INCLUDE_DIRECTORIES target property.  Run "cmake --help-policy CMP0021" for
  policy details.  Use the cmake_policy command to set the policy and
  suppress this warning.

  Found relative path while evaluating include directories of "INSTALL":

    "LTDL_INCLUDE_DIR-NOTFOUND"

This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) in lib/gvc/CMakeLists.txt:
  Policy CMP0021 is not set: Fatal error on relative paths in
  INCLUDE_DIRECTORIES target property.  Run "cmake --help-policy CMP0021" for
  policy details.  Use the cmake_policy command to set the policy and
  suppress this warning.

  Found relative path while evaluating include directories of "INSTALL":

    "LTDL_INCLUDE_DIR-NOTFOUND"

This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) in lib/gvc/CMakeLists.txt:
  Policy CMP0021 is not set: Fatal error on relative paths in
  INCLUDE_DIRECTORIES target property.  Run "cmake --help-policy CMP0021" for
  policy details.  Use the cmake_policy command to set the policy and
  suppress this warning.

  Found relative path while evaluating include directories of "INSTALL":

    "LTDL_INCLUDE_DIR-NOTFOUND"

This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) in lib/gvc/CMakeLists.txt:
  Policy CMP0021 is not set: Fatal error on relative paths in
  INCLUDE_DIRECTORIES target property.  Run "cmake --help-policy CMP0021" for
  policy details.  Use the cmake_policy command to set the policy and
  suppress this warning.

  Found relative path while evaluating include directories of "RUN_TESTS":

    "LTDL_INCLUDE_DIR-NOTFOUND"

This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) in lib/gvc/CMakeLists.txt:
  Policy CMP0021 is not set: Fatal error on relative paths in
  INCLUDE_DIRECTORIES target property.  Run "cmake --help-policy CMP0021" for
  policy details.  Use the cmake_policy command to set the policy and
  suppress this warning.

  Found relative path while evaluating include directories of "RUN_TESTS":

    "LTDL_INCLUDE_DIR-NOTFOUND"

This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) in lib/gvc/CMakeLists.txt:
  Policy CMP0021 is not set: Fatal error on relative paths in
  INCLUDE_DIRECTORIES target property.  Run "cmake --help-policy CMP0021" for
  policy details.  Use the cmake_policy command to set the policy and
  suppress this warning.

  Found relative path while evaluating include directories of "RUN_TESTS":

    "LTDL_INCLUDE_DIR-NOTFOUND"

This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) in lib/gvc/CMakeLists.txt:
  Policy CMP0021 is not set: Fatal error on relative paths in
  INCLUDE_DIRECTORIES target property.  Run "cmake --help-policy CMP0021" for
  policy details.  Use the cmake_policy command to set the policy and
  suppress this warning.

  Found relative path while evaluating include directories of "RUN_TESTS":

    "LTDL_INCLUDE_DIR-NOTFOUND"

This warning is for project developers.  Use -Wno-dev to suppress it.

-- Generating done
CMake Generate step failed.  Build files cannot be regenerated correctly.

I am not particularly familiar with libltdl, but the docs have this to say:

libltdl supports currently the following dynamic linking mechanisms:

  • dlopen (POSIX compliant systems, GNU/Linux, etc.)
  • shl_load (HP-UX)
  • LoadLibrary (Win16 and Win32)
  • load_add_on (BeOS)
  • NSAddImage or NSLinkModule (Darwin and Mac OS X)
  • GNU DLD (emulates dynamic linking for static libraries)
  • libtool’s dlpreopen (see Dlpreopening)

Is it possible the stub in Erwin’s repo was written before libltdl gained Windows support? The docs imply to me that we could simply install libltdl on Windows and use it directly instead of the stub.

1 Like

Thanks. That’s the approach I’ve taken right now, but I don’t know if it’s going to work yet since I haven’t gotten all other dependencies in place so I can produce something useful. This was a just a gamble on my part, but your comment strengthens be in the belief that it’s possible that it actually might work :slightly_smiling_face: