debrouxl / tilibs

TILP (formerly GtkTiLink) can transfer data between Texas Instruments graphing calculators and a computer. It works with all link cables (parallel, serial, Black/Gray/Silver/Direct Link) and it supports the TI-Z80 series (73..86), the TI-eZ80 series (83PCE, 84+CE), the TI-68k series (89, 92, 92+, V200, 89T) and the Nspire series (Nspire Clickpad / Touchpad / CX, both CAS and non-CAS)
http://lpg.ticalc.org/prj_tilp
63 stars 23 forks source link

Absolut paths? #65

Open papoteur-mga opened 2 years ago

papoteur-mga commented 2 years ago

Hello, I'm trying to package a snapshot of these libraries in Mageia using a rpm package. I use the sequence: cmake cmake build cmake install I use a chrooted environment for the package build (mock). The process ends badly with:

usr/bin/gmake  -f libticonv/trunk/CMakeFiles/buildandinstall_libticonv.dir/build.make libticonv/trunk/CMakeFiles/buildandinstall_libticonv.dir/build
gmake[2]: Entering directory '/builddir/build/BUILD/tilibs-8ffa244e522a484146fe0d7c1130a554f8dba48e/build'
/usr/bin/cmake -P libticonv/trunk/cmake_install.cmake --config RelWithDebInfo
-- Install configuration: "RelWithDebInfo"
-- Installing: /usr/lib64/libticonv.so.9.0.4
CMake Error at libticonv/trunk/cmake_install.cmake:65 (file):
  file INSTALL cannot copy file
  "/builddir/build/BUILD/tilibs-8ffa244e522a484146fe0d7c1130a554f8dba48e/build/libticonv/trunk/libticonv.so.9.0.4"
  to "/usr/lib64/libticonv.so.9.0.4": Permission denied.

It seems that the process try to write a file at a hardcoded place, this one not been allowed. Do I miss something?

debrouxl commented 2 years ago

Hi. Try using the autotools definitions, which remain the full-featured build system for libti*, gfm & tilp. The build dependencies are listed in the configure files, or the packaging definitions for other distros (which package these libraries separately): libtifiles, libticables and libticalcs depend on libticonv, and libticalcs additionally depends on libtifiles and libticables. This yields a libticonv, libtifiles, libticables, libticalcs build order.

papoteur-mga commented 2 years ago

Thanks, I will try that.

adriweb commented 2 years ago

That said, you should be able to just override the paths with the standard cmake (gnu dirs?) variables when invoking it.

papoteur-mga commented 2 years ago

That said, you should be able to just override the paths with the standard cmake (gnu dirs?) variables when invoking it.

I didn't check just now, but using a %cmake_install directive in the rpm spec file, this should be added. This is what I have used for tilp2. Does the cmake build all the four libraries at the same time in the specified order?

adriweb commented 2 years ago

Well the CMake stuff is also available in the tilibs repo. So if you build and install those, then tilp2 will be able to be installed.

Technically all this works fine on both my machine and CI machines so it must not be that broken :p However, it's done in an unorthodox way that I haven't fixed yet, which is basically installing the libs while building.

papoteur-mga commented 2 years ago

I have added the -DCMAKE_INSTALL_PREFIX=%{_buildroot} for the cmake install, but this is not better. Indeed, I see that after building libiconv, the process try to install it, I presume for building the remaining parts. The error occurs in this part of cmake_install.cmake in libiconv/trunk


if("x${CMAKE_INSTALL_COMPONENT}x" STREQUAL "xUnspecifiedx" OR NOT CMAKE_INSTALL_COMPONENT)
  foreach(file
      "$ENV{DESTDIR}/usr/lib64/libticonv.so.9.0.4"
      "$ENV{DESTDIR}/usr/lib64/libticonv.so.9"
      )
    if(EXISTS "${file}" AND
       NOT IS_SYMLINK "${file}")
      file(RPATH_CHECK
           FILE "${file}"
           RPATH "")
    endif()
  endforeach()
  list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES
   "/usr/lib64/libticonv.so.9.0.4;/usr/lib64/libticonv.so.9")
  if(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION)
    message(WARNING "ABSOLUTE path INSTALL DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}")
  endif()
  if(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION)
    message(FATAL_ERROR "ABSOLUTE path INSTALL DESTINATION forbidden (by caller): ${CMAKE_ABSOLUTE_DESTINATION_FILES}")
  endif()
file(INSTALL DESTINATION "/usr/lib64" TYPE SHARED_LIBRARY FILES
    "/builddir/build/BUILD/tilibs-8ffa244e522a484146fe0d7c1130a554f8dba48e/build/libticonv/trunk/libticonv.so.9.0.4"
    "/builddir/build/BUILD/tilibs-8ffa244e522a484146fe0d7c1130a554f8dba48e/build/libticonv/trunk/libticonv.so.9"
    )
  foreach(file
      "$ENV{DESTDIR}/usr/lib64/libticonv.so.9.0.4"
      "$ENV{DESTDIR}/usr/lib64/libticonv.so.9"
      )
    if(EXISTS "${file}" AND
       NOT IS_SYMLINK "${file}")
      if(CMAKE_INSTALL_DO_STRIP)
        execute_process(COMMAND "/usr/bin/strip" "${file}")
      endif()
    endif()
  endforeach()
endif()

on the line file(INSTALL DESTINATION "/usr/lib64" TYPE SHARED_LIBRARY FILES

adriweb commented 2 years ago

Well, I never set those paths myself, though ^^' Seems like CMake (along with the included GNUInstallDirs module) chose /usr/lib64/ on your system, which may be fine, but I guess requires sudo.

Which is part of what I said above about my "unorthodox" way of doing things (building things with deps by first installing the previously built ones).

Also, in the install directive used by all libs it also uses standard cmake variables...

But I clearly wasn't a CMake expert when I did all that, and I'm still not one today despite a bit more experience ... any idea what should be changed?