Could not find a package configuration file provided by "Protobuf" with any of the following names: ProtobufConfig.cmake protobuf-config.cmake - cmake

Trying to compile the quick start example for GRPC.
It produces these errors:
CMake Error at /home/priya/grpc/examples/cpp/cmake/common.cmake:101 (find_package):
Could not find a package configuration file provided by "Protobuf" with any
of the following names:
ProtobufConfig.cmake
protobuf-config.cmake
Add the installation prefix of "Protobuf" to CMAKE_PREFIX_PATH or set
"Protobuf_DIR" to a directory containing one of the above files. If
"Protobuf" provides a separate development package or SDK, be sure it has
been installed.
Call Stack (most recent call first):
CMakeLists.txt:24 (include)
I have tried all the proposed solutions for this on other similar questions but to no avail. These are the solutions that did not work for me:
Changing find_package(protobuf CONFIG REQUIRED) to an uppercase find_package(Protobuf REQUIRED)
Installing pkg-config
This thread
I could not find any other solutions. Any help would be greatly appreciated.

So the problem is I am new with bash scripts. I had copied and pasted the instructions in quick start into a bash script so that we could integrate the gRPC repository into our repo smoothly without having to build manually each time.
This problem was caused by incorrectly calling the script, which meant the environment variable for the install directory was never getting set correctly and was remaining an empty value. You must put source before calling the file, e.g source ./grpcSetup.sh. Please read this other stackoverflow question that explains the problem more clearly.

It's likely to be caused by lack of submodules in the gRPC repo, I guess. Would you get submodules before build? You can run git clone --recurse-submodules -b v1.38.0 https://github.com/grpc/grpc for it, as an example.

Have you compiled and installed grpc before?
I get this cmake error today and I run make install in the directory of builded grpc and it works now.

While installing GRPC, a variable is set that points to installation folder of GRPC.
mkdir -p $MY_INSTALL_DIR
mkdir -p $MY_INSTALL_DIR
If we change name MY_INSTALL_DIR to other, then that has to changed in CMakeList.txt file , hence error. To avoid and to keep it simple just use same name as mentioned in documentation.

Related

Running software build in MSYS2 MINGW32 shell

I'm trying to run a piece of software I built in MSYS2 MINGW32 shell. The software is 32bits (don't have time to port it to 64bits) and there is one statically linked executable. Here is how I setup the build environment:
Installed a fresh copy of MSYS2;
$ pacman -Syu
Installed the following packages: git mingw-w64-i686-gcc mingw-w64-i686-cmake mingw-w64-i686-SDL mingw-w64-i686-SDL_mixer mingw-w64-i686-zlib mingw-w64-i686-libpng mingw-w64-i686-make
Git checkout the repo
Run the build in CMake
Build runs fine and the exe is generated.
Now the problem starts: the executable can't run and displays an error message about missing DLLs. I copied the missing DLLs to the same folder of the executable, and them another error message pops up complaining about error 0xC000007B, which I tracked down to be missing dependencies. After a while I figured out that the problem was that some of the DLLs is missing a dependency itself. Copied this last dependency to the folder.
Now, the big question: I can run the exe perfectly fine in the MINGW32 shell but I can't run it neither in cmd.exe nor by double-clicking in Windows Explorer and this is a problem (I can't ship a software this way). Is there any way to produce a binary that is able to run from explorer and from cmd.exe? What is the cause of this problem? Can it be mitigated?
I solved my problem!
After a lot of research, I realized that nothing was wrong with my MSYS2 build/setup/dependencies. The real problem was that CMake hide one parameter for the linker: -mwindows. Actually, the CMake find_package routine from one of the libraries I'm using (SDL) added this parameter to the linker command line parameters.
Adding a -mconsole to the linker parameters (using add_link_options("-mconsole")) solved the problem. The CLI now works as expected.
Thank you all for your help.

Downloading from github - there seems to be a directory missing (azure-iot-sdk-c)

I am working thru this Tutorial
(https://learn.microsoft.com/en-us/azure/iot-develop/quickstart-send-telemetry-central?pivots=programming-language-ansi-c)
Was able to perform all steps to install the SDK and samples.
In the next step - when I ran the sample code:
cmake\iothub_client\samples\pnp\pnp_temperature_controller\Debug\pnp_temperature_controller.exe
Encountered an error that states:
The system cannot find the path specified.
When I look into my directory system & follow the path of the sample code above I see that the path ends at
cmake\iothub_client\samples\pnp\pnp_temperature_controller\
This section is missing
\Debug\pnp_temperature_controller.exe
Missing:
(Directory: "Debug"
File: "pnp_temperature_controller.exe")
Have I done something wrong or is this missing from the repository. I somehow think that I did something wrong but I cannot see where.
Any help on this would be helpful. Thanks
Weng
Are you able to complete the step3 under Install the SDK and samples successfully?
cmake -Bcmake -Duse_prov_client=ON -Dhsm_type_symm_key=ON -Drun_e2e_tests=OFF
cmake --build cmake
Please ensure you have installed cmake and path is updated in your machine.
I had the same issue initially and then checked the cmake version and appears to be not added to the system Path.
Once cmake is installed and updated the PATH, I tried the example again and able to run it successfully.
Output from the Azure IoT Central page device telemetry graph.

Cannot configure QtCreator using CMake on Ubuntu 18.04

I am trying to setup a project based on CMake with QtCreator.
In Projects I defined the Build Steps I need.
In the Build setting I get constantly the error message:
Failed to activate protocol version: "CMAKE_GENERATOR" is set but incompatible with configured generator value
I tried to browse on the Internet for this problem but I could not get rid of this error.
If now I however try to build my project specifying a target, my compile steps are not executed, instead, I get the following message:
Running "/usr/local/bin/cmake -E server --pipe=/tmp/cmake-W2VOXm/socket --experimental" in xxxx/.Build/release.
CMake Project parsing failed.
Parsing of CMake project failed: Connection to CMake server lost.
Restarting QtCreator does not help, each time the project is opened the message happens again.
Make sure the build directory it's in the same directory than your projects is, like this:
I got a similar error and have fixed it.
Try to reinstall cmake in Ubuntu by follwing https://cgold.readthedocs.io/en/latest/first-step/installation.html#ubuntu.
Configurate Tools - Options - build & run regarding "cmake" and "kits". Make sure that one of the configurations (auto-detected or maunal) is corrected.
restart qt creator, open project and "run cmake" again.
I have seen and resolved this issue previously by just deleting the build folder, reloading qtcreator and rerunning cmake.

How can I resolve the "Could not find the required component 'libdlib'" error?

I am trying to to compile this ROS package but I get the following error
Could not find a package configuration file provided by "libdlib" with any of the following names:
libdlibConfig.cmake
libdlib-config.cmake
Add the installation prefix of "libdlib" to CMAKE_PREFIX_PATH or set
"libdlib_DIR" to a directory containing one of the above files. If
"libdlib" provides a separate development package or SDK, be sure it has
been installed.
Referencing some other answers on SO and elsewhere, I have added the following lines to CMakeLists.txt
include(/home//src/dlib/dlib/cmake)
include_directories (${dlib_INCLUDE_DIRS})
target_link_libraries(room_segmentation_server ${dlib_LIBRARIES})
I have also installed dlib using these instructions but the error persists.
What am I missing or doing wrong?
First of all: it is way more easy to help you, if you provide your code and the exact error you're facing.
I suppose, that you are trying to find the library with help of find_package(dlib CONFIG)?!
libdlibConfig.cmake is a CMake-File that needs to be provided by your dlib installation. This file has everthing written into it for your cmake, to find the include- and library paths of your dlib-installation. With its help, your cmake then sets the Variables that you're trying to use: dlib_INCLUDE_DIRS and dlib_LIBRARIES (pointing to its corresponding paths).
Therefor that your cmake-call complains, that such a libdlibConfig.cmake couldn't be found, you either do not have such a file on your system, or it is not in the expected directory. In both ways: the variables that you are trying to use, will not be set. Alternatively there might be a FindDlib.cmake-File on your system, that does almost the same, that you could refer to by find_package(Dlib).
If you do not have either of those two file, you need to specify the paths to the include-dir and library-dir on your own:
set(dlib_LIBRARIES "<path to your libdlib.dll>")
set(dlib_INCLUDE_DIR "<path to your dlib/include-folder>")
find_library(LIBDLIB dlib ${dlib_LIBRARIES})
target_include_directories(<your_target> ${dlib_INCLUDE_DIR})
target_link_libraries(<your_target> LIBDLIB)

ownCloud Desktop Client Theming

I have been trying to build the desktop client for about a week now so that I can dig in and try to mess with some theming and turn off some features I wont be needing. In the process I have run into numerous issues and have managed to resolve them in one way or another. I have a VM running openSUSE and I have downloaded the source file ownCloudClient-2.3.2.tar.xz file and unzipped it all into my home/jwarren/client folder. I then ran:
cd admin/win/docker
docker build . -t owncloud-client-win32:
Which I was able to get through. Now I am on the second command:
docker run -v "$PWD:/home/user/client" owncloud-client-win32: \
/home/user/client/admin/win/docker/build.sh client/ $(id -u)
Here I am getting almost to the end and then I receive this error message which I cant figure out how to resolve.
CPack Error: Problem running NSIS command "user/bin/makensis"
CPack Error: Problem Compressing Directory
Can anyone help me out with this? Or maybe point me in the direction of better instructions for the ownCloud Desktop Client theming. I noticed that once you get it installed properly there is no instructions explaining where anything is to edit.
I wrote a comprehensive guide to build the Windows client using the cross-compilation toolchain in the Dockerfile some time ago in ownCloud's central: https://central.owncloud.org/t/error-using-docker-to-build-the-windows-client/5107/5
What you're probably missing out is the git-submodule initialization; i.e. running git submodule update --init on your unzipped repository. You need these to bundle on the installer some pre-compiled binaries used by the shell integrations.
Also, on a side note, there was some problems last month with mingw toolchain compiler (gcc7) - in case you get some dll error after installing the client with your self-generated installer, refer to https://central.owncloud.org/t/building-the-windows-installer/8403/4 for an snapshot of a fully working Docker image to use instead of your self-built.
About the docs to build your own theme: those can be found in https://doc.owncloud.org/branded_clients/branded_desktop_client/index.html (for enterprise installations of ownCloud) - and for an unsupported version, you can also check the source in
https://github.com/owncloud/client/blob/master/src/libsync/theme.cpp for some hints about what settings can be overwritten from there.