Bug 379834 - 2.0.9 build error with frameworks ( ki18n ) >= 5.34.0
Summary: 2.0.9 build error with frameworks ( ki18n ) >= 5.34.0
Status: RESOLVED FIXED
Alias: None
Product: kaffeine
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Mauro Carvalho Chehab
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-05-14 23:46 UTC by Gabriel C
Modified: 2017-07-01 13:11 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gabriel C 2017-05-14 23:46:45 UTC
Hello,

notice the following build error while rebuilding kde applications against 
frameworks 5.34.0:

CMake Error at /usr/lib64/cmake/KF5I18n/KF5I18NMacros.cmake:106 (add_custom_target):
  add_custom_target cannot create target
  "pofiles-10d72210d417e16d8cd0ab35f9f8f3bf" because another target with the
  same name already exists.  The existing target is a custom target created
  in source directory "/var/tmp/fst/src/kaffeine-2.0.9".  See documentation
  for policy CMP0002 for more details.
Call Stack (most recent call first):
  CMakeLists.txt:111 (ki18n_install)

I used follwing patch to workaround this issue :
https://github.com/frugalware/kde5/commit/6fc8b4d7a7e7a7f2660c039aa7983b2b64ade5b9#diff-045e678ab2c445442c4c7fb71ae7a573

Regards
Comment 1 Mauro Carvalho Chehab 2017-06-29 11:53:00 UTC
I was unable to reproduce it on Fedora 25, with cmake 3.8.0 and kfi18n 5.34.

Yet, as applying the proposed patch won't hurt, I'm applying it upstream.
Comment 2 Mauro Carvalho Chehab 2017-06-29 11:54:07 UTC
This commit is available for viewing at:
https://commits.kde.org/kaffeine/1bf001147184acbbb74a392307adb02c95390969
Comment 3 Wolfgang Bauer 2017-06-29 14:06:36 UTC
The actual problem is that ki18n_install(po) is called twice in the CMakeLists.txt:

if (IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/po")
  if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/po/CMakeLists.txt" )
    add_subdirectory(po)
  else()
    ki18n_install(po) <--
  endif()
endif()

if(KF5DocTools_VERSION)
  add_subdirectory(doc)
endif(KF5DocTools_VERSION)

if(BUILD_TOOLS)
  add_subdirectory(tools)
endif(BUILD_TOOLS)
find_package(KF5I18n CONFIG REQUIRED)
ki18n_install(po) <--
find_package(KF5DocTools CONFIG REQUIRED)
kdoctools_install(po)

This is only the case in the released tarball though, not in the git repo.
The last 4 lines are not there in git at all.
Comment 4 Mauro Carvalho Chehab 2017-06-29 19:36:15 UTC
(In reply to Wolfgang Bauer from comment #3)
> The actual problem is that ki18n_install(po) is called twice in the
> CMakeLists.txt:
> 
> if (IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/po")
>   if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/po/CMakeLists.txt" )
>     add_subdirectory(po)
>   else()
>     ki18n_install(po) <--
>   endif()
> endif()
> 
> if(KF5DocTools_VERSION)
>   add_subdirectory(doc)
> endif(KF5DocTools_VERSION)
> 
> if(BUILD_TOOLS)
>   add_subdirectory(tools)
> endif(BUILD_TOOLS)
> find_package(KF5I18n CONFIG REQUIRED)
> ki18n_install(po) <--
> find_package(KF5DocTools CONFIG REQUIRED)
> kdoctools_install(po)
> 
> This is only the case in the released tarball though, not in the git repo.
> The last 4 lines are not there in git at all.

Unfortunately, create_tarball_kf5.rb script seems to be adding those automatically:

$ diff -uprBw  kaffeine-git/CMakeLists.txt  kaffeine-2.0.10/CMakeLists.txt
--- ../../CMakeLists.txt	2017-06-29 16:27:33.770796976 -0300
+++ CMakeLists.txt	2017-06-29 16:29:38.000000000 -0300
@@ -113,3 +113,7 @@ endif(KF5DocTools_VERSION)
 if(BUILD_TOOLS)
   add_subdirectory(tools)
 endif(BUILD_TOOLS)
+find_package(KF5I18n CONFIG REQUIRED)
+ki18n_install(po)
+find_package(KF5DocTools CONFIG REQUIRED)
+kdoctools_install(po)

So, better to keep this patch at git, until either I discover what's wrong locally or someone fixes the script.
Comment 5 Wolfgang Bauer 2017-07-01 13:11:51 UTC
(In reply to Mauro Carvalho Chehab from comment #4)
> So, better to keep this patch at git, until either I discover what's wrong
> locally or someone fixes the script.

AFAIK it adds this on purpose if translations/docs are added.

I can confirm that the workaround does fix the build, I just wanted to point out why it fails in the first place.

I think this part could just be removed though, which would fix the problem:
  else()
    ki18n_install(po)

AIUI, this has been added to build the translations when using the released tarballs (in https://cgit.kde.org/kaffeine.git/commit/?id=2dbc752d644440f963bad172cf3ec83dc681ec7f), but in this case create_tarball_kf5.rb adds the call anyway.