Conan cannot find a certain package for the specified settings, options and dependencies - c

I am working on a small C executable project using Jetbrains CLion 2019.3, MinGW 8.1, and also the Conan C/C++ Package Manager 1.21.1. I am refreshing my knowledge about C and want to learn about new tools like Conan. My main development environment is Windows, but this project is intended to be cross-platform; I would like to be able to build and run the application on Linux/Unix as well.
Since my application needs to compute signatures using HMACSHA1, I want to use the OpenSSL library, so I added the OpenSSL/1.1.1a#conan/stable package to the requires section of my conanfile.txt file, and I also created a Conan profile for MinGW that has the following options:
toolchain=$MINGW64_PATH
target_host=x86_64-w64-mingw32
cc_compiler=gcc
cxx_compiler=g++
[env]
CONAN_CMAKE_FIND_ROOT_PATH=$toolchain
CHOST=$target_host
AR=$target_host-ar
AS=$target_host-as
RANLIB=$target_host-ranlib
CC=$target_host-$cc_compiler
CXX=$target_host-$cxx_compiler
STRIP=$target_host-strip
RC=$target_host-windres
[settings]
os_build=Windows
arch_build=x86_64
# We are cross-building to Windows
os=Windows
arch=x86_64
compiler=gcc
# Adjust to the gcc version of your MinGW package
compiler.version=8.1
compiler.libcxx=libstdc++11
build_type=Release
The MINGW64_PATH points to my MinGW installation folder.
When running conan install it complains about a missing package (obviously a dependency package of OpenSSL) that does not exist:
zlib/1.2.11#conan/stable: WARN: Can't find a 'zlib/1.2.11#conan/stable' package for the specified settings, options and dependencies:
- Settings: arch=x86_64, build_type=Release, compiler=gcc, compiler.version=8.1, os=Windows
- Options: minizip=False, shared=False
- Dependencies:
- Package ID: eb34f13b437ddfd63abb1f884c4b8886c48b74cd
ERROR: Missing prebuilt package for 'zlib/1.2.11#conan/stable'
Try to build it from sources with "--build zlib"
Or read "http://docs.conan.io/en/latest/faq/troubleshooting.html#error-missing-prebuilt-package"
Since I am a noob using Conan, I have no clue how I can fix this problem. What needs to be done to fix this issue, and also can I fix this on my own, or do I need help from the package author?
I found a description of the Missing prebuilt package error at https://docs.conan.io/en/latest/faq/troubleshooting.html#error-missing-prebuilt-package, but it does not help much.

so I added the OpenSSL/1.1.1a#conan/stable package to the requires
That package is obsolete, you can check it on Conan Community repository. You should try openssl/1.1.1a# instead, which is maintained by the new Conan Center Index.
conan install openssl/1.1.1d#
Where is the namespace? It has been removed, take a look on more information about recipes.
Since I am a noob using Conan, I have no clue how I can fix this problem. What needs to be done to fix this issue, and also can I fix this on my own, or do I need help from the package author?
As the FAQ recommends, you should build by yourself, running the command proposed by the error message:
conan install openssl/1.1.1a# --build zlib
But I'm sure it won't be enough, you will need to build OpenSSL too. So, the best approach in your situation is:
conan install openssl/1.1.1a# --build missing
Now, Conan will build from sources anything which is not pre-built on server side.
To summarize, this is not an error, like something is broken.
When you asked for OpenSSL 1.1.1a, Conan found the recipe on Conan Center, which explain how to build OpenSSL, however it didn't find your pre-built package, following your settings and options.
Well, MingW is not used in Conan Center Index, because there is no enough demand, all supported platforms and configurations are listed in the Wiki. But this specific recipe should support MingW, since when it was part of Conan Community, MingW was present in package lists for building.
I would say, you can use 1.1.1d instead, which newer and safer than 1.1.1a.

Related

C app deployment and managing dependencies in c

I'm new to c development, but I have some experience in other modern languages .so the first thing that I found hard is dependencies and deployment, while we got Gradle, maven, NuGet and pipy and... but in c I find it a bit difficult to manage this process.
for example, I have an app that should use mongo-c-library, log4c,libarchive so basically, in my development environment, I download and unzip all of the tar files of the above libraries and then followed their instruction(usually some make stuff) and installed them in order to include them in code make the code work.
I have studied a bit about CMake but I couldn't get a clear picture of how that could actually solve the problem.
at this moment my best solution is to create an install bash script and zip all dependencies unzipped folder with that install script and then send it to the production server to deploy it.
1.The first question is : is it possible to just copy and past all of .so .h and etc files in /path/of/installed/dependencies/include
and /path/of/installed/dependencies/lib in the destination server libary path.
2.if not what is the faster way?
while I was surfing the CMake source file I found that its developers just use this package source code directly.
cmxxx contains the xxx sources and headers files.
3.how can apt-get and Linux package manager help in the deployment process?
2 first question was more about dependencies. imagine we have a simple c app and we want to install(build and make a useable executable file) quickly. how it can be related to .deb packages.
1.The first question is : is it possible to just copy and past all of .so .h and etc files in /path/of/installed/dependencies/include and /path/of/installed/dependencies/lib in the destination server libary path.
Yes, technically it's possible. That's essentially what package managers do under the hood. However, doing that is a colossal mistake and screams bad practices. If that's what you want then in the very least you should look into package managers to build up your own installer, which handles this sort of stuff already for you.
2.if not what is the faster way?
You're actually asking an entirely different question, which is: how should I distribute my code, and how do I expect users to use/deploy it?
If you want users to access your source code and build it locally, as you've mentioned cmake then you just to set up your project right as cmake already supports that usecase.
If instead you just want to distribute binaries for a platform then you'll need to build and package that code. Again, cmake can also help you on that one, as cmake's cpack supports generating some types of packages like DEB packages used by Debian and Ubuntu, and which are handled by apt.
3.how can apt-get and Linux package manager help in the deployment process?
apt is designed to download and install packages from a repository.
Under the hood, apt uses DEB packages, which can be installed with dpkg.
If you're targeting a system that uses apt/deb, you can build DEB packages whenever you release a version to allow people to install their software.
You can also go a step beyond and release your DEB packages in a Personal Package Archive.
You would typically NOT download and install source packages. Instead you should generally rely on the libraries and development packages of the distribution. When building your own package you would typically just reference the packages or files that your package is dependent on. Then you build your own package and you're done. Upon installation of your package, all dependencies will automatically be resolved in an appropriate order.
What exactly needs to be done is dependent on the package management system, but generally the above statements apply. Be advised, package management apparently is pretty hard, because so many 3rd party developers screw it up.

Building Anjay tutorial codes

I'm getting some difficulties on building the tutorial codes of Anjay https://github.com/AVSystem/Anjay. the doc wasn't really helpful.
I tried a simple :
cd examples/tutorial/custom-object
cmake . && make
but I'm getting this message :
By not providing "Findanjay.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "anjay", but
CMake did not find one.
Could not find a package configuration file provided by "anjay" with any of
the following names:
anjayConfig.cmake
anjay-config.cmake
Add the installation prefix of "anjay" to CMAKE_PREFIX_PATH or set
"anjay_DIR" to a directory containing one of the above files. If "anjay"
provides a separate development package or SDK, be sure it has been
installed.
CMake Warning (dev) in CMakeLists.txt:
No cmake_minimum_required command is present. A line of code such as
cmake_minimum_required(VERSION 3.10)
should be added at the top of the file. The version specified may be lower
if you wish to support older CMake versions for this project. For more
information run "cmake --help-policy CMP0000".
This warning is for project developers. Use -Wno-dev to suppress it.
I would appreciate any suggetions.
Thank you.
I was doing the same thing. The error is because you have not installed anjay libraries on your local system or provide a way for CMake to find it.
I installed it by following steps mentioned in compilation docs
In the root of Anjay directory execute the following:
cmake . && make && sudo make install

Why do I get "Header file missing" (make error)?

I'm trying to install a geocoder for a website I'm building. I'm using Geocoder because the query limit for the Google Maps API falls short of my needs. I installed all the gems required and have SQLite3. When I'm actually trying to install the geocoder gem (Geocoder::US) I get an error while running the make file.
I'm getting an error I cannot figure out. It mentions the error (in the title) then talks of an non-existent file (sqlite3ext.h). Here is the error:
I know this is vague but I've been working for 10+ hours trying to install this and have found little help online. Any advice on which direction to go would be appreciated.
This is from the project's Readme:
To build Geocoder::US, you will need gcc/g++, make, bash or equivalent,
the standard *NIX ‘unzip’ utility, and the SQLite 3 executable and
development files installed on your system.
It seems that you lack the SQLite3 development headers.
This is relevant:
NOTE: If you do not have /usr/include/sqlite3ext.h installed, then
your sqlite3 binaries are probably not configured to support dynamic
extension loading. If not, you must compile and install SQLite from
source, or rebuild your system packages. This is not believed to be a
problem on Debian/Ubuntu, but is known to be a problem with Red
Hat/CentOS.
Also they do not mention Windows. You should:
Ask them if someone uses it on Windows and if there are instructions for that.
Evaluate the thing on Linux, Debian/Ubuntu especially.
-fPiC is not your problem. As the log states, the compiled code is already position independent. The problem is, that the sqllite3ext.h is not in the compiler include path.

(Mac OSX) Adding libraries to C -specifically gnuplot

I am a begineer trying to get code in C. I am working on a Mac and using xcode. My only past experience has been with java using eclipse and everything was pretty straight forward. I have almost no experience with terminal.
I am required to learn a bit of C for a project I will be working on and the learning of syntax is coming along okay, but I am at a point where I need to include some libraries in my c program. Specifically I am attempting to make plots with gnuplots.
I have downloaded gnuplot-4.6.3 from their repository and I do not even know how to install the files. I have been looking around and have tried using terminal to use the ./configure command when I am in the gnuplot-4.6.3 directory. But I really don't know what I am doing so I don't even know where to go next or what to do next.
Sorry if this is so trivial, I honestly just have never done this before and I cannot find a good tutorial on what to do.
Thanks for any help you can offer.
I would recommend using MacPorts for installing third-party tools and libraries. It knows the dependencies required and will install them as part of the installation.
Download it from macports.org.
Install it, and allow it to modify your ~/.profile so that /opt/local/bin is in your $PATH (any issue then just do export PATH=/opt/local/bin:$PATH from the command line).
sudo port selfupdate
sudo port install gnuplot
Now that will install the library into /opt/local/lib with the include files in /opt/local/include, so now just add that library to your Xcode project. Select the target and in the Build Phases tab open up the Link Binary With Libraries and press the + button and select Add Other. Now find /opt/local/lib/libgnuplot.a (I am assuming that's what it's called; I don't have it installed my self):
Now add /opt/local/include to your Header Search Paths so the compiler can find the gnuplot header files. Select the target and in Build Setting type in "header search" in the search box. Now double-click on the Header Search Path in the target column (or the project column to the right) and add /opt/local/include:
It's fine! You're learning then! Keep up! When I hit this kind of problem you may want to learn about the basis for linux gcc/g++ compilation and linking processes. Then you should learn Cmake and Automake, which are basically packages to configure projects before compiling building.
A typical (good) project in Unix systems build with commands
./configure
make
sudo make install
or
cmake CMakelists.txt
make all
sudo make install
That's what you need to do after downloading a source tarball online to install unix programs.
Now since you are using Mac, there are so-called package installers, one which is macports and homebrew. I personally suggest homebrew than macports here (I've tried both, although macports still outnumber homebrew with the number of repos, homebrew has the newest support, especially when upgrading to a new OS). So to install homebrew you can do
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Execute that in your terminal (see http://brew.sh/) for more information.
Then you could simply install GNUplot by
brew install gnuplot

Eclipse: Cannot install CDT because of a conflicting dependency

my eclipse has been configured for Java and pydev, now i want to configure C/C++ development tools with Eclipse. i dont want to download the whole Eclipse IDE for C/C++ Developers, for it is not convenient. so i decided to install CDT in my Eclipse.
Help ==> Install New Software, then input http://download.eclipse.org/tools/cdt/releases/indigo, waited for a while, and chose the following CDT Main Features, CDT Optional Features, and Next, then an error occurred.
Cannot complete the install because of a conflicting dependency.
Software being installed: C/C++ DSF GDB Debugger Integration 4.0.0.201106081058 (org.eclipse.cdt.gnu.dsf.feature.group 4.0.0.201106081058)
Software being installed: C/C++ Development Tools SDK 8.0.2.201202111925 (org.eclipse.cdt.sdk.feature.group 8.0.2.201202111925)
Only one of the following can be installed at once:
GDB DSF Debugger Integration Core 4.0.0.201106081058 (org.eclipse.cdt.dsf.gdb 4.0.0.201106081058)
GDB DSF Debugger Integration Core 4.0.2.201202111925 (org.eclipse.cdt.dsf.gdb 4.0.2.201202111925)
GDB DSF Debugger Integration Core 4.0.1.201109151620 (org.eclipse.cdt.dsf.gdb 4.0.1.201109151620)
Cannot satisfy dependency:
From: C/C++ Development Tools 8.0.2.201202111925 (org.eclipse.cdt.feature.group 8.0.2.201202111925)
To: org.eclipse.cdt.gnu.dsf.feature.group [4.0.1.201202111925]
Cannot satisfy dependency:
From: C/C++ DSF GDB Debugger Integration 4.0.0.201106081058 (org.eclipse.cdt.gnu.dsf.feature.group 4.0.0.201106081058)
To: org.eclipse.cdt.dsf.gdb [4.0.0.201106081058]
Cannot satisfy dependency:
From: C/C++ DSF GDB Debugger Integration 4.0.1.201202111925 (org.eclipse.cdt.gnu.dsf.feature.group 4.0.1.201202111925)
To: org.eclipse.cdt.dsf.gdb [4.0.2.201202111925]
Cannot satisfy dependency:
From: C/C++ Development Tools SDK 8.0.2.201202111925 (org.eclipse.cdt.sdk.feature.group 8.0.2.201202111925)
To: org.eclipse.cdt.feature.group [8.0.2.201202111925]
i have googled for a lot of time, but still cannot find a valid solution. can anyone give a hand to me? thanks a lot!
I faced with this problem, too. I just download the c/c++ mode of eclipse which already includes CDT. It works. If you couldn't fix it, you can try this way. It is better than nothing.
Normally if I see this many errors, it's because I have picked the wrong update site... maybe a silly question, but do you actually have the Eclipse Indigo base version installed? You can check with Help->About Eclipse, second line down.
That answer referring to Help->About was a HUGE help. Once there I clicked on the Installation Details button, checked everything CDT/C++ related and clicked Uninstall. Once Eclipse restarted, I was able to install CDT without any problems whatsoever.
TH
this looks very similar to a problem I had. In my case it was that some of the packages in the Optional Extras are already implicitly included in the CDT (such as the GDB DSF packages) and so there are conflicts when you try to install both packages.
If you highlight each package you want in the optional extras it will say in the short comment line describing the package weather or not a version of that package is included by default in the CDT, if it is deselect. Hope this is helpful.
This may be a little late, but try installing the base CDT package by itself first. Restart Eclipse and then install the CDT Optional Features, this time ticking the "Hide items that are already installed" checkbox. This solved the issue for me.
I had a similar dilemma as you did. In my case, I downloaded CDT Main Features first and had all the boxes checked in the window. Especially the box that said, "Contact all update sites during install to find required software." Afterwards, I installed "CDT Optional Features" with all the boxes checked as well.
I'm running Kepler Service Release 1 on Windows 8.1, 64-bit.
I encountered this exact behaviour when I tried installing CDT by using these options:
Do not select both C/C++ Development Tools and C/C++ Development Tools SDK. This will result in the CDT help files being available, but the C/C++ perspective and C/C++ project type being unavailable, due to probably a package collision (although strangely, nothing was showing up in my workspace .log file).
The correct configuration is to select just the C/C++ Development Tools, unless of course you want to contribute to CDT, in which case you'd select the C/C++ Development Tools SDK. Most users will be content with just the development tools. The following selection worked for me.
Now i use ubuntu, and using the command sudo apt-get install eclipse-cdt directly solves the problem. It's a little strange that why there is a conflict when installs CDT using eclipse'sInstall New Software.

Resources