Trying out Kemal in a VM, fresh install of Arch-Linux with gc, openssl, crystal, and shard packages. Ran through steps on Kemal guide for simple web app, but errors upon crystal run src/test_app.cr:
_main.o: In function '__crystal_main':
/usr/lib/crystal/openssl/lib_ssl.cr:213: undefined reference to 'SSL_Library_init'
...followed by a lot of similar error messages, undefined references etc.
Am I missing a dependency?
Install the base-devel package group using pacman -S base-devel.
On Arch Linux, Crystal is a compiler package so it assumes you have base-devel installed. Without the pkg-config package, Crystal can't find out which version of OpenSSL you have installed and can't link to it.
Related
I have a c++ code that is written and compile on my PC and executed on a remote server.
I changed recently my pc ans so set up everything uptodate on it. But now execution of my code on the unchanged server failed with this error:
./ReactionThermo: relocation error: ./ReactionThermo: symbol _ZTINSt8ios_base7failureB5cxx11E, version GLIBCXX_3.4.21 not defined in file libstdc++.so.6 with link time reference
I look a bit on the web and it appears to be gcc fault. And indeed it's on my pc 5.4 and 4.8 on my server. I tried to upgrade it but got following error:
sudo apt-get install gcc-4.9
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
gcc-4.9 : Depends: cpp-4.9 (= 4.9.4-2ubuntu1~14.04.1) but it is not going to be installed
Depends: libgcc-4.9-dev (= 4.9.4-2ubuntu1~14.04.1) but it is not going to be installed
munge : Depends: libmunge2 (= 0.5.11-1ubuntu1) but 0.5.11-1ubuntu1.1 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
I tried the apt-get -f install comand but it's not improving thinks.
Any ideas.
Thanks
PS: I knoz it's look like GLIBCXX_3.4.21 not defined in file libstdc++.so.6 with link time reference but I don't want tu downgrade cpp, rather to upgrade it
In general, you need to build C/C++ binaries on the oldest operating system version you want to support, using the system compiler (or other vendor-supported compilers such as the Toolchain Module for SUSE Linux Enterprise Server or Developer Toolset for Red Hat Enterprise Linux). You cannot compile your program on a newer system and copy it to a different environment with an older (or different) operating system release. In simple cases, it might work, but in other cases, you will get dynamic linker failures at run time (like you did), or even silent data corruption.
Furthermore, you should look at build tools such as pbuilder and mock to automate building your software in a well-defined build environment.
I am having trouble compiling my program which uses libcurl.
The environment I am using is CentOS 6.6 on a VM, and I am getting errors which suggests that the library has either:
not installed correctly or
cannot be found.
I did a
sudo yum install libcurl followed by a
sudo yum install libcurl-devel followed by a
sudo yum update
It seems that the curl.h has been put under /usr/include/curl which seems correct so I am unsure as to why this has occurred.
It is worth noting that a test program with #include <curl/curl.h> is compiling.
Also, when libcurl-devel is not installed (and only libcurl is),
gcc complained it couldn't find curl.h, as expected,
there was also no curl directory under /usr/include/, as expected,
however libcurl did install a curl file under /usr/bin/, as expected.
In Ubuntu I only had to install libcurl-openssl
Some example gcc errors:
$gcc new.c -lcurl
new.c: In function ‘main’:
new.c:74: error: ‘CURLOPT_MAIL_FROM’ undeclared (first use in this function)
new.c:74: error: (Each undeclared identifier is reported only once
new.c:74: error: for each function it appears in.)
new.c:81: error: ‘CURLOPT_MAIL_RCPT’ undeclared (first use in this function)
If you are installing libcurl-devel from the CentOS RPM then it absolutely should not be putting the header, or anything else, in /usr/local/curl. /usr/local is for locally-built components, not for components provided by the OS. Exactly what that means can be a subject for debate, but I can confirm that the CentOS 6 RPM for libcurl-devel installs the headers in /usr/include/curl.
With that being the case, if CentOS's libcurl-devel is installed, then you shouldn't need any special compiler flags to get the compiler to resolve
#include <curl/curl.h>
correctly, but if you happen to have a different curl.h somewhere on your system then you could cause it to be chosen instead. Still, although I could maybe believe the compiler finding /usr/local/include/curl/curl.h automatically (that is, without -I/usr/local/include), I would be very surprised to hear that it finds /usr/local/curl/curl.h automatically.
But that probably isn't your problem. CentOS 6 provides version 7.19 of libcurl. That version does not provide the macros you are trying to use, at least not in libcurl-devel. I have checked for a possible add-on package corresponding to Ubuntu's libcurl-openssl, but there is no CentOS 6 package (or EPEL/el6 package) that has both "curl" and "ssl" in its name.
If you can identify what minimum version of libcurl you need, you can probably build it yourself. In such cases I prefer to take a source RPM from Fedora's Koji system, build RPMs from it on the local system, and install them (possibly updating existing RPMs in the process). Alternatively, you can probably build and use a private copy, but in that case you will want to link it statically into your program.
I downloaded the sfml GCC - 32-bit version for linux; though my operating system is ubuntu. I am able to compile a test program, but when I try to link the libraries I get an error:
dylan#Aspire-one:~/Documents/SFML-2.3.1/projects$ g++ test.o -o sfml-app -L/home/dylan/Documents/SFML-2.3.1/lib -lsfml-graphics -lsfml-window -lsfml-system
/home/dylan/Documents/SFML-2.3.1/lib/libsfml-graphics.so: undefined reference to `std::__throw_out_of_range_fmt(char const*, ...)#GLIBCXX_3.4.20'
collect2: error: ld returned 1 exit status
If you have any clues please comment below, but I would appreciate a full answer.
Expanding on my earlier comment: It looks like you have SFML binaries that are linked to a version of glibc that isn't on your system. You need to either install that version of glibc (3.4.20, 32 bit) or get/build SFML binaries that link to a version of glibc that you do have.
The Linux world is different from the Windows and the Mac worlds. And the right way to do things has changed over the years. And my personal willingness to experiment has changed as well.
You generally want to get binaries from the distribution you use. Ubuntu in your case, Fedora in mine. This allows the package manager (e.g., yum or apt-get) to do its job: determine if you have the needed prerequisites when installing new software, uninstall software as desired, install updates with minimal fuss, etc. If you can't get the binaries you want, at least try to find a repository that you can tell your package manager to trust, so that you can get regular updates.
If you aren't able to find an acceptable package that way, your only option is to build from source. Download the latest source code archive from http://www.sfml-dev.org/download.php (get a release with a version number, instead of "whatever's currently in GitHub"). It looks like SFML currently uses CMake, so you'll want to follow the directions on http://www.sfml-dev.org/tutorials/2.3/compile-with-cmake.php to build.
Personally, I wouldn't run the final make install step. That will copy the binaries to /usr/local or some similar place, but won't notify your package manager about the change. And there won't be a way to uninstall aside from manually deleting the files. Instead, just add the folder you build in to your PATH (and the include folder to your INCLUDE_PATH). You'll be able to develop your application with that setup, and nothing will prevent you from installing the package when somebody finally creates it for your distribution.
I am using Code:blocks under Ubuntu 12.04 LTS. I am attempting to compile my first program using FLTK and I get the following errors.
Linking console executable: bin/Debug/<project name removed for security reasons>
/usr/bin/ld: cannot find -lXft
/usr/bin/ld: cannot find -lfontconfig
/usr/bin/ld: cannot find -lfontconfig
/usr/bin/ld: cannot find -lXinerama
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
4 errors, 0 warnings
Is there something else I need to install, or a path I need to add?
To build an FLTK project in Code::Blocks 16.01 on UBUNTU 16.04.
Install FLTK and two additional packages:
$ sudo apt install fltk1.3-dev
$ sudo apt install libxft-dev
$ sudo apt install libxinerama-dev
After this, you can define an FLTK project, and build it without problems.
If you do not install the libxft-dev and libXinerama-dev packages, you will indeed get these error messages listed in question about missing libraries (-lXft, -lfontconfig, -lXinerama).
The reason these packages are not installed automatically with fltk1.3-dev is because they're only 'suggested', and not a hard dependency. This can be seen here:
package: libfltk1.3-dev
However, the 'fltk-config' flag which is used by Code:Blocks to decide what libraries to link in requires them.
For more detail on the fltk-config flag, see:
Beginners Guide to fltk-config
For completeness, here the links to the 2 additional packages:
package: libxft-dev
package: libxinerama-dev
The dev version of libraries used by FLTK might be missing http://packages.ubuntu.com/precise/libfltk1.3 .
You can use apt-get to install them : libxft-dev, libfontconfig1-dev and libxinerama-dev.
You obviously do not have libXft, libfontconfig and libXinerama installed on your machine. If you installed FLTK using Ubuntu package manager, then you should report missing dependency information in the FLTK package.
Typically we do this by finding out who is the package maintainer, and send e-mail to that person.
I managed to get code:blocks 13.12 working with FTLK on Raspberry Pi using Raspian. CodeBlocks gave me those same errors "cannot find -lXft" "cannot find -lfontconfig" and "cannot find -lXinerama".
I used the add/remove software provided with Raspian and searched for each of the following libraries libxft-dev, libfontconfig1-dev and libxinerama-dev and then I installed them using the package manager. When I restarted codeblocks FLTK worked fine!
I am building a C++ application that embeds the Lua scripting engine. I am developing on Linux (Ubuntu).
I have already installed Lua on my dev machine (by imstalling the lua5.1 package). I can run the Lua intepreter succesfully (via the cmd line).
However, when building, I get the following link error:
/usr/bin/ld: cannot find -llua5.1
I have searched the Ubuntu forums/package repositories etc but I cannot seem to find the required package. Can anyone help?
PS: I also need to install the development files for tolua++ (I'm not sure which Ubuntu package is the required one either).
I am on Ubuntu 10.0.4
Install the liblua5.1-dev package, and if that does not work compile Lua from sources.
Or you can try -llua instead of -llua5.1.
on Fedora 17 problem fixed:
sudo ln /usr/lib/liblua-5.1.so /usr/lib/liblua5.1.so
For tolua++, it looks like libtolua++5.1-dev is the package you want.