Issue Statically Compiling Thrift 0.9.0 on Centos 6.5 - static

I'm working to compile the Thrift 0.9.0 binary statically in a CentOS VM. I get the issue that the libthrift.a binary is not being created. I am using a vagrant box to run centos:
https://github.com/2creatives/vagrant-centos/releases/download/v6.5.1/centos65-x86_64-20131205.box
Once I ssh to the vagrant box I run the following commands:
wget https://archive.apache.org/dist/thrift/0.9.0/thrift-0.9.0.tar.gz
tar -zxvf thrift-0.9.0.tar.gz
cd thrift-0.9.0
./configure --enable-static
make
This will run but I ran a find command (sudo find / -name "*.a") on the system to see if there was any ".a" files made and the only file that was made was "libparse.a" which doesn't seem right. From my understanding it should be "libthrift.a".
Searching through the config.log file it says that it does want to build the static libraries:
configure:11944: checking whether to build static libraries
configure:11948: result: yes
Looking at more locations in the log file that has the keyword "static" reveals potential places that may be errors.
configure:9028: checking if gcc static flag -static works
configure:9056: result: no
configure:13915: checking if g++ static flag -static works
configure:13943: result: no
lt_cv_prog_compiler_static_works=no
lt_cv_prog_compiler_static_works_CXX=no
The full log file is here: http://www.filehosting.org/file/details/449460/staticThriftErrorLog.rtf
Any help is appreciated

I was able to generate the libthrift.a file. After running the command for the extra dependancies mentioned in my comment I forgot to run the make command. So after doing the make command I found the libthrift.a file in "thrift-0.9.0/lib/cpp/.libs/". Interestingly enough, even after fixing the dependencies, config.log still had the same potential problem areas regarding the gcc/g++ static flag and static compiler.
Specifically the dependency command is as follows:
sudo yum install automake libtool flex bison pkgconfig gcc-c++ boost-devel libevent-devel zlib-devel python-devel ruby-devel openssl-devel.x86_64
Edit: After getting advice on the Jira ticket, it turns out the specific vagrant box I was using was causing the errors. Using the VM he linked I was able to successfully build Thrift using the provided instructions. (Jira ticket https://issues.apache.org/jira/browse/THRIFT-2559)

Related

Why can my C program run in "git bash", but not in "cmd"?

I wrote a demo using libpq to connect to a PostgreSQL database.
I tried to connect the C file to PostgreSQL by including
#include <libpq-fe.h>
after I added the paths into system variables I:\Program Files\PostgreSQL\12\lib as well as to I:\Program Files\PostgreSQL\12\include and compiled with this command:
gcc -Wall -Wextra -m64 -I "I:\Program Files\PostgreSQL\12\include" -L "I:\Program Files\PostgreSQL\12\lib" testpsql.c -lpq -o testpsql
It first raised three errors, like
libssl-1_1-x64.dll is missing
libintl-8.dll was missing
libcrypto-1_1-x64.dll was missing
After I downloaded these three files and put them into I:\Program Files\PostgreSQL\12\lib, and compiled it again, it shows the error
The application was unable to start correctly (0xc0150002)
when I type testpsql. But if I type ./testpsql on git bash, it works. Anyone can please tell me why?
The code that I used was the first example from here.
Environment: PostgreSQL 12, Windows 10, MinGW64
“Download the DLL files” sounds dangerous. From where?
I would get rid of these files again. Since you probably don't reference these libraries from your code, it must be the dependencies of libpq.dll and are probably found in I:\Program Files\PostgreSQL\12\bin (if you used the EDB installer).
The problem is probably that you the PATH environment variable is different in git bash and in cmd.exe, and in the latter case not all required shared libraries can be found on the PATH. The solution is to change the PATH so that it includes all DLL files the executable requires, not to start copying around files.
It is probably enough to include I:\Program Files\PostgreSQL\12\bin in the PATH. To resolve missing dependencies, use a tool like dependency walker or this replacement.

FFmpeg: building example C codes

I have configured and compiled the FFmpeg library using this link:
https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu
Now, I am trying to build example C codes provided by FFmpeg from here:
https://github.com/FFmpeg/FFmpeg/tree/master/doc/examples
However, when I run make install-examples or make install (suggested by /example/README), I receive this kind of message:
make: *** No rule to make target '/doc/examples/README', needed by
'install-examples'. Stop.
I thought this may be due to the rules not being in the correct MakeFile format (I am not sure why they refers to README). How should I go about in fixing this and compiling the example codes? I have tried to find solutions about this, but there doesn't seem to be much information online.
Thank you.
Run ./configure && make -j4 examples in the FFmpeg source directory, then look in doc/examples for the compiled examples.
Requires make and pkg-config.
To remove the compiled examples use make examplesclean in the FFmpeg source directory.
nasm/yasm not found or too old. Use --disable-x86asm for a crippled build. If you think to configure made a mistake, make sure you are using the latest version from Git. If the latest version fails, report the problem to theffmpeg-user#ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.Include the log file "ffbuild/config.log" produced by configure as this will help solve the problem.
If you see this when you execute the above command then do this
macOS:
brew install yasm
Ubuntu:
sudo apt-get install yasm

How to handle problems with RPATH on Mac OS X while installing cmocka?

I am trying to install and run cmocka library for unit testing on Mac OSX Yosemite 10.10.3, but I've got some problems with the RPATH settings.
Update:
Thanks to #baf, I was able to include cmocka.h in my CMakeLists.txt manually like this:
set(CMAKE_C_FLAGS_DEBUG "-I/usr/local/include/cmocka.h")
However, why is it so that I have to do it manually?
I've already tried many different ways of installing it:
What I've done so far:
Download cmocka from here: here. Version 1.0.
tar xvf cmocka-1.0.1.tar.xz
cd cmocka-1.0.1, mkdir build and cd build
sudo cmake ..
I get a message like this here:
-- Configuring done
CMake Warning (dev):
Policy CMP0042 is not set: MACOSX_RPATH is enabled by default. Run "cmake --help-policy CMP0042" for policy details. Use the cmake_policy command to set the policy and suppress this warning.
MACOSX_RPATH is not specified for the following targets:
cmocka_shared
This warning is for project developers. Use -Wno-dev to suppress it.
Question #1: How can I set the rpath so that there is no warning like the one above?
sudo make
sudo make install
cmocka should be installed now, right?
Running cmake for my program which is using cmocka library.
So now I run cmake for my program and my main CMakeList.txt file has lines like this:
find_library (CMOCKA cmocka)
if (NOT CMOCKA)
message (WARNING "Cmocka library not found.")
endif (NOT CMOCKA)
But the warning doesn't show up during this phase, so I believe that find_libarary(CMOCKA cmocka) has successfully located cmocka on my computer.
Running make for my program.
While running make I get an error like this:
fatal error:<br>
'cmocka.h' file not found<br>
#include <cmocka.h>
^
1 error generated.
So I guess that cmocka cannot be found...
Question #2: Why cmocka library cannot be found?
Additional notes:
I've tried running
$ export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
but it didn't helped. I guess it is a solution for Linux, not Mac.
I've tried to learn something about RAPTH on Mac in cmake from their official documentation here: http://www.cmake.org/Wiki/CMake_RPATH_handling. However I understood very little and I wasn't able to come up with a solution for my problem.
I've tried installing cmocka using brew but I got the same result.
Moreover, I've read many questions at SO about RPATH, linking and cmocka, but I couldn't find a suitable solution as well. Nevertheless, here is the list of related threads:
How to set the runtime path (-rpath) of an executable with gcc under Mac OSX?
https://stackoverflow.com/questions/29721183/getting-undefined-symbols-for-architecture-x86-64-when-trying-to-build-on-osx
How to configure scons to link using rpath on mac?
mariadb install failure: make (Mac OSX 10.6.8)
I've run otool -L cmocka. Here's what I got:
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/otool: can't open file: cmocka (No such file or directory)
I was able to successfully compile my program (thanks to baf) when I added the -I/usr/local/include flag to my debug flags:
set(CMAKE_C_FLAGS_DEBUG "-std=gnu99 -Wall -pedantic -g -I/usr/local/include/cmocka.h")

Building/Linking libgcrypt for Mingw

I'd like to implement some features of libgcrypt in my program, but it is currently running on Windows, OSX, and Linux (Arch/Xubuntu), so I can only really do so if I can build it for all three platforms. On OSX and Linux I had no problem.
I got the sources from the github page for libgcrypt and libgpg-error, and I've successfully built and run the libraries on both Linux and OSX, so I know that my test code is valid (which I am now having trouble with on Windows w/MinGW).
I did the following on Xubuntu (and similar on Arch but using pacman instead of apt-get):
sudo apt-get install mingw32 mingw32-runtime mingw32-binutils
to get the cross compiling tool chain and
git clone https://github.com/Chronic-Dev/libgcrypt.git
git clone https://github.com/Chronic-Dev/libgpg-error.git
cd libgpg-error
autoreconf -vfi
./autogen.sh --build-w32
make
sudo make install
cd ../libgcrypt
autoreconf -vfi
./autogen.sh --build-w32
make
sudo make install
to build, and it successfully builds these files in home/myuser/w32root/:
libgcrypt.a
libgcrypt.def
libgcrypt.dll.a
libgcrypt.la
libgpg-error.dll.a
libgpg-error.la
include/
gcrypt.h
gcrypt-module.h
gpg-error.h
I took these files over to windows, and tried compiling the test code (named main.c locally) with
gcc main.c -o main.exe -lgcrypt
but I get undefined reference errors leading me to the conclusion that the library wasn't linked correctly (initially only using libgcrypt.a), so I looked some stuff up, and found that some libraries require a set of files like .a, .def, et al. to work, so I dropped them all in C:\Mingw\lib to see if it made a difference; it didn't. The following was also silent in finding the library file to link, but didn't resolve the undefined references:
gcc main.c -o main.exe -lgcrypt -lgpg-error
So I'm not really sure where to go from here. The readme doesn't get into cross compiling too much, like what files to copy and link once you're on the Windows side. Any pointers (to docs for it I missed maybe?) are appreciated! Thanks a bunch for reading my wall of text.

Apache 2.4.1 undefined reference to `SSLv2_client_method'

I was previously running apache 2.2.20 and openssl 1.0.0e. I installed openssl 1.0.1, then downloaded the tarball for apache 2.4.1 and installed apr 1.4.6 & apr-util 1.4.1 with --prefix=/usr/local. I configured apache2 with:
sudo ./configure --prefix=/usr/local/apache2 --enable-mods-shared=all
--enable-deflate --enable-proxy --enable-proxy-balancer --enable-proxy-http
--enable-rewrite --enable-cache --enable-mem-cache --enable-ssl --enable-headers
--with-mpm=worker --with-included-apr
But after running sudo make I get an error:
httpd-2.4.1/support/ab.c:2227: undefined reference to `SSLv2_client_method'
What is causing this error and how do I correct it?
You may have built openssl with SSLv2 disabled, some distributions have that disabled (Debian, starting from 7.0 -Wheezy- is one). Looking at the source, it looks like if you define the OPENSSL_NO_SSL2 preprocessor flag, apache won't call the SSLv2_client_method() function.
You can also download openssl's tarbal and compile openssl with
./config shared no-ssl2
This will set the flag OPENSSL_NO_SSL2 that Jon Lin mentioned.
It has nothing to do with OpenSSL compilation. PHP is the culprit which is causing the error.
(Note: The is another issue with OpenSSL which might prevent u from generating openssl.so and opencrypto.so shared libraries)
Here is the overview of how it happened. PHP compiles its compilation and when "make install" is given it copies the libphp*.so to /usr/local/apache2/modules.
The source code for this error is openssl.c in /usr/local/php-5.5.3/ext/openssl
So the simple solution is to handle it in the top level Makefile. By adding
CPPFLAGS = -D_REENTRANT -DTHREAD=1 -DOPENSSL_NO_SSL2
Make the above change AFTER you run the configure script. Hope this helps :)
Try with another Apache version. With Apache 2.2.15 the error was present but when i change to Apache 2.2.27 the "reference to `SSLv2_client_method" error simply disappeared
The compilation line is:
./configure --with-ssl --enable-ssl
That's all.

Resources