woboq / moc-ng

A reimplementation of Qt's moc using libclang. Contains both a drop-in remplacement, and a plugin for the clang compiler.
https://woboq.com/blog/moc-with-clang.html
GNU General Public License v3.0
204 stars 24 forks source link

moc-ng wants to ovewrite Qt's moc under /usr/bin/ #13

Open Petross404 opened 5 years ago

Petross404 commented 5 years ago

Trying to install moc-ng with Portage gives me this :

>> Installing (1 of 1) dev-util/moc-ng-9999::testing
 * checking 4 files for package collisions
 * This package will overwrite one or more files that may belong to other
 * packages (see list below). You can use a command such as `portageq
 * owners / <filename>` to identify the installed package that owns a
 * file. If portageq reports that only one package owns a file then do
 * NOT file a bug report. A bug report is only useful if it identifies at
 * least two or more packages that are known to install the same file(s).
 * If a collision occurs and you can not explain where the file came from
 * then you should simply ignore the collision since there is not enough
 * information to determine if a real problem exists. Please do NOT file
 * a bug report at https://bugs.gentoo.org/ unless you report exactly
 * which two packages install the same file(s). See
 * https://wiki.gentoo.org/wiki/Knowledge_Base:Blockers for tips on how
 * to solve the problem. And once again, please do NOT file a bug report
 * unless you have completely understood the above message.
 * 
 * Detected file collision(s):
 * 
 *      /usr/bin/moc
 * 
 * Searching all installed packages for file collisions...
 * 
 * Press Ctrl-C to Stop
 * 
 * dev-qt/qtchooser-66:0::gentoo
 *      /usr/bin/moc
 * 
 * Package 'dev-util/moc-ng-9999' NOT merged due to file collisions. If
 * necessary, refer to your elog messages for the whole content of the
 * above message.
Petross404 commented 5 years ago

This patch helped but still, is there a better way?

From 62b06474c31f9d0674f5139e584711e21f4fb702 Mon Sep 17 00:00:00 2001
From: Petros Siligkounas <petross404@gmail.com>
Date: Wed, 13 Feb 2019 20:48:13 +0200
Subject: [PATCH] Rename moc target as moc-ng, so it doesn't overwrite Qt's moc

---
 src/CMakeLists.txt | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index e38fbd1..bcf57ea 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -98,6 +98,10 @@ configure_file(embedded_includes.h.in embedded_includes.h)
 include_directories(${CMAKE_CURRENT_BINARY_DIR})

 include("GNUInstallDirs")
+#Installing moc under /usr/bin will erase Qt's moc
+if(${CMAKE_BUILD_TYPE} MATCHES "Gentoo")
+    set_target_properties(moc PROPERTIES OUTPUT_NAME "moc-ng")
+endif()
 install(TARGETS moc mocng_plugin
     RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
     LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ogoffart commented 5 years ago

The idea is to overwrite Qt's moc so it is used instead, as it is supposed to be a drop-in replacement.

I admit not everybody wants that, but if we give it another name, it makes it harder to use.

Petross404 commented 5 years ago

I am thinking about another idea. Maybe moc-ng could be installed in some other directory like /usr/lib/moc-ng/moc and a symlink as /usr/bin/moc could point either to moc-ng or /usr/lib64/qt5/.../moc.

This has to be supported from the distribution and Qt's packaging so I don't hold my breath. Thank you anyway. Feel free to close this issue is there is nothing to be done (at least now).