Page 1 of 1

2022.2 Domoticz sources not compiling

Posted: Thursday 01 December 2022 11:28
by meal
Hello,

Context of the issue :
- Domoticz running on RPI3B+
- Python 3.7.3
- Current version used 2022.1 version 14338


I want to build domoticz 2022.2 version from latest beta sources and followed the procedure described in "https://www.domoticz.com/wiki/Build_Dom ... rom_source".

At domoticz compilation time of the file "domoticz_tester.cpp" I have the following error
In file included from /home/pi/DEV20200309/dev-domoticz/main/domoticz_tester.cpp:8:
/home/pi/DEV20200309/dev-domoticz/main/appversion.h:2:10: fatal error: ../appversion.h: Aucun fichier ou dossier de ce type
#include "../appversion.h"
^~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/domoticztester.dir/build.make:143: CMakeFiles/domoticztester.dir/main/domoticz_tester.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:446: CMakeFiles/domoticztester.dir/all] Error 2
make: *** [Makefile:171: all] Error 2

It seems that the file "dev-domoticz/appversion.h" is missing.

The file is not in the clone distribution "git clone https://github.com/domoticz/domoticz.git dev-domoticz"

For information I managed to build the 2022.1 Domoticz version from sources in June 2022 and in that version the content of the "dev-domoticz/appversion.h" was:
#define APPVERSION 14338
#define APPHASH "8d73c42d6-modified"
#define APPDATE 1652636840
At that time "domoticz_tester.cpp" was not part of the 2022.1 Domoticz sources distribution.

Did I miss something ?

I thank you in advance for your help.
BR

Re: 2022.2 Domoticz sources not compiling

Posted: Thursday 01 December 2022 22:18
by ferrosk
meal wrote: Thursday 01 December 2022 11:28 It seems that the file "dev-domoticz/appversion.h" is missing.
It is not present just after 'git clone' but it is generated in this path by 'make' during build time. If not, then you are doing something wrong...

Why are you trying to build Domoticz from sources? If not familiar with the process and you need latest beta version, you can download pre-compiled beta binaries resp. use './updatebeta' script to upgrade Domoticz.

Re: 2022.2 Domoticz sources not compiling

Posted: Friday 02 December 2022 6:56
by kiddigital
The ‘CMake’ command before the actual `make` command should generate that file as far as I remember.

Re: 2022.2 Domoticz sources not compiling

Posted: Friday 02 December 2022 10:19
by ferrosk
kiddigital wrote: Friday 02 December 2022 6:56 The ‘CMake’ command before the actual `make` command should generate that file as far as I remember.
It is actually 'make' after CMake that generates it based on build target defined in CMakeLists.txt ;)

From CMakeLists.txt:

Code: Select all

...
# creates appversion.h using cmake script
ADD_CUSTOM_COMMAND(TARGET revisiontag COMMAND ${CMAKE_COMMAND}
   -DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}
   -P ${CMAKE_CURRENT_SOURCE_DIR}/getgit.cmake)

MESSAGE(STATUS "###########################")
MESSAGE(STATUS "Compiling Revision #${ProjectRevision}")
MESSAGE(STATUS "###########################")

# The version number.
set (domoticz_VERSION_MAJOR 2020)
set (domoticz_VERSION_MINOR 1)
set (domoticz_VERSION_PATCH ${ProjectRevision})
...
Step 1: git clone

Code: Select all

vagrant@debian-dzdev:/tmp$ git clone https://github.com/domoticz/domoticz.git dev-domoticz
Cloning into 'dev-domoticz'...
remote: Enumerating objects: 91727, done.
remote: Counting objects: 100% (305/305), done.
remote: Compressing objects: 100% (166/166), done.
remote: Total 91727 (delta 171), reused 253 (delta 139), pack-reused 91422
Receiving objects: 100% (91727/91727), 257.55 MiB | 12.21 MiB/s, done.
Resolving deltas: 100% (67529/67529), done.
vagrant@debian-dzdev:/tmp$ cd dev-domoticz/
vagrant@debian-dzdev:/tmp/dev-domoticz$ ls -la appversion.h
ls: cannot access 'appversion.h': No such file or directory
Step 2: Cmake

Code: Select all

vagrant@debian-dzdev:/tmp/dev-domoticz$ cmake -DCMAKE_BUILD_TYPE=Release --log-level=ERROR CMakeLists.txt
Submodule 'extern/fmtlib' (https://github.com/fmtlib/fmt.git) registered for path 'extern/fmtlib'
Submodule 'extern/jsoncpp' (https://github.com/domoticz/jsoncpp) registered for path 'extern/jsoncpp'
Submodule 'minizip' (https://github.com/domoticz/minizip.git) registered for path 'extern/minizip'
Submodule 'extern/mosquitto' (https://github.com/eclipse/mosquitto.git) registered for path 'extern/mosquitto'
Submodule 'extern/sqlite-amalgamation' (https://github.com/azadkuh/sqlite-amalgamation.git) registered for path 'extern/sqlite-amalgamation'
Cloning into '/tmp/dev-domoticz/extern/fmtlib'...
Cloning into '/tmp/dev-domoticz/extern/jsoncpp'...
Cloning into '/tmp/dev-domoticz/extern/minizip'...
Cloning into '/tmp/dev-domoticz/extern/mosquitto'...
Cloning into '/tmp/dev-domoticz/extern/sqlite-amalgamation'...
Submodule path 'extern/fmtlib': checked out 'b0c8263cb26ea178d3a5df1b984e1a61ef578950'
Submodule path 'extern/jsoncpp': checked out '2a6e163b02ac5044d74a44ed15f8aa7af687aea5'
Submodule path 'extern/minizip': checked out '78eb93e8e0ba228f37b197d2022d66b73856c9ff'
Submodule path 'extern/mosquitto': checked out 'a8448a9c7b14bdaee6ec80419d43fd6544e789b6'
Submodule path 'extern/sqlite-amalgamation': checked out '15d0ff10ebc7e7225eced1de84bb52137000899b'
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/dev-domoticz
vagrant@debian-dzdev:/tmp/dev-domoticz$ ls -la appversion.h
ls: cannot access 'appversion.h': No such file or directory
Step3: make

Code: Select all

vagrant@debian-dzdev:/tmp/dev-domoticz$ make
Scanning dependencies of target revisiontag
-- Found Git: /usr/bin/git (found version "2.30.2")
[  0%] Built target revisiontag
Scanning dependencies of target minizip
[  0%] Building C object extern/minizip/CMakeFiles/minizip.dir/ioapi.c.o
[  1%] Building C object extern/minizip/CMakeFiles/minizip.dir/unzip.c.o
[  1%] Building C object extern/minizip/CMakeFiles/minizip.dir/zip.c.o
... <stripped> ...
vagrant@debian-dzdev:/tmp/dev-domoticz$ ls -la appversion.h
-rw-r--r-- 1 vagrant vagrant 80 Dec  2 10:12 appversion.h

Re: 2022.2 Domoticz sources not compiling

Posted: Sunday 04 December 2022 14:04
by meal
Hello,

I have fixed the issue and successfully built the 2022.2 domoticz version from sources.

The process starts by building first "domoticztester" and then "domoticz" as shown in the make.log file.

[ 1%] Built target minizip
[ 2%] Built target jsoncpp_static
[ 16%] Built target libmosquitto_static
[ 16%] Building CXX object CMakeFiles/domoticztester.dir/main/domoticz_tester.cpp.o
[ 16%] Building CXX object CMakeFiles/domoticztester.dir/main/BaroForecastCalculator.cpp.o
[ 17%] Building CXX object CMakeFiles/domoticztester.dir/main/HTMLSanitizer.cpp.o
[ 17%] Building CXX object CMakeFiles/domoticztester.dir/main/localtime_r.cpp.o
[ 17%] Building CXX object CMakeFiles/domoticztester.dir/main/SunRiseSet.cpp.o
[ 17%] Building CXX object CMakeFiles/domoticztester.dir/main/TrendCalculator.cpp.o
[ 17%] Building CXX object CMakeFiles/domoticztester.dir/main/WindCalculation.cpp.o
[ 19%] Building CXX object CMakeFiles/domoticztester.dir/main/json_helper.cpp.o
[ 19%] Building CXX object CMakeFiles/domoticztester.dir/hardware/ColorSwitch.cpp.o
[ 19%] Linking CXX executable domoticztester
[ 20%] Built target domoticztester
Scanning dependencies of target revisiontag
-- Found Git: /usr/bin/git (found version "2.20.1")
[ 20%] Built target revisiontag
Scanning dependencies of target domoticz
[ 20%] Building CXX object CMakeFiles/domoticz.dir/cmake_pch.hxx.gch
[ 20%] Building CXX object CMakeFiles/domoticz.dir/main/stdafx.cpp.o
[ 20%] Building CXX object CMakeFiles/domoticz.dir/main/BaroForecastCalculator.cpp.o
[ 20%] Building CXX object CMakeFiles/domoticz.dir/main/CmdLine.cpp.o
[ 22%] Building CXX object CMakeFiles/domoticz.dir/main/Camera.cpp.o
[ 22%] Building CXX object CMakeFiles/domoticz.dir/main/domoticz.cpp.o
[ 22%] Building CXX object CMakeFiles/domoticz.dir/main/dzVents.cpp.o
[ 22%] Building CXX object CMakeFiles/domoticz.dir/main/EventSystem.cpp.o
[ 22%] Building CXX object CMakeFiles/domoticz.dir/main/EventsPythonModule.cpp.o
[ 23%] Building CXX object CMakeFiles/domoticz.dir/main/EventsPythonDevice.cpp.o
[ 23%] Building CXX object CMakeFiles/domoticz.dir/main/Helper.cpp.o
[ 23%] Building CXX object CMakeFiles/domoticz.dir/main/HTMLSanitizer.cpp.o
[ 23%] Building CXX object CMakeFiles/domoticz.dir/main/IFTTT.cpp.o
[ 23%] Building CXX object CMakeFiles/domoticz.dir/main/json_helper.cpp.o
[ 25%] Building CXX object CMakeFiles/domoticz.dir/main/localtime_r.cpp.o

The file "appversion.h" is missing after "git clone https://github.com/domoticz/domoticz.git dev-domoticz"
and is required to build domoticztester. As consequence the following error is raised:
In file included from /home/pi/DEV20200309/dev-domoticz/main/domoticz_tester.cpp:8:
/home/pi/DEV20200309/dev-domoticz/main/appversion.h:2:10: fatal error: ../appversion.h: Aucun fichier ou dossier de ce type
#include "../appversion.h"

To solve the issue I created a "appversion.h" file in dev-domoticz directory with the content of previous version of appversion.h (2022.1).

Then launched the make process with the following steps:

- domoticztester is build successfully:

- target revisiontag created the new appversion.h file with the following content

#define APPVERSION 14787
#define APPHASH "d5d30c071"
#define APPDATE 1669890514

- Domoticz is built successfully.

BR

Re: 2022.2 Domoticz sources not compiling

Posted: Sunday 04 December 2022 14:57
by ferrosk
If you read my previous posts you should understand the file is generated automatically. You should not create it manually (you cannot just guess its content). Maybe you missed some step or previous step did not complete successfully and you didn't notice...

Re: 2022.2 Domoticz sources not compiling

Posted: Sunday 04 December 2022 15:21
by kiddigital
Hi @meal and @ferrosk,

Thank you for looking into this.

I created Pull Request 5441 to fix the problem.

Re: 2022.2 Domoticz sources not compiling

Posted: Sunday 04 December 2022 17:02
by meal
Hello

Many thanks for the issue fixing

BR

Re: 2022.2 Domoticz sources not compiling

Posted: Monday 05 December 2022 13:54
by kiddigital
meal wrote: Sunday 04 December 2022 17:02 Hello

Many thanks for the issue fixing

BR
Great, so it works for you now as well?

If so, please mark this thread as solved :)