Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Plotters build fails with in-tree Spuce #240

Open
romavis opened this issue Oct 9, 2022 · 1 comment
Open

Bug: Plotters build fails with in-tree Spuce #240

romavis opened this issue Oct 9, 2022 · 1 comment

Comments

@romavis
Copy link

romavis commented Oct 9, 2022

First of all, not sure if this belongs to the Core or to the Plotters repo, but since it looks like an issue that affects usage of Spuce by the whole tree, I will post it here.

Compiling latest master on Linux with in-tree Spuce (and out-of-tree Poco, not sure if that detail is important) gives following error:

[ 97%] Building CXX object plotters/Periodogram/CMakeFiles/Periodogram.dir/Periodogram_autogen/mocs_compilation.cpp.o
cd /home/user/projects/PothosCore-build/plotters/Periodogram && /usr/bin/c++ -DPOCO_ENABLE_CPP11 -DPOCO_ENABLE_CPP14 -DPOCO_HAVE_FD_EPOLL -DPOCO_OS_FAMILY_UNIX -DPOCO_UNBUNDLED -DPeriodogram_EXPORTS -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQWT_DLL -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_REENTRANT -D_THREAD_SAFE -D_XOPEN_SOURCE=500 -I/home/user/projects/PothosCore-build/plotters/Periodogram/Periodogram_autogen/include -I/home/user/projects/PothosCore/include -I/home/user/projects/PothosCore/plotters/qwt6/src -I/home/user/projects/PothosCore/plotters/PlotterUtils -isystem /usr/include/qt5 -isystem /usr/include/qt5/QtWidgets -isystem /usr/include/qt5/QtGui -isystem /usr/include/qt5/QtCore -isystem /usr/lib64/qt5/mkspecs/linux-g++ -O3 -DNDEBUG -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Wextra -Wnon-virtual-dtor -fPIC -std=gnu++14 -MD -MT plotters/Periodogram/CMakeFiles/Periodogram.dir/Periodogram_autogen/mocs_compilation.cpp.o -MF CMakeFiles/Periodogram.dir/Periodogram_autogen/mocs_compilation.cpp.o.d -o CMakeFiles/Periodogram.dir/Periodogram_autogen/mocs_compilation.cpp.o -c /home/user/projects/PothosCore-build/plotters/Periodogram/Periodogram_autogen/mocs_compilation.cpp
In file included from /home/user/projects/PothosCore-build/plotters/Periodogram/Periodogram_autogen/EWIEGA46WW/../../../../../PothosCore/plotters/Periodogram/PeriodogramDisplay.hpp:13,
                 from /home/user/projects/PothosCore-build/plotters/Periodogram/Periodogram_autogen/EWIEGA46WW/moc_PeriodogramDisplay.cpp:10,
                 from /home/user/projects/PothosCore-build/plotters/Periodogram/Periodogram_autogen/mocs_compilation.cpp:3:
/home/user/projects/PothosCore/plotters/PlotterUtils/PothosPlotterFFTUtils.hpp:12:10: fatal error: spuce/filters/design_window.h: No such file or directory
   12 | #include <spuce/filters/design_window.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

From what I see, above happens because include directories of Spuce are not passed to the compiler when an in-tree Spuce is used.
That happens because Plotters component relies on spuce target having INTERFACE_INCLUDE_DIRECTORIES property set on it, and that is not the case when:

  1. Plotters component is built as part of PothosCore
  2. In-tree Spuce is used

When Plotters component is built in a standalone fashion, discovers and creates spuce CMake target by itself, property is set correctly (./plotters/CMakeLists.txt:30):

########################################################################
# Spuce library
########################################################################
if(NOT SPUCE_IN_TREE)
    find_package(Spuce CONFIG)
endif(NOT SPUCE_IN_TREE)

if (Spuce_FOUND)
    message(STATUS "Spuce_VERSION: ${Spuce_VERSION}")
    message(STATUS "Spuce_INCLUDE_DIRS: ${Spuce_INCLUDE_DIRS}")
    message(STATUS "Spuce_LIBRARIES: ${Spuce_LIBRARIES}")
    if (NOT TARGET spuce)
    add_library(spuce INTERFACE)
    target_link_libraries(spuce INTERFACE "${Spuce_LIBRARIES}")
    target_include_directories(spuce INTERFACE "${Spuce_INCLUDE_DIRS}")
    endif()
else (Spuce_FOUND)
    message(WARNING "Spuce filter designer library not found...")
endif (Spuce_FOUND)

When Plotters is built as part of PothosCore and an in-tree Spuce is used, we get spuce target that is created by spuce submodule itself (./CMakeLists.txt:152):

if(NOT ENABLE_INTERNAL_SPUCE)
find_package(Spuce CONFIG)
endif()
cmake_dependent_option(ENABLE_INTERNAL_SPUCE "Enable Spuce filter design library" ON "NOT Spuce_FOUND" OFF)
add_feature_info(Spuce ENABLE_INTERNAL_SPUCE "Build internal Spuce filter design library")

if (ENABLE_INTERNAL_SPUCE)
    message(STATUS "Spuce not found - using built-in Spuce")

    if (EXISTS ${PROJECT_SOURCE_DIR}/spuce/CMakeLists.txt)
        add_subdirectory(spuce)
        set(SPUCE_IN_TREE TRUE)
        set(Spuce_FOUND TRUE)
        set(Spuce_VERSION "[submodule]")
        set(Spuce_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/spuce)
        set(Spuce_LIBRARIES spuce)
    else ()
        message(WARNING "spuce submodule not configured (git submodule update --init --recursive)")
    endif ()
   
endif(ENABLE_INTERNAL_SPUCE)

That target does not have include_directories property set (./spuce/spuce/CMakeLists.txt:40):

add_library(spuce ${FILT_SRCS})
set_property(TARGET spuce PROPERTY CXX_STANDARD 11)
set_property(TARGET spuce PROPERTY POSITION_INDEPENDENT_CODE TRUE)

set_target_properties(spuce PROPERTIES SOVERSION ${SPUCE_SOVER})
set_target_properties(spuce PROPERTIES VERSION ${SPUCE_LIBVER})
set_target_properties(spuce PROPERTIES DEFINE_SYMBOL "SPUCE_DLL_EXPORTS")

For my own build, I've quickly hacked ./CMakeLists.txt to add include directories to the spuce target (./CMakeLists.txt:174):

if (TARGET spuce)
    target_include_directories(spuce INTERFACE "${Spuce_INCLUDE_DIRS}")
endif()

But I'm not sure if this is a good solution for everyone.

@cozycactus
Copy link

i have the same issue on ubuntu 22.04

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants