veg / hyphy

HyPhy: Hypothesis testing using Phylogenies
http://www.hyphy.org
Other
200 stars 68 forks source link

cmake configure failure with hyphy 2.5.51 on Debian sid #1627

Closed emollier closed 11 months ago

emollier commented 1 year ago

Hi,

When trying to build hyphy 2.5.51 to update the packaging in Debian, I noticed configuring the build with cmake fails with:

CMake Error at /usr/share/cmake-3.26/Modules/UseSWIG.cmake:939 (add_library):
  Cannot find source file:

    src/lib/link/THyPhy.cpp

  Tried extensions .c .C .c++ .cc .cpp .cxx .cu .mpp .m .M .mm .ixx .cppm .h
  .hh .h++ .hm .hpp .hxx .in .txx .f .F .for .f77 .f90 .f95 .f03 .hip .ispc
Call Stack (most recent call first):
  CMakeLists.txt:606 (swig_add_library)

CMake Error in CMakeLists.txt:
  Cannot find source file:

    /<<PKGBUILDDIR>>/src/lib/link/THyPhy.i

  Tried extensions .c .C .c++ .cc .cpp .cxx .cu .mpp .m .M .mm .ixx .cppm .h
  .hh .h++ .hm .hpp .hxx .in .txx .f .F .for .f77 .f90 .f95 .f03 .hip .ispc

CMake Error at /usr/share/cmake-3.26/Modules/UseSWIG.cmake:939 (add_library):
  No SOURCES given to target: LIBRARY
Call Stack (most recent call first):
  CMakeLists.txt:606 (swig_add_library)

This seems to be caused by a mismatch between existing files in the directory src/lib/ and declared files in CMakeFiles.txt declared in src/lib/link/, directory which doesn't appear to exist. Also there seems to be a confusion between the real extension of THyPHy.cxx and the declared one which is THyPHy.cpp.

I'm considering applying the patch below to allow the build to go through. I considered opening a merge request, but wasn't entirely sure you wouldn't have other plans for that part of the CMakeLists.txt file, which changed already from v2.5.51:

--- hyphy.orig/CMakeLists.txt
+++ hyphy/CMakeLists.txt
@@ -143,7 +143,7 @@
 file(GLOB SRC_NEW src/new/*.cpp)
 file(GLOB SRC_CONTRIB src/contrib/*.cpp)

-set(SRC_LINK src/lib/link/THyPhy.cpp)
+set(SRC_LINK src/lib/THyPhy.cxx)
 set(SRC_UNIXMAIN src/mains/unix.cpp)
 set(SRC_UTILS src/utils/hyphyunixutils.cpp)

@@ -599,11 +599,11 @@
        find_package (Python3 COMPONENTS Interpreter Development)
        #add_definitions (-D__HEADLESS__)
        INCLUDE_DIRECTORIES(${Python3_INCLUDE_DIRS})
-       SET_SOURCE_FILES_PROPERTIES(src/lib/link/THyPhy.i PROPERTIES CPLUSPLUS ON)
-       #SET_SOURCE_FILES_PROPERTIES(src/lib/link/example.i PROPERTIES CPLUSPLUS ON)
+       SET_SOURCE_FILES_PROPERTIES(src/lib/THyPhy.i PROPERTIES CPLUSPLUS ON)
+       #SET_SOURCE_FILES_PROPERTIES(src/lib/example.i PROPERTIES CPLUSPLUS ON)

-       set_property(SOURCE src/lib/link/THyPhy.i  PROPERTY SWIG_MODULE_NAME HyPhy)
-       swig_add_library(LIBRARY LANGUAGE python SOURCES src/lib/link/THyPhy.i src/lib/link/THyPhy.cpp ${SRC_COMMON})
+       set_property(SOURCE src/lib/THyPhy.i  PROPERTY SWIG_MODULE_NAME HyPhy)
+       swig_add_library(LIBRARY LANGUAGE python SOURCES src/lib/THyPhy.i src/lib/THyPhy.cxx ${SRC_COMMON})
        TARGET_LINK_LIBRARIES(LIBRARY ${Python3_LIBRARIES} ${DEFAULT_LIBRARIES})

Of course, it is quite possible I completely missed something.

Have a nice day, :) Étienne.

stephenshank commented 1 year ago

Dear @emollier,

For what it's worth, I've also encountered this issue on the 2.5.51 tag, but do not encounter it on the 2.5.51hf tag.

SWIG appears to have been removed there.

Thank you for sharing your update to CMakeLists.txt, I found it helpful to see how you approached this issue!

Regards, Stephen

spond commented 1 year ago

Dear @emollier,

Thank you for reporting this issue and providing a fix. We have removed SWIG support from the CMakeFile in the development version and it will be gone from 2.5.52 and later versions, because the library is built using Python's setuptools.

Best, Sergei

emollier commented 1 year ago

Hi all,

Thanks for the feedback and highlighting the v2.5.51hf, too bad our watcher didn't catch the hotfix version. I'll wait for the v2.5.52 with interest so I can remove my workaround and swig from the package build dependency tree alltogether.

Have a nice day, :) Étienne.

spond commented 11 months ago

Dear @emollier,

Should be resolved with 2.5.52.

Best, Sergei

emollier commented 11 months ago

Hi,

The issue is indeed resolved in 2.5.52, I close the entry.

Have a nice day, :) Étienne.