-
-
Notifications
You must be signed in to change notification settings - Fork 425
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
[FEATURE] Nix CMake build process #3076
Comments
Signed-off-by: Patrizio Bekerle <[email protected]>
@Waqar144, I was trying to build QOwnNotes with Qt6 and CMake in https://github.com/pbek/QOwnNotes/blob/feature/nix-cmake/default.nix via Lines 16 to 17 in 08c1657
I got the error message:
Does this ring any bell for you? |
Note that I tried to use: Lines 47 to 50 in d307a41
Have you ever built QOwnNotes with Qt6 and CMake? I only built it in Qt5 with CMake, as far as I remember... |
Signed-off-by: Patrizio Bekerle <[email protected]>
I'm now at:
@NickCao, do you maybe have an idea to get around that in nix? |
Signed-off-by: Patrizio Bekerle <[email protected]>
Either we build botan2 with cmake, or locate botan2 with pkg-config instead. |
@NickCao, thank you! The latter would be nice, I guess. |
Strange, it seems that we are already doing that: https://github.com/pbek/QOwnNotes/blob/064310baf0efc8b1edf3c8c0ef4903cf52fab9db/cmake/FindBotan2.cmake |
Ah the cmake folder is missing from |
Which nix conjuration do we need to use? 😊 |
Surprise! diff --git a/default.nix b/default.nix
index 604f1b831..10c8b8e31 100644
--- a/default.nix
+++ b/default.nix
@@ -25,7 +25,7 @@ in
stdenv.mkDerivation {
inherit pname appname version;
- src = builtins.path { path = ./src; name = "qownnotes"; };
+ src = builtins.path { path = ./.; name = "qownnotes"; };
nativeBuildInputs = [
cmake |
The line appending to Line 5 in 064310b
|
That was quick. 😂🤣 Thank you very much! I'll build and test for a while! |
Meh, in the source archive on https://github.com/pbek/QOwnNotes/releases/download I only use the |
And I'm getting an error after building:
|
We can move the entire |
Signed-off-by: Patrizio Bekerle <[email protected]>
Guess we have to set |
Signed-off-by: Patrizio Bekerle <[email protected]>
Now I got to:
🤔 |
I believe this can be an upstream bug: https://github.com/qownnotes/md4c/blob/c64ee9ab326c53962b5bd8cca98c086461bbdd6b/src/CMakeLists.txt#L40, try changing CMAKE_BINARY_DIR to CMAKE_CURRENT_BINARY_DIR? |
I have a cmake patch that fixes the install, will push it soon |
Fixes the install == makes it work the same as qmake So that it can be a drop in replacement |
Thank you, @Waqar144 |
We can't use system md4c, we just need to force static linking or just compile md4c into QOwnNotes like qmake does. |
Plus, we are using https://github.com/qownnotes/md4c. 😉 |
Signed-off-by: Patrizio Bekerle <[email protected]>
Signed-off-by: Patrizio Bekerle <[email protected]>
@NickCao, I tried to build for qt5 as a nix derivation and got the same error. Building and running the app with CMake in CLion (under NixOS) works tho (running with wrapQtAppsHook). |
Signed-off-by: Patrizio Bekerle <[email protected]>
I checked the build output, and md4c is indeed not installed. Possible fix: For md4c (don't know how to fix installation of these .pc files so dropped them altogether): diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 767c259..4800e97 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -37,7 +37,6 @@ install(
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
-install(FILES ${CMAKE_BINARY_DIR}/src/md4c.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
install(
TARGETS md4c-html
@@ -47,7 +46,5 @@ install(
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
-install(FILES ${CMAKE_BINARY_DIR}/src/md4c-html.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
install(EXPORT md4cConfig DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/md4c/ NAMESPACE md4c::) For qownnotes --- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -29,8 +29,7 @@ include(libraries/sonnet/src/plugins/hunspell/hunspell/CMakeLists.txt)
# noneed for md2html
set(BUILD_MD2HTML_EXECUTABLE FALSE)
-set(BUILD_SHARED_LIBS OFF)
-add_subdirectory(libraries/md4c EXCLUDE_FROM_ALL)
+add_subdirectory(libraries/md4c)
add_executable(QOwnNotes "")
|
https://github.com/pbek/QOwnNotes/blob/475afebce832a8d48d3f12a3668611912c204ff2/default.nix was used for building. I hope this will also work with a release archive and on Darwin. |
I think we should try to move all Qt6 builds to cmake, it has much better support (and documentation) everywhere. Once Qt6 is in place, one can think about moving the OBS builders and others slowly. |
There are so many build services QOwnNotes deploys to. 🙈 😁 |
Signed-off-by: Patrizio Bekerle <[email protected]>
Signed-off-by: Patrizio Bekerle <[email protected]>
Signed-off-by: Patrizio Bekerle <[email protected]>
Signed-off-by: Patrizio Bekerle <[email protected]>
Signed-off-by: Patrizio Bekerle <[email protected]>
Signed-off-by: Patrizio Bekerle <[email protected]>
Well, hopefully you don't mind me interjecting, and if you do, I will bow out. Actually note that xvfb-run does not exist in nix for darwin, either chip type, unless I am missing something as my nix build got an error for that. Looks like linux only. I'm trying on x86_64 (which is unnecessary since I could just download it), though I will have a M1 Mac shortly (delayed by USPS). I suppose I could try and build from source on the M1 but saw this case so tried it. |
Thank you for pointing that out! 👍🏻 I guess that discussion needs to be taken directly to nixpkgs or in a separate issue. It has nothing to do with CMake. Is there any alternative? Something to put in a PR for: I'll do a PR for the CMake transition with the next release of QOwnNotes. |
Signed-off-by: Patrizio Bekerle <[email protected]>
@NickCao, I created NixOS/nixpkgs#334463. |
24.8.5
|
Signed-off-by: Patrizio Bekerle <[email protected]>
cmake: use IMPORTED_TARGET to create imported target for botan2
Signed-off-by: Patrizio Bekerle <[email protected]>
As requested by @NickCao in NixOS/nixpkgs#332556 (comment), it would be great to build QOwnNotes with CMake for nixpkgs.
Todo
The text was updated successfully, but these errors were encountered: