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

Remove system install interface "include" #817

Closed
wants to merge 1 commit into from

Conversation

shriramters
Copy link

@shriramters shriramters commented Feb 17, 2024

I am currently packaging ftxui for debian. I am able to package it and also install it fine from Tag 5.0.0

When using installed ftxui with cmake's find_package, cmake is unable to configure ftxui::screen.
It complains about a path "/include" in its INTERFACE_INCLUDE_DIRECTORIES.

Removing the SYSTEM INSTALL_INTERFACE from ftxui_set_options seems to fix the issue without causing any other problems in building and using the library.

This is the error (running on debian sid):

-- The CXX compiler identification is GNU 13.2.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Configuring done (0.4s)
CMake Error in CMakeLists.txt:
  Imported target "ftxui::screen" includes non-existent path

    "/include"

  in its INTERFACE_INCLUDE_DIRECTORIES.  Possible reasons include:

  * The path was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and references files it does not
  provide.



-- Generating done (0.0s)

Not sure if this is the correct way to solve this, but it doesn't seem to have any impact on the library's functioning itself.
Atleast from my preliminary analysis.

When using installed ftxui with cmake find_package, cmake is unable to
configure ftxui::screen, and it complains about a path "/include" in its
INTERFACE_INCLUDE_DIRECTORIES. Removing the SYSTEM INSTALL_INTERFACE
from ftxui_set_options seems to fix the issue without causing any other
problems in building and using the library.
@shriramters
Copy link
Author

This is the CMakeLists.txt in which I am using my debian package'd version of ftxui

cmake_minimum_required (VERSION 3.11)
project(ftxui-starter LANGUAGES CXX VERSION 1.0.0)
find_package(ftxui 5 REQUIRED)
add_executable(ftxui-starter main.cpp)
target_link_libraries(ftxui-starter
  PRIVATE ftxui::screen
  PRIVATE ftxui::dom
  PRIVATE ftxui::component # Not needed for this example.
)

Where main.cpp is just one of your DOM example cpp files.

@ArthurSonzogni
Copy link
Owner

I am currently packaging ftxui for debian

Awesome! Thank you so much!


That being said, I am not sure if this is the correct way to fix the issue.

  • How can I reproduce?
  • What is the value of CMAKE_INSTALL_INCLUDEDIR ? Is it different from "include" to you?
  • Should we use:
  target_include_directories(${library} SYSTEM
    INTERFACE
      $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
  )

instead, like GLFW is using?

@ArthurSonzogni
Copy link
Owner

I tried to day installing the debian package produced:

cmake ..
sudo make package
sudo dpkg -i ftxui-5.0.0-Linux.deb

Then start using it using this cmake:

cmake_minimum_required (VERSION 3.11)
project(ftxui-starter LANGUAGES CXX VERSION 1.0.0)
find_package(ftxui 5 REQUIRED)
add_executable(ftxui-starter src/main.cpp)
target_link_libraries(ftxui-starter
  PRIVATE ftxui::screen
  PRIVATE ftxui::dom
  PRIVATE ftxui::component # Not needed for this example.
)

Everything was correctly working.

@shriramters, could you please let me know how to reproduce your issue?

@shriramters
Copy link
Author

shriramters commented Feb 23, 2024

Hi @ArthurSonzogni
Apologies for my late response, I was unavailable this week.

I have figured out what the issue was:
I packaged ftxui with debhelper instead of cmake.
When I did so, for some reason, cmake wouldn't find the ftxui-*.cmake files despite them existing in /usr/lib/aarch64-linux-gnu/cmake/ftxui/ftxui-*.cmake

However, it would find these same exact files if I build and install it with cmake.

So I improperly understood the documentation and decided to install the cmake files to /usr/lib/cmake instead of /usr/lib/<multi-arch-triplet>/cmake causing this entire issue of /include not existing and everything else working.

Sorry for the confusion caused due to this. I will try to fix the initial issue that I have with the .cmake files not being detected.

@shriramters
Copy link
Author

Additional Context:
This piece of code from ftxui-targets.cmake is what prevents it from being moved to /usr/lib/cmake
it is the condition when _realCurr does not equal _realOrig

# Compute the installation prefix relative to this file.
get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
# Use original install prefix when loaded through a
# cross-prefix symbolic link such as /lib -> /usr/lib.
get_filename_component(_realCurr "${_IMPORT_PREFIX}" REALPATH)
get_filename_component(_realOrig "/usr/lib/aarch64-linux-gnu/cmake/ftxui" REALPATH)
if(_realCurr STREQUAL _realOrig)
  set(_IMPORT_PREFIX "/usr/lib/aarch64-linux-gnu/cmake/ftxui")
endif()
unset(_realOrig)
unset(_realCurr)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
if(_IMPORT_PREFIX STREQUAL "/")
  set(_IMPORT_PREFIX "")
endif()

@shriramters
Copy link
Author

BTW @ArthurSonzogni,
FTXUI has been accepted into the debian new queue

Here is the listing

It might take a few weeks/months until the FTP Team processes it 😅 (Check https://people.debian.org/~roehling/new_queue/)

Until then I will try to figure out the cmake issue and fix it in a revision

@ArthurSonzogni
Copy link
Owner

Awesome!

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

Successfully merging this pull request may close these issues.

2 participants