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

Error when building KI18n module #3

Open
estan opened this issue Jun 6, 2016 · 6 comments
Open

Error when building KI18n module #3

estan opened this issue Jun 6, 2016 · 6 comments

Comments

@estan
Copy link
Contributor

estan commented Jun 6, 2016

I'm getting

[ 36%] Building CXX object src/CMakeFiles/Py3KF5KI18n.dir/pybuild/PyKF5/KI18n/unifiedKI18n.cpp.o
<command-line>:0:20: error: expected identifier before string constant
/home/estan/frameworks-bindings/ki18n/src/klocalizedstring.h:1967:25: note: in expansion of macro ‘TRANSLATION_DOMAIN’
 #define i18n(...) i18nd(TRANSLATION_DOMAIN, __VA_ARGS__)
                         ^~~~~~~~~~~~~~~~~~
/home/estan/frameworks-bindings/ki18n/src/klocalizedcontext.h:68:25: note: in expansion of macro ‘i18n’
     Q_INVOKABLE QString i18n(const QString &message,
                         ^~~~

and a few similar errors when the KI18n module is compiled.

I'm attaching the full cmake --build . output.

This is on an up-to-date Arch Linux. Am I missing some dependency?

buildlog.txt

@estan
Copy link
Contributor Author

estan commented Jun 6, 2016

I guess the warnings above about rules not firing could be the culprit?

@steveire
Copy link
Owner

Whenever reporting an error, make sure to do some minimizing before you do. For example, your build log contains too much. Apply something like

frameworks-bindings{master}$ git diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c0b9fde..f698393 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -25,15 +25,15 @@ endmacro()

add_repo(extra-cmake-modules DEPENDS "")

-add_repo(kitemmodels DEPENDS extra-cmake-modules)
-add_repo(kcoreaddons DEPENDS extra-cmake-modules)
-add_repo(kdbusaddons DEPENDS extra-cmake-modules)
-add_repo(kguiaddons DEPENDS extra-cmake-modules)
-add_repo(kwidgetsaddons DEPENDS extra-cmake-modules)
-add_repo(kjobwidgets DEPENDS kcoreaddons kwidgetsaddons)
-add_repo(kconfig DEPENDS extra-cmake-modules)
-add_repo(kcompletion DEPENDS kconfig kwidgetsaddons)
-add_repo(kauth DEPENDS kcoreaddons)
-add_repo(kcodecs DEPENDS extra-cmake-modules)
+# add_repo(kitemmodels DEPENDS extra-cmake-modules)
+# add_repo(kcoreaddons DEPENDS extra-cmake-modules)
+# add_repo(kdbusaddons DEPENDS extra-cmake-modules)
+# add_repo(kguiaddons DEPENDS extra-cmake-modules)
+# add_repo(kwidgetsaddons DEPENDS extra-cmake-modules)
+# add_repo(kjobwidgets DEPENDS kcoreaddons kwidgetsaddons)
+# add_repo(kconfig DEPENDS extra-cmake-modules)
+# add_repo(kcompletion DEPENDS kconfig kwidgetsaddons)
+# add_repo(kauth DEPENDS kcoreaddons)
+# add_repo(kcodecs DEPENDS extra-cmake-modules)
add_repo(ki18n DEPENDS extra-cmake-modules)
-add_repo(kconfigwidgets DEPENDS kcodecs kwidgetsaddons kconfig kauth)
+# add_repo(kconfigwidgets DEPENDS kcodecs kwidgetsaddons kconfig kauth)

Then make sure you get verbose build output. You can see that your error message is talking about a problem on the command line, so you need to see what that is.

build $ cd ki18n-prefix/src/ki18n-build
ki18n-build $ make VERBOSE=1

@ShaheedHaque
Copy link

ShaheedHaque commented Dec 26, 2016

With VERBOSE=1, the first error messages are:

[ 36%] Building CXX object src/CMakeFiles/Py3KF5KI18n.dir/pybuild/PyKF5/KI18n/unifiedKI18n.cpp.o
cd /home/srhaque/kdedev/frameworks-bindings/build/ki18n-prefix/src/ki18n-build/src && /usr/bin/c++ -DPy3KF5KI18n_EXPORTS -DQT_CORE_LIB -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII -DQT_NO_DEBUG -DQT_NO_SIGNALS_SLOTS_KEYWORDS -DQT_NO_URL_CAST_FROM_STRING -DQT_USE_FAST_OPERATOR_PLUS -DQT_USE_QSTRINGBUILDER -DTRANSLATION_DOMAIN=\"ki18n5\" -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -I/home/srhaque/kdedev/frameworks-bindings/build/ki18n-prefix/src/ki18n-build/src -I/home/srhaque/kdedev/frameworks-bindings/ki18n/src -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -isystem /usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64 -isystem /usr/include/python3.5m -std=c++0x -fno-exceptions -Wall -Wextra -Wcast-align -Wchar-subscripts -Wformat-security -Wno-long-long -Wpointer-arith -Wundef -Wnon-virtual-dtor -Woverloaded-virtual -Werror=return-type -pedantic -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -fstack-protector-strong -Wno-deprecated-declarations -Wno-overloaded-virtual -fPIC -o CMakeFiles/Py3KF5KI18n.dir/pybuild/PyKF5/KI18n/unifiedKI18n.cpp.o -c /home/srhaque/kdedev/frameworks-bindings/build/ki18n-prefix/src/ki18n-build/src/pybuild/PyKF5/KI18n/unifiedKI18n.cpp
<command-line>:0:20: error: expected identifier before string constant
/home/srhaque/kdedev/frameworks-bindings/ki18n/src/klocalizedstring.h:1967:25: note: in expansion of macro ‘TRANSLATION_DOMAIN’
#define i18n(...) i18nd(TRANSLATION_DOMAIN, __VA_ARGS__)
^~~~~~~~~~~~~~~~~~
/home/srhaque/kdedev/frameworks-bindings/ki18n/src/klocalizedcontext.h:68:25: note: in expansion of macro ‘i18n’
Q_INVOKABLE QString i18n(const QString &message,
^~~~
<command-line>:0:20: error: expected ‘,’ or ‘...’ before string constant
/home/srhaque/kdedev/frameworks-bindings/ki18n/src/klocalizedstring.h:1967:25: note: in expansion of macro ‘TRANSLATION_DOMAIN’
#define i18n(...) i18nd(TRANSLATION_DOMAIN, __VA_ARGS__)
^~~~~~~~~~~~~~~~~~

I note that TRANSLATION_DOMAIN is set in the command to a string, "ki18n5". But I cannot quite see the wood for the trees... The preprocessed code looks like this:

QString i18nd("ki18n5", const QString &message, const QVariant &p1 = QVariant(), const QVariant &p2 = QVariant(), const QVariant &p3 = QVariant(), const QVariant &p4 = QVariant(), const QVariant &p5 = QVariant(), const QVariant &p6 = QVariant(), const QVariant &p7 = QVariant(), const QVariant &p8 = QVariant(), const QVariant &p9 = QVariant(), const QVariant &p10 = QVariant()) const;

which is clearly wrong. But I can't quite see what the literal is supposed to be.

@ShaheedHaque
Copy link

Based on the documentation on TRANSLATION_DOMAIN in ki18n/docs/programmers-guide.md, I tried prepending an #undef TRANSLATION_DOMAIN to the unifiedKI18n.cpp generated by the cmake logic, and that at least allows the compilation to proceed. I'm not sure if this is the right/correct fix though.

@steveire
Copy link
Owner

@ShaheedHaque What is 'clearly wrong' about the preprocessed code?

@ShaheedHaque
Copy link

ShaheedHaque commented Jan 18, 2017 via email

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

3 participants