Trouble installing DBD::mysql under macOS Catalina 10.15.1 - mysql

Can't install DBD::mysql under macOS Catalina 10.15.1. Mysql 8.0.18 and openssl 1.0.2t are installed through brew.
Here is the module installation log:
cpan[1]> install DBD::mysql
..........
I will use the following settings for compiling and testing:
cflags (mysql_config) = -I/usr/local/Cellar/mysql/8.0.18_1/include/mysql
embedded (guessed ) =
ldflags (guessed ) =
libs (mysql_config) = -L/usr/local/Cellar/mysql/8.0.18_1/lib -L/usr/local/opt/openssl/lib -lmysqlclient -lssl -lcrypto
mysql_config (guessed ) = mysql_config
nocatchstderr (default ) = 0
nofoundrows (default ) = 0
nossl (default ) = 0
testdb (default ) = test
testhost (default ) =
testpassword (default ) =
testport (default ) =
testsocket (default ) =
testuser (guessed ) = dmitry
To change these settings, see 'perl Makefile.PL --help' and
'perldoc DBD::mysql::INSTALL'.
Checking if libs are available for compiling...
Looks good.
Checking if your kit is complete...
Looks good
Using DBI 1.631 (for perl 5.018004 on darwin-thread-multi-2level) installed in /System/Library/Perl/Extras/5.18/darwin-thread-multi-2level/auto/DBI/
Writing Makefile for DBD::mysql
Wide character in print at /System/Library/Perl/5.18/ExtUtils/MakeMaker.pm line 1034.
Wide character in print at /System/Library/Perl/5.18/ExtUtils/MakeMaker.pm line 1034.
Writing MYMETA.yml and MYMETA.json
cp lib/DBD/mysql/GetInfo.pm blib/lib/DBD/mysql/GetInfo.pm
cp lib/Bundle/DBD/mysql.pm blib/lib/Bundle/DBD/mysql.pm
cp lib/DBD/mysql/INSTALL.pod blib/lib/DBD/mysql/INSTALL.pod
cp lib/DBD/mysql.pm blib/lib/DBD/mysql.pm
cc -c -I/System/Library/Perl/Extras/5.18/darwin-thread-multi-2level/auto/DBI -I/usr/local/Cellar/mysql/8.0.18_1/include/mysql -DDBD_MYSQL_WITH_SSL -g -g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -fstack-protector -Os -DVERSION=\"4.050\" -DXS_VERSION=\"4.050\" -iwithsysroot "/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE" dbdimp.c
In file included from dbdimp.c:15:
./dbdimp.h:20:10: fatal error: 'DBIXS.h' file not found
#include <DBIXS.h> /* installed by the DBI module */
^~~~~~~~~
1 error generated.
make: *** [dbdimp.o] Error 1
DVEEDEN/DBD-mysql-4.050.tar.gz
/usr/bin/make -- NOT OK
Running make test
Can't test without successful make
Running make install
Make had returned bad status, install seems impossible
Failed during this command:
DVEEDEN/DBD-mysql-4.050.tar.gz : make NO
cpan[2]>
It seems the compiler could not find the DBIXS.h file. find found this file in the system:
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Perl/Extras/5.18/darwin-thread-multi-2level/auto/DBI/DBIXS.h
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Perl/Extras/5.18/darwin-thread-multi-2level/auto/DBI/DBIXS.h
/System/Volumes/Data/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Perl/Extras/5.18/darwin-thread-multi-2level/auto/DBI/DBIXS.h
/System/Volumes/Data/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Perl/Extras/5.18/darwin-thread-multi-2level/auto/DBI/DBIXS.h
/System/Volumes/Data/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Perl/Extras/5.18/darwin-thread-multi-2level/auto/DBI/DBIXS.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Perl/Extras/5.18/darwin-thread-multi-2level/auto/DBI/DBIXS.h
How to include this header file during compilation?
UPDATE
My searches led me to build the package using the standard path where there are no header files
/System/Library/Perl/5.18/darwin-thread-multi-2level
And you must use the path
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Perl/5.18/darwin-thread-multi-2level
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Perl/5.18/darwin-thread-multi-2level
But here's how to specify it? I encountered the same problem when installing Mac::SystemDirectory
/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE/EXTERN.h -
file not found
Perl information:
perl -V
Summary of my perl5 (revision 5 version 18 subversion 4) configuration:
Platform:
osname=darwin, osvers=19.0, archname=darwin-thread-multi-2level
uname='darwin osx391.sd.apple.com 19.0 darwin kernel version 18.0.0: tue jul 9 11:12:08 pdt 2019; root:xnu-4903.201.2.100.7~1release_x86_64 x86_64 '
config_args='-ds -e -Dprefix=/usr -Dccflags=-g -pipe -Dldflags= -Dman3ext=3pm -Duseithreads -Duseshrplib -Dinc_version_list=none -Dcc=cc'
hint=recommended, useposix=true, d_sigaction=define
useithreads=define, usemultiplicity=define
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=define, use64bitall=define, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags =' -g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -fstack-protector',
optimize='-Os',
cppflags='-g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -fstack-protector'
ccversion='', gccversion='4.2.1 Compatible Apple LLVM 11.0.0 (clang-1100.0.32.4) (-macos10.15-objc-selector-opts)', gccosandvers=''
intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='cc', ldflags =' -fstack-protector'
libpth=/usr/lib /usr/local/lib
libs=
perllibs=
libc=, so=dylib, useshrplib=true, libperl=libperl.dylib
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup -fstack-protector'
Characteristics of this binary (from libperl):
Compile-time options: HAS_TIMES MULTIPLICITY PERLIO_LAYERS
PERL_DONT_CREATE_GVSV
PERL_HASH_FUNC_ONE_AT_A_TIME_HARD
PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP
PERL_PRESERVE_IVUV PERL_SAWAMPERSAND USE_64_BIT_ALL
USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES
USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE
USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF
USE_REENTRANT_API
Locally applied patches:
/Library/Perl/Updates/<version> comes before system perl directories
installprivlib and installarchlib points to the Updates directory
Built under darwin
Compiled at Aug 23 2019 16:44:31
#INC:
/Library/Perl/5.18/darwin-thread-multi-2level
/Library/Perl/5.18
/Network/Library/Perl/5.18/darwin-thread-multi-2level
/Network/Library/Perl/5.18
/Library/Perl/Updates/5.18.4/darwin-thread-multi-2level
/Library/Perl/Updates/5.18.4
/System/Library/Perl/5.18/darwin-thread-multi-2level
/System/Library/Perl/5.18
/System/Library/Perl/Extras/5.18/darwin-thread-multi-2level
/System/Library/Perl/Extras/5.18
.

The missing EXTERN.h file you find here:
$ find /Library/Developer/CommandLineTools -name EXTERN.h
A detailed instructions you find here:
DBD::mysql installation on Catalina/Big Sur fail with 'EXTERN.h' file not found?

Related

Github Action - Can't build gtest using ccache, mingw, cmake and ninja

I am using this workflow: cmake_build.yaml
Here is my toplevel CMakeLists.txt:
cmake_minimum_required(VERSION 3.15)
project(
container
VERSION 0.1.0
DESCRIPTION "An extension to the standard container library in c++"
HOMEPAGE_URL ""
LANGUAGES CXX
)
add_executable(${PROJECT_NAME} src/main.cpp)
set_target_properties(
${PROJECT_NAME}
PROPERTIES
LINKER_LANGUAGE CXX
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/${CMAKE_BUILD_TYPE}"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/${CMAKE_BUILD_TYPE}"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/${CMAKE_BUILD_TYPE}"
)
target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_17)
target_include_directories(
${PROJECT_NAME}
PUBLIC
$<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src
)
install(
DIRECTORY
include/${PROJECT_NAME_LOWERCASE}
DESTINATION
include
)
enable_testing()
add_subdirectory(test)
and test/CMakeLists.txt
cmake_minimum_required(VERSION 3.14)
project(my_project)
# GoogleTest requires at least C++14
set(CMAKE_CXX_STANDARD 17)
include(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip
)
# For Windows: Prevent overriding the parent project's compiler/linker settings
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
add_executable(
hello_test
hello_test.cc
)
target_link_libraries(
hello_test
GTest::gtest_main
)
include(GoogleTest)
gtest_discover_tests(hello_test)
I am using the example from gtest docs:
test/hello_test.cc:
#include <gtest/gtest.h>
TEST(HelloTest, BasicAssertions) {
// Expect two strings not to be equal.
EXPECT_STRNE("hello", "world");
// Expect equality.
EXPECT_EQ(7 * 6, 42);
}
int main(int argc, char **argv)
{
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
It builds fine on Windows MSVC, Macos Clang, Linux GCC, but fails using Mingw GCC, here is error shown:
FAILED: test/hello_test.exe test/hello_test[1]_tests.cmake D:/a/tsst/tsst/build/test/hello_test[1]_tests.cmake
cmd.exe /C "cd . && C:\ProgramData\chocolatey\bin\g++.exe -O3 -DNDEBUG test/CMakeFiles/hello_test.dir/hello_test.cc.obj -o test\hello_test.exe -Wl,--out-implib,test\libhello_test.dll.a -Wl,--major-image-version,0,--minor-image-version,0 lib/libgtest_main.a lib/libgtest.a -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cmd.exe /C "cd /D D:\a\tsst\tsst\build\test && D:\a\tsst\tsst\cmake-3.24.3-windows-x86_64\bin\cmake.exe -D TEST_TARGET=hello_test -D TEST_EXECUTABLE=D:/a/tsst/tsst/build/test/hello_test.exe -D TEST_EXECUTOR= -D TEST_WORKING_DIR=D:/a/tsst/tsst/build/test -D TEST_EXTRA_ARGS= -D TEST_PROPERTIES= -D TEST_PREFIX= -D TEST_SUFFIX= -D TEST_FILTER= -D NO_PRETTY_TYPES=FALSE -D NO_PRETTY_VALUES=FALSE -D TEST_LIST=hello_test_TESTS -D CTEST_FILE=D:/a/tsst/tsst/build/test/hello_test[1]_tests.cmake -D TEST_DISCOVERY_TIMEOUT=5 -D TEST_XML_OUTPUT_DIR= -P D:/a/tsst/tsst/cmake-3.24.3-windows-x86_64/share/cmake-3.24/Modules/GoogleTestAddTests.cmake""
CMake Error at D:/a/tsst/tsst/cmake-3.24.3-windows-x86_64/share/cmake-3.24/Modules/GoogleTestAddTests.cmake:112 (message):
Error running test executable.
Path: 'D:/a/tsst/tsst/build/test/hello_test.exe'
Result: Exit code 0xc0000139
Output:
Call Stack (most recent call first):
D:/a/tsst/tsst/cmake-3.24.3-windows-x86_64/share/cmake-3.24/Modules/GoogleTestAddTests.cmake:225 (gtest_discover_tests_impl)
ninja: build stopped: subcommand failed.
Build works fine without building gtest, and it fails when building test executable with gtest

Getting compilation error while building Valgrind for MIPS 64-bit

Getting below error while compiling Valgrind for Cavium MIPS
/opt/cavium-64bit/tools-3535/bin/mips64-octeon-linux-gnu-gcc -std=c99
-msoft-float -Wall -mabi=64 -G 0 -fPIC -mips64r2 -mplt -DHAVE_CONFIG_H -I. -I.. -I.. -I../include -I../include -I../VEX/pub -I../VEX/pub -DVGA_mips64=1 -DVGO_linux=1 -DVGP_mips64_linux=1 -DVGPV_mips64_linux_vanilla=1 -DVGABI_64 -I../coregrind -DVG_LIBDIR="\"/usr/local/lib/valgrind"\" -DVG_PLATFORM="\"mips64-linux\"" -O2 -g -Wall -Wmissing-prototypes -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations -Wcast-align -Wcast-qual -Wwrite-strings -Wempty-body -Wformat -Wformat-security -Wignored-qualifiers -Wmissing-parameter-type -Wlogical-op -Wold-style-declaration -finline-functions -fno-stack-protector -fno-strict-aliasing -fno-builtin -march=octeon2 -mabi=64 -MT libnolto_coregrind_mips64_linux_a-m_main.o -MD -MP -MF .deps/libnolto_coregrind_mips64_linux_a-m_main.Tpo -c -o
libnolto_coregrind_mips64_linux_a-m_main.o test -f 'm_main.c' || echo
'./'m_main.c m_main.c:2885:1: error: expected declaration specifiers
or ‘...’ before string constant Makefile:8044: recipe for target
'libnolto_coregrind_mips64_linux_a-m_main.o' failed make[3]: *
[libnolto_coregrind_mips64_linux_a-m_main.o] Error 1 make[3]: Leaving
directory '/home/ankit/Desktop/valgrind/valgrind-3.15.0/coregrind'
Makefile:1914: recipe for target 'all' failed make[2]: [all] Error
2 make[2]: Leaving directory
'/home/ankit/Desktop/valgrind/valgrind-3.15.0/coregrind' Makefile:841:
recipe for target 'all-recursive' failed make[1]: [all-recursive]
Error 1 make[1]: Leaving directory
'/home/ankit/Desktop/valgrind/valgrind-3.15.0' Makefile:710: recipe
for target 'all' failed make: * [all] Error 2
Procedure to build Valgrind binary for MIPS Architecture
Get latest Valgrind source code from (https://valgrind.org/downloads/)
wget
https://sourceware.org/pub/valgrind/valgrind-3.15.0.tar.bz2
Extract the tarball
tar -xvf valgrind-3.15.0.tar.bz2
On Bash prompt export below makefile defines
CC=/opt/CAVIUMsdk312/OCTEON-SDK/tools/bin/mips64-octeon-linux-gnu-gcc
CXX=/opt/CAVIUMsdk312/OCTEON-SDK/tools/bin/mips64-octeon-linux-gnu-g++
./configure --host=mips64-octeon-linux --target=mips64-octeon-linux
CFLAGS=" -march=octeon2 -mabi=64"
After configure is successfully executed do make in the directory
make​
To run Valgrind on target follow the below procedure
Copy the valgrind folder to target machine, Ex: /etc/user/
cd /etc/user/valgrind-3.15.0
touch /etc/user/valgrind-3.15.0/memcheck/default.supp
export VALGRIND_LIB=$PWD/memcheck/
export LD_LIBRARY_PATH=/usr/sbin/user/sharedobj/
./coregrind/valgrind --tool=memcheck --gen-suppressions=yes --leak-check=full -v
--track-origins=yes <Daemon>​

Meson find_program not finding program

I'm building a Vala program with gnome-builder and flatpak. I wan't to connect to a mySQL Database. Thats why I need to run mysql_config to get the right compiler flags.
So I added mysql_config = find_program('mysql_config')to my meson.build file.
When I try to compile I get meson.build:7:0: ERROR: Program(s) ['mysql_config'] not found or not executable.
When I run whereis mysql_config on command line I get the expected result mysql_config: /usr/bin/mysql_config. Also I can run mysql_config --cflags from command line with the expected result -I/usr/include/mysql -I/usr/include/mysql.
Thats why I think that the problem is that I'm building with flatpak-builder.
My ./meson.build:
project('zeiterfassunggtk', ['c', 'vala'], version: '0.1.0',
meson_version: '>= 0.40.0',
)
i18n = import('i18n')
mysql_config = find_program('mysql_config')
mysql_vapi = meson.get_compiler('vala').find_library('mysql')
mysql_dep = declare_dependency(c_args: run_command([mysql_config, '--cflags']).stdout().split(),
link_args: run_command([mysql_config, '--libs']).stdout().split(),
dependencies: [mysql_vapi])
subdir('data')
subdir('src')
subdir('po')
meson.add_install_script('build-aux/meson/postinstall.py')
My ./src/meson.build
zeiterfassunggtk_sources = [
'main.vala',
'window.vala',
'mysql.vala',
]
zeiterfassunggtk_deps = [
dependency('gio-2.0', version: '>= 2.50'),
dependency('gtk+-3.0', version: '>= 3.22'),
]
gnome = import('gnome')
zeiterfassunggtk_sources += gnome.compile_resources('zeiterfassunggtk-resources',
'zeiterfassunggtk.gresource.xml',
c_name: 'zeiterfassunggtk'
)
executable('zeiterfassunggtk', zeiterfassunggtk_sources,
vala_args: '--target-glib=2.50', dependencies: zeiterfassunggtk_deps,
install: true,
)
The full output of the build process:
flatpak build --env=LANG=de_AT.UTF-8 --env=USER=g.zehetner --env=HOME=/home/g.zehetner --env=PATH=/usr/bin:/bin --env=TERM=xterm-256color --env=V=0 --env=CCACHE_DIR=/home/g.zehetner/.cache/gnome-builder/flatpak-builder/ccache --env=PATH=/app/bin:/usr/bin --build-dir=/home/g.zehetner/.cache/gnome-builder/projects/ZeiterfassungGtk/builds/org.gnome.Zeiterfassunggtk.json-flatpak-org.gnome.Platform-x86_64-3.26-master --share=network --nofilesystem=host --filesystem=/home/g.zehetner/.cache/gnome-builder --filesystem=/home/g.zehetner/Projekte/ZeiterfassungGtk --filesystem=/home/g.zehetner/.cache/gnome-builder/projects/ZeiterfassungGtk/builds/org.gnome.Zeiterfassunggtk.json-flatpak-org.gnome.Platform-x86_64-3.26-master --env=V=1 '--env=CFLAGS=-O2 -g' '--env=CXXFLAGS=-O2 -g' --env=NOCONFIGURE=1 /home/g.zehetner/.cache/gnome-builder/projects/ZeiterfassungGtk/flatpak/staging/x86_64-master ninja
[0/1] Regenerating build files.
The Meson build system
Version: 0.46.0
Source dir: /home/g.zehetner/Projekte/ZeiterfassungGtk
Build dir: /home/g.zehetner/.cache/gnome-builder/projects/ZeiterfassungGtk/builds/org.gnome.Zeiterfassunggtk.json-flatpak-org.gnome.Platform-x86_64-3.26-master
Build type: native build
Project name: zeiterfassunggtk
Native C compiler: ccache cc (gcc 6.2.0 "cc (GCC) 6.2.0")
Appending CFLAGS from environment: '-O2 -g'
Appending LDFLAGS from environment: '-L/app/lib '
Native Vala compiler: valac (valac 0.38.2)
Appending LDFLAGS from environment: '-L/app/lib '
Build machine cpu family: x86_64
Build machine cpu: x86_64
Program mysql_config found: NO
meson.build:7:0: ERROR: Program(s) ['mysql_config'] not found or not executable
A full log can be found at /home/g.zehetner/.cache/gnome-builder/projects/ZeiterfassungGtk/builds/org.gnome.Zeiterfassunggtk.json-flatpak-org.gnome.Platform-x86_64-3.26-master/meson-logs/meson-log.txt
FAILED: build.ninja
/usr/bin/python3 /usr/bin/meson --internal regenerate /home/g.zehetner/Projekte/ZeiterfassungGtk /home/g.zehetner/.cache/gnome-builder/projects/ZeiterfassungGtk/builds/org.gnome.Zeiterfassunggtk.json-flatpak-org.gnome.Platform-x86_64-3.26-master --backend ninja
ninja: error: rebuilding 'build.ninja': subcommand failed
You can find the full code at Github.com

Building fiware-IoTAgent-Cplusplus from source failed due to strict-aliasing error

I'm trying to build fiware-IoTAgent-Cplusplus from source but I am getting strict-aliasing error. Any idea?
The commands I used to perform the build are as follows.
Note that I am building inside a lxc using CentOS 6.7.
$source tools/get_version_string.sh
$cmake -DGIT_VERSION=`get_rpm_version_string | cut -d ' ' -f 1` -DGIT_COMMIT=`get_rpm_version_string | cut -d
' ' -f 2` -DMQTT=ON -DCMAKE_BUILD_TYPE=Release ../../
$make
:
:
scons: done reading SConscript files.
scons: Building targets ...
g++ -o build/linux2/normal/mongo/bson/bsonelement.o -c -Wnon-virtual-dtor -Woverloaded-virtual -fPIC -ggdb -pthread -Wall -Wsign-compare -Wn
o-unknown-pragmas -Winvalid-pch -pipe -Werror -O3 -Wno-unused-function -Wno-deprecated-declarations -Wno-missing-braces -DMONGO_EXPOSE_MACRO
S -D_FILE_OFFSET_BITS=64 -DMONGO_HAVE___THREAD -DBOOST_THREAD_USES_DATETIME -DMONGO_HAVE_HEADER_UNISTD_H -DMONGO_HAVE_POSIX_MONOTONIC_CLOCK
-DMONGO_HAVE_TIMEGM -DLIBMONGOCLIENT_BUILDING -DSTATIC_LIBMONGOCLIENT -Ibuild/linux2/normal/third_party/gtest-1.7.0/include -Isrc/third_part
y/gtest-1.7.0/include -Ibuild/linux2/normal -Isrc -Ibuild/linux2/normal/mongo -Isrc/mongo -I/root/fiware/fiware-IoTAgent-Cplusplus/build/Rel
ease/third_party/boost/include -I/root/fiware/fiware-IoTAgent-Cplusplus/build/Release/third_party/boost/include src/mongo/bson/bsonelement.c
pp
cc1plus: warnings being treated as errors
In file included from /root/fiware/fiware-IoTAgent-Cplusplus/build/Release/third_party/boost/include/boost/functional/hash.hpp:6,
from src/mongo/bson/bsonelement.cpp:20:
/root/fiware/fiware-IoTAgent-Cplusplus/build/Release/third_party/boost/include/boost/functional/hash/detail/hash_float.hpp: In function 'voi
d boost::hash_combine(size_t&, const T&) [with T = double]':
/root/fiware/fiware-IoTAgent-Cplusplus/build/Release/third_party/boost/include/boost/functional/hash/detail/hash_float.hpp:71: error: derefe
rencing pointer 'ptr.266' does break strict-aliasing rules
/root/fiware/fiware-IoTAgent-Cplusplus/build/Release/third_party/boost/include/boost/functional/hash/detail/hash_float.hpp:71: note: initial
ized from here
scons: *** [build/linux2/normal/mongo/bson/bsonelement.o] Error 1
scons: building terminated because of errors.
make[2]: *** [third_party/mongo-driver/src/mongo-driver-stamp/mongo-driver-build] Error 2
make[1]: *** [CMakeFiles/mongo-driver.dir/all] Error 2
make: *** [all] Error 2
I got it. I was using a 32 bit CentOS.

How to compile to avoid shared library errors?

I need to develop a program using MySQL C API. I will develop it on my CentOS virtual machine and run it on RedHat servers. I compiled a some kind of Hello World program and transferred it to the server. But I get an error about shared libraries.
$ ./test1
./test1: error while loading shared libraries: libssl.so.10: cannot open shared object file: No such file or directory
I see that this library exists but with a slightly different name:
$ ls -l /usr/lib/libssl*
-rw-r--r-- 1 root root 458752 Aug 13 17:27 /usr/lib/libssl.a
lrwxrwxrwx 1 root root 26 Sep 14 01:26 /usr/lib/libssl.so -> ../../lib/libssl.so.0.9.8er
-rwxr-xr-x 1 root root 217560 Nov 9 12:22 /usr/lib/libssl3.so
Since I am not root on the server, I can't simply make a symbolic link. I will distribute my program to many people without root privilege and system administration skills. Is there a safe way of compiling my program to avoid such errors?
here is my simple program:
#include <my_global.h>
#include <mysql.h>
int main(int argc, char **argv)
{
printf("MySQL client version: %s\n", mysql_get_client_info());
}
and, this is how I compiled it:
gcc version.c -o version `mysql_config --cflags --libs`
output of ldd ./test1:
linux-gate.so.1 => (0x00685000)
libmysqlclient.so.16 => /usr/lib/mysql/libmysqlclient.so.16 (0x00a8c000)
libz.so.1 => /lib/libz.so.1 (0x00110000)
libcrypt.so.1 => /lib/libcrypt.so.1 (0x00240000)
libnsl.so.1 => /lib/libnsl.so.1 (0x002b7000)
libm.so.6 => /lib/libm.so.6 (0x00f5a000)
libssl.so.10 => /usr/lib/libssl.so.10 (0x00e0c000)
libcrypto.so.10 => /usr/lib/libcrypto.so.10 (0x002d1000)
libc.so.6 => /lib/libc.so.6 (0x004d3000)
libfreebl3.so => /lib/libfreebl3.so (0x00686000)
/lib/ld-linux.so.2 (0x00977000)
libgssapi_krb5.so.2 => /lib/libgssapi_krb5.so.2 (0x006ea000)
libkrb5.so.3 => /lib/libkrb5.so.3 (0x00123000)
libcom_err.so.2 => /lib/libcom_err.so.2 (0x00804000)
libk5crypto.so.3 => /lib/libk5crypto.so.3 (0x001f4000)
libresolv.so.2 => /lib/libresolv.so.2 (0x0021b000)
libdl.so.2 => /lib/libdl.so.2 (0x00dbf000)
libkrb5support.so.0 => /lib/libkrb5support.so.0 (0x00234000)
libkeyutils.so.1 => /lib/libkeyutils.so.1 (0x00f0b000)
libpthread.so.0 => /lib/libpthread.so.0 (0x00e72000)
libselinux.so.1 => /lib/libselinux.so.1 (0x00862000)
output of mysql_config --cflags --libs:
-I/usr/include/mysql -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -fasynchronous-unwind-tables -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fwrapv -fPIC -DUNIV_LINUX
-rdynamic -L/usr/lib/mysql -lmysqlclient -lz -lcrypt -lnsl -lm -lssl -lcrypto
Your binary is compiled against openssl version 1.0.x and therefore requires openssl major version 1. The target machine has version 0.9.8, which is major version 0. Different major versions are considered incompatible, hence the error.
Read up on ld.so and its variables such as LD_LIBRARY_PATH and LD_PRELOAD-- you can install, say libssl.so in your own ~/lib/ and have the dynamic linker find that.
Needless to say, you are much better off doing this via the package management system.