Apache Traffic Server forward proxy basic authentication - authentication

I'm trying to set up a forward proxy server with basic proxy authentication using Apache Traffic Server (ATS) on CentOS 6. I've already successfully deployed both SQUID and Apache httpd mod_proxy forward proxies with basic proxy authentication, and want to do the same with ATS to compare performance.
I'm trying to use the basic-auth plugin example provided by ATS, with multiple issues.
I add the latest epel repo for CentOS 6 and install both trafficserver and trafficserver-devel (required to use the ATS compiler, tsxs) packages. I copy the basic-auth.c file from source to my user directory and attempt to compile:
# tsxs -v -o /root/basic-auth.so -c /root/basic-auth.c
Whereupon I get errors for files not found - ts/ink_defs.h
This file is generated by running autoconfig -if and configure on the source code - so I went ahead and cloned the trafficserver git repo and ran through the steps to make the few hundred files in /opt/ts/. I copied these to the directory that tsxs looks at - /usr/include/ts/ (which is here because it is the default location when installed using trafficserver-devel (when I previously only had installed traffic server from source, tsxs would not run).
With the files now in place, I ran the compiler again on basic-auth.cc. This time I receive errors in ts.h, because of an sdk_version parameter:
# tsxs -v -o basic-auth.so basic-auth.c
compiling basic-auth.c -> basic-auth.lo
cc -I/usr/include -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -feliminate-unused-debug-symbols -fno-strict-aliasing -mcx16 -fpic -c basic-auth.c -o basic-auth.lo
In file included from basic-auth.c:30:
/usr/include/ts/ts.h:158: error: expected ‘)’ before ‘sdk_version’
In file included from /usr/include/ts/ink_defs.h:28,
from basic-auth.c:31:
/usr/include/ts/ink_config.h:41:26: error: ink_autoconf.h: No such file or directory
basic-auth.c: In function ‘TSPluginInit’:
basic-auth.c:222: warning: implicit declaration of function ‘TSPluginRegister’
tsxs: compilation failed: cc -I/usr/include -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -feliminate-unused-debug-symbols -fno-strict-aliasing -mcx16 -fpic -c basic-auth.c -o basic-auth.lo
I investigated the code for ts.h and compared it with the latest source. You can see that line 156 changes:
trafficserver-devel:
tsapi TSReturnCode TSPluginRegister(TSSDKVersion sdk_version, TSPluginRegistrationInfo plugin_info);
source:
tsapi TSReturnCode TSPluginRegister(TSPluginRegistrationInfo *plugin_info);
Hence I'm assuming there's some issue with the versioning. I replaced my version of ts.h with the latest source and attempted the compile again: it works!
I copy the .so file to the plugins directory and modify plugins.config and records.config accordingly. Alas, when I try to start up trafficserver, it fails with a segmentation fault:
# /usr/bin/traffic_server
traffic_server: using root directory '/usr'
[Jul 15 16:19:21.224] Server {0x7fd9458ba7e0} DEBUG: (dns) ink_dns_init: called with init_called = 0
[Jul 15 16:19:21.227] Server {0x7fd9458ba7e0} DEBUG: (dns) localhost=vmProxy1
[Jul 15 16:19:21.227] Server {0x7fd9458ba7e0} DEBUG: (dns) Round-robin nameservers = 1
traffic_server: Segmentation fault (Signal sent by the kernel [(nil)])traffic_server - STACK TRACE:
/usr/bin/traffic_server(_Z19crash_logger_invokeiP7siginfoPv+0x99)[0x4a5209]
/lib64/libpthread.so.0[0x35b600f710]
/lib64/libc.so.6[0x35b5d3362f]
/usr/lib64/trafficserver/libtsutil.so.5(_xstrdup+0x6d)[0x7fd945f2b6cd]
/usr/bin/traffic_server(TSPluginRegister+0x7c)[0x4bcb6c]
/usr/lib64/trafficserver/plugins/basic-auth.so(TSPluginInit+0x2f)[0x7fd942334e1f]
/usr/bin/traffic_server(_Z11plugin_initb+0x322)[0x4dab22]
/usr/bin/traffic_server(main+0x1424)[0x4d2754]
/lib64/libc.so.6(__libc_start_main+0xfd)[0x35b5c1ed5d]
/usr/bin/traffic_server[0x4942a9]
Segmentation fault (core dumped)
I tried to use gdb to get a better debug log, but I don't see anything useful. There's another mention of sdk_version - but I'm starting to think that hopping around files and replacing them isn't how it's meant to work...
Starting program: /usr/bin/traffic_server
[Thread debugging using libthread_db enabled]
traffic_server: using root directory '/usr'
[New Thread 0x7ffff7704700 (LWP 19967)]
[Jul 15 16:18:28.841] Server {0x7ffff77777e0} DEBUG: (dns) ink_dns_init: called with init_called = 0
[New Thread 0x7ffff68ff700 (LWP 19968)]
[New Thread 0x7ffff67fe700 (LWP 19969)]
[Jul 15 16:18:28.844] Server {0x7ffff77777e0} DEBUG: (dns) localhost=vmProxy1
[Jul 15 16:18:28.844] Server {0x7ffff77777e0} DEBUG: (dns) Round-robin nameservers = 1
[New Thread 0x7ffff46f5700 (LWP 19970)]
[New Thread 0x7ffff44f3700 (LWP 19971)]
Program received signal SIGSEGV, Segmentation fault.
__strlen_sse42 () at ../sysdeps/x86_64/multiarch/strlen-sse4.S:32
32 pcmpeqb (%rdi), %xmm1
Missing separate debuginfos, use: debuginfo-install tcl-8.5.7-6.el6.x86_64
(gdb) bt
#0 __strlen_sse42 () at ../sysdeps/x86_64/multiarch/strlen-sse4.S:32
#1 0x00007ffff7de86cd in _xstrdup (str=0xd46e3934ae7d6389 <Address 0xd46e3934ae7d6389 out of bounds>, length=-1)
at ink_memory.cc:231
#2 0x00000000004bcb6c in TSPluginRegister (sdk_version=<value optimized out>, plugin_info=0x7fffffffcc50)
at InkAPI.cc:1803
#3 0x00007ffff41f1e1f in TSPluginInit (argc=<value optimized out>, argv=<value optimized out>) at /root/basic-auth.c:222
#4 0x00000000004dab22 in plugin_load (validateOnly=false) at Plugin.cc:114
#5 plugin_init (validateOnly=false) at Plugin.cc:265
#6 0x00000000004d2754 in main (argv=<value optimized out>) at Main.cc:1714
Any hints or tips on what I might be doing wrong are very much appreciated.

Yeah, this is somewhat unfortunate, but the examples in the source tree is not intended to be compiled with tsxs. You would need to make a few changes in the code to make it work. For example, see this git commit I made to the version.c example:
diff --git a/example/version/version.c b/example/version/version.c
index f5c8126..4020a0c 100644
--- a/example/version/version.c
+++ b/example/version/version.c
## -24,10 +24,9 ##
#include <stdio.h>
#include "ts/ts.h"
-#include "ts/ink_defs.h"
void
-TSPluginInit(int argc ATS_UNUSED, const char *argv[] ATS_UNUSED)
+TSPluginInit(int argc , const char *argv[])
{
TSPluginRegistrationInfo info;
As for the Version information, this was removed for ATS v6.0.0, which means older plugins also need to be modified to remove it. This also makes previously built binaries are not compatible. There are probably better tools to use than tsxs as well, including the pkgconfig support, and traffic_layout.

Related

Compile errors running the ot-br-posix ./script/setup on RPi4

I'm trying to run the ./script/setup, but get compile errors:
Please note that the total 65 steps listed below is because I've restarted the setup script. The initial number of steps were closer to 465.
[1/65] Building CXX object src/common/CMakeFiles/otbr-common.dir/mainloop.cpp.o
FAILED: src/common/CMakeFiles/otbr-common.dir/mainloop.cpp.o
/usr/bin/c++ -DHAVE_LIBSYSTEMD=1 -DOTBR_ENABLE_BACKBONE_ROUTER=1 -DOTBR_ENABLE_BORDER_AGENT=1 -DOTBR_ENABLE_BORDER_ROUTING=1 -DOTBR_ENABLE_BORDER_ROUTING_COUNTERS=1 -DOTBR_ENABLE_DBUS_SERVER=1 -DOTBR_ENABLE_DNSSD_DISCOVERY_PROXY=1 -DOTBR_ENABLE_NAT64=1 -DOTBR_ENABLE_NOTIFY_UPSTART=1 -DOTBR_ENABLE_REST_SERVER=1 -DOTBR_ENABLE_SRP_ADVERTISING_PROXY=1 -DOTBR_ENABLE_SRP_SERVER_AUTO_ENABLE_MODE=1 -DOTBR_ENABLE_VENDOR_INFRA_LINK_SELECT=0 -DOTBR_MESHCOP_SERVICE_INSTANCE_NAME="\"OpenThread BorderRouter\"" -DOTBR_PACKAGE_NAME=\"OpenThread_BorderRouter\" -DOTBR_PACKAGE_VERSION=\"0.3.0-0cdef3c\" -DOTBR_PRODUCT_NAME=\"BorderRouter\" -DOTBR_SYSLOG_FACILITY_ID=LOG_USER -DOTBR_VENDOR_NAME=\"OpenThread\" -I../../include -I../../src -Ithird_party/openthread/repo/etc/cmake -I../../third_party/openthread/repo/etc/cmake -I../../third_party/openthread/repo/include -I../../third_party/openthread/repo/src/posix/platform/include -I../../third_party/openthread/repo/src -Wall -Wextra -Werror -Wfatal-errors -Wuninitialized -Wno-missing-braces -std=c++11 -MD -MT src/common/CMakeFiles/otbr-common.dir/mainloop.cpp.o -MF src/common/CMakeFiles/otbr-common.dir/mainloop.cpp.o.d -o src/common/CMakeFiles/otbr-common.dir/mainloop.cpp.o -c ../../src/common/mainloop.cpp
In file included from /usr/include/c++/8/list:63,
from ../../src/common/mainloop_manager.hpp:41,
from ../../src/common/mainloop.cpp:30:
/usr/include/c++/8/bits/stl_list.h:811:19: error: expected ‘)’ before ‘&’ token
list(_InputIterat&... __args)`
compilation terminated due to -Wfatal-errors.
I receive a lot more errors, but they follow the same pattern as above.
I have followed the guide from openthread.io to setup an Open Thread Border Router
The execution of the bootstrap script ran smoothly.
Additional information:
Git local repository path: ~/src/openthread/ot-br-posix
Command for executing the setup script:
pi#raspberrypi:~/src/openthread/ot-br-posix$> INFRA_IF_NAME=eth0 ./script/setup
RPi OS: Recommended image from the guide Raspberry Pi OS lite
Libgcc versions:
libgcc-8-dev/oldstable,now 8.3.0-6+rpi1 armhf [installed,automatic]
libgcc1/oldstable,now 1:8.3.0-6+rpi1 armhf [installed]
Cmake versions:
cmake-data/oldstable,now 3.16.3-3~bpo10+1 all [installed,automatic]
cmake/oldstable,now 3.16.3-3~bpo10+1 armhf [installed]

qemu-arm Segmentation Fault

Take a simple file:
int main(void) {
return 0;
}
My CMakeLists.txt file:
cmake_minimum_required(VERSION 3.20)
project(TRA
VERSION 0.0.1
DESCRIPTION "STM32 Traffic Controller"
LANGUAGES C ASM)
set(BSP_DRIVER_FILES
BSP/tra/startup_stm32f429xx.s
BSP/tra/Core/Src/system_stm32f4xx.c
)
set(BSP_COMPILER_FLAGS
-DUSE_HAL_DRIVER
-DSTM32F429xx
-I${CMAKE_SOURCE_DIR}/BSP/tra/Core/Inc
-I${CMAKE_SOURCE_DIR}/BSP/tra/Drivers/STM32F4xx_HAL_Driver/Inc
-I${CMAKE_SOURCE_DIR}/BSP/tra/Drivers/STM32F4xx_HAL_Driver/Inc/Legacy
-I${CMAKE_SOURCE_DIR}/BSP/tra/Drivers/CMSIS/Device/ST/STM32F4xx/Include
-I${CMAKE_SOURCE_DIR}/BSP/tra/Drivers/CMSIS/Include
)
add_executable(tra)
target_sources(tra PRIVATE
${BSP_DRIVER_FILES}
code/tra.c
)
set(COMPILER_FLAGS
${BSP_COMPILER_FLAGS}
-O0 -g -ggdb3
-mcpu=cortex-m4 -mthumb -mfloat-abi=soft
-fdata-sections -ffunction-sections
--specs=rdimon.specs
)
target_compile_options(tra PRIVATE
${COMPILER_FLAGS}
)
target_link_options(tra PRIVATE
-mcpu=cortex-m4 -mthumb -mfloat-abi=soft
--specs=rdimon.specs -lm -lc
-Wl,--gc-sections
)
Running qemu-arm build/tra.
I get
qemu: uncaught target signal 11 (Segmentation fault) - core dumped
Segmentation fault (core dumped)
My understanding was that this issue was commonly caused by qemu not handling hardware FPU, however I'm specifying software floating point here. Also, I have removed FPU initialization code from my startup.c file.
With gdb:
# Start
qemu-arm -g 1234 build/tra
# Attach
arm-none-eabi-gdb -q --nh -ex 'file build/tra' -ex 'target remote localhost:1234'
I get the segmentation fault at SystemInit(). Running gdb list, it shows the commented out FPU initialization code, so I don't see how that could be the issue.
Therefore, I'm at a loss as to what is going on.
You're building a bare-metal binary for a Cortex-M CPU, and then trying to run it on qemu-arm, which is the emulator for running Cortex-A Linux binaries.
If you're building a bare-metal binary, you need to build it for the exact machine type that you want to run it on, which means you need to target a machine type supported by qemu-system-arm, and you need to tell qemu-system-arm to use that machine type.
As suggested by Peter Maydell require full system emulation. For cortex-M, this was provided by xPack QEMU

Bazel build fails with "Executing genrule #six_archive//:copy_six failed" error while building syntaxnet

I'm trying to follow the instructions at syntaxnet's github page to build syntaxnet parser models.
My system is a Debian Wheezy. Shouldn't be very different from Ubuntu 14.04 LTS or 15.05. I have compiled bazel 0.2.2 (as opposed to 0.2.2b) from source and it appears to work correctly.
Whenever I launch the bazel test syntaxnet/... util/utf8/... command, no tests are executed (all skipped) with some quite cryptic error messages. Here's an example:
root#host:~/tensorflow_syntaxnet/models/syntaxnet# ../../bazel/output/bazel test syntaxnet/... util/utf8/...
Extracting Bazel installation...
.............
INFO: Found 65 targets and 12 test targets...
ERROR: /root/.cache/bazel/_bazel_root/74c6bab7a21f28ad02405b720243d086/external/six_archive/BUILD:1:1: Executing genrule #six_archive//:copy_six failed: namespace-sandbox failed: error executing command /root/.cache/bazel/_bazel_root/74c6bab7a21f28ad02405b720243d086/syntaxnet/_bin/namespace-sandbox ... (remaining 5 argument(s) skipped).
unshare failed with EINVAL even after 101 tries, giving up.
INFO: Elapsed time: 95.469s, Critical Path: 22.46s
//syntaxnet:arc_standard_transitions_test NO STATUS
//syntaxnet:beam_reader_ops_test NO STATUS
//syntaxnet:graph_builder_test NO STATUS
//syntaxnet:lexicon_builder_test NO STATUS
//syntaxnet:parser_features_test NO STATUS
//syntaxnet:parser_trainer_test NO STATUS
//syntaxnet:reader_ops_test NO STATUS
//syntaxnet:sentence_features_test NO STATUS
//syntaxnet:shared_store_test NO STATUS
//syntaxnet:tagger_transitions_test NO STATUS
//syntaxnet:text_formats_test NO STATUS
//util/utf8:unicodetext_unittest NO STATUS
Executed 0 out of 12 tests: 12 were skipped.
I'm using Oracle Java 8 JDK as recommended, and my compiler is:
~/tensorflow_syntaxnet/models/syntaxnet# gcc --version
gcc (Debian 4.7.2-5) 4.7.2
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Tried looking into the namespace-sandbox binary that's mentioned in the error message, but before I dive deep into this, I thought I'd ask here.
~/tensorflow_syntaxnet/models/syntaxnet# ls -l /root/.cache/bazel/_bazel_root/74c6bab7a21f28ad02405b720243d086/syntaxnet/_bin/namespace-sandbox
lrwxrwxrwx 1 root root 108 May 13 14:52 /root/.cache/bazel/_bazel_root/74c6bab7a21f28ad02405b720243d086/syntaxnet/_bin/namespace-sandbox -> /root/.cache/bazel/_bazel_root/install/ca381eaad1c931167a6355cb8a2b98cf/_embedded_binaries/namespace-sandbox
~/tensorflow_syntaxnet/models/syntaxnet# readlink /root/.cache/bazel/_bazel_root/74c6bab7a21f28ad02405b720243d086/syntaxnet/_bin/namespace-sandbox
/root/.cache/bazel/_bazel_root/install/ca381eaad1c931167a6355cb8a2b98cf/_embedded_binaries/namespace-sandbox
Command seems to work fine though:
~/tensorflow_syntaxnet/models/syntaxnet# file $(readlink /root/.cache/bazel/_bazel_root/74c6bab7a21f28ad02405b720243d086/syntaxnet/_bin/namespace-sandbox)
/root/.cache/bazel/_bazel_root/install/ca381eaad1c931167a6355cb8a2b98cf/_embedded_binaries/namespace-sandbox: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.26, BuildID[md5/uuid]=0xecfd97b6a6b9a193b045be13654bd55b, not stripped
~/tensorflow_syntaxnet/models/syntaxnet# /root/.cache/bazel/_bazel_root/install/ca381eaad1c931167a6355cb8a2b98cf/_embedded_binaries/namespace-sandbox
No command specified.
Usage: /root/.cache/bazel/_bazel_root/install/ca381eaad1c931167a6355cb8a2b98cf/_embedded_binaries/namespace-sandbox [-S sandbox-root] -- command arg1
provided: /root/.cache/bazel/_bazel_root/install/ca381eaad1c931167a6355cb8a2b98cf/_embedded_binaries/namespace-sandbox
Mandatory arguments:
-S <sandbox-root> directory which will become the root of the sandbox
-- command to run inside sandbox, followed by arguments
Optional arguments:
-W <working-dir> working directory
-T <timeout> timeout after which the child process will be terminated with SIGTERM
-t <timeout> in case timeout occurs, how long to wait before killing the child with SIGKILL
-d <dir> create an empty directory in the sandbox
-M/-m <source/target> system directory to mount inside the sandbox
Multiple directories can be specified and each of them will be mounted readonly.
The -M option specifies which directory to mount, the -m option specifies where to
mount it in the sandbox.
-n if set, a new network namespace will be created
-r if set, make the uid/gid be root, otherwise use nobody
-D if set, debug info will be printed
-l <file> redirect stdout to a file
-L <file> redirect stderr to a file
#FILE read newline-separated arguments from FILE
Any idea?
UPDATE: I have done exactly the same steps on a Ubuntu 14.04 LTS (my small workstation, as opposed to the production server running Debian) and everything works well there, with all tests passing. I wonder what's the difference.
Apparently some permission errors happens when setting up the sandbox. A quick workaround is to deactivate the sandbox by using --genrule_strategy=standalone --spawn_strategy=standalone (note that the second one is already specified in the TensorFlow rc file).
You can set those flag in your ~/.bazelrc:
echo "build --genrule_strategy=standalone --spawn_strategy=standalone" >>~/.bazelrc

Erlang Installation and "/usr/local/ssl/lib/libcrypto.a: could not read symbols: Bad value"

I am trying to install RabbitMQ (3.6.1) on linux machine Red Hat Enterprise Linux Server release 6.6. To install rabbitMQ , first I have installed Erlang R16B03 version from source (otp_src_R16B03) and followed below commands
wget http://www.erlang.org/download/otp_src_R16B03.tar.gz
tar xvfz /usr/tmp/otp_src_R16B03.tar
cd otp_src_R16B03
LANG=C; export LANG
./configure --with-ssl=/usr/bin
I get the message shown below:
*********************************************************************
********************** APPLICATIONS DISABLED **********************
*********************************************************************
crypto : OpenSSL is configured for kerberos but no krb5.h found
jinterface : No Java compiler found
odbc : ODBC library - link check failed
orber : No C++ compiler found
ssh : OpenSSL is configured for kerberos but no krb5.h found
ssl : OpenSSL is configured for kerberos but no krb5.h found
*********************************************************************
*********************************************************************
********************** APPLICATIONS INFORMATION *******************
*********************************************************************
wx : wxWidgets not found, wx will NOT be usable
*********************************************************************
though I continued with make & make install but while starting Rabbitmq server I get the following error
sbin/rabbitmq-server
Getting message
BOOT FAILED
===========
Error description:
{error,{missing_dependencies,[crypto,ssl],[mochiweb,cowlib,cowboy]}}
Log files (may contain more information):
/usr/tmp/rabbitmq_server-3.6.1/var/log/rabbitmq/rabbit.log
/usr/tmp/rabbitmq_server-3.6.1/var/log/rabbitmq/rabbit-sasl.log
Stack trace:
[{rabbit_plugins,ensure_dependencies,1,
[{file,"src/rabbit_plugins.erl"},{line,179}]},
{rabbit_plugins,prepare_plugins,1,
[{file,"src/rabbit_plugins.erl"},{line,198}]},
{rabbit,broker_start,0,[{file,"src/rabbit.erl"},{line,284}]},
{rabbit,start_it,1,[{file,"src/rabbit.erl"},{line,303}]},
{init,start_it,1,[]},
{init,start_em,1,[]}]
{"init terminating in do_boot",{error,{missing_dependencies,[crypto,ssl],[mochiweb,cowlib,cowboy]}}}
Crash dump was written to: erl_crash.dump
init terminating in do_boot ()
After exploring multiple solution I understood that I need to install latest Openssl and provide the path of newly installed openssl.
I installed Openssl from the source and installed with -fPIC
wget https://www.openssl.org/source/openssl-1.0.2.tar.gz
tar xvfz /usr/tmp/openssl-1.0.2.tar.gz
cd /usr/tmp/openssl-1.0.2
./config -fPIC
make
make install
Now new openssl is installed in bin/local/ssl location and I have reinstalled the Erlang with below configuration
export PATH="/usr/local/ssl/bin:$PATH”
export CFLAGS=-fPIC
cd /usr/tmp/otp_src_RB1603
LANG=C; export LANG
./configure --with-ssl=/usr/local/bin
make
make install
now I get the error
/usr/bin/ld: /usr/local/ssl/lib/libcrypto.a(rsaz_exp.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/local/ssl/lib/libcrypto.a: could not read symbols: Bad value**
collect2: ld returned 1 exit status
make[6]: *** [../priv/lib/x86_64-unknown-linux-gnu/crypto.so] Error 1
make[6]: Leaving directory `/var/tmp/otp_src_R16B03/lib/crypto/c_src'
make[5]: *** [release_spec] Error 2
make[5]: Leaving directory `/var/tmp/otp_src_R16B03/lib/crypto/c_src'
make[4]: *** [release] Error 2
make[4]: Leaving directory `/var/tmp/otp_src_R16B03/lib/crypto/c_src'
make[3]: *** [release] Error 2
make[3]: Leaving directory `/var/tmp/otp_src_R16B03/lib/crypto/c_src'
make[2]: *** [release] Error 2
make[2]: Leaving directory `/var/tmp/otp_src_R16B03/lib/crypto'
make[1]: *** [release] Error 2
make[1]: Leaving directory `/var/tmp/otp_src_R16B03/lib'
make: *** [install.libs] Error 2
I could not resolve this error , any suggestion..
Please note I am using accessing machine as root user
/usr/bin/ld: /usr/local/ssl/lib/libcrypto.a(rsaz_exp.o): relocation R_X86_64_32 against `.rodata'
can not be used when making a shared object; recompile with -fPIC
/usr/local/ssl/lib/libcrypto.a: could not read symbols: Bad value**
collect2: ld returned 1 exit status
You need to build OpenSSL with the shared option. Maybe something like the following for a 64-bit Intel machine.
wget https://www.openssl.org/source/openssl-1.1.0b.tar.gz
tar xzf openssl-1.1.0b.tar.gz
cd openssl-1.1.0b
./Configure no-ssl2 no-ssl3 shared enable-ec_nistp_64_gcc_128
...
make -j 8
...
make test
...
suod make install
enable-ec_nistp_64_gcc_128 make EC Diffie-Hellman 2x to 4x faster, but it has some limitations. You are OK to use it on a 64-bit Intel machine. Also see Compilation and Installation | Configure Options on the OpenSSL wiki.
Also, be sure to either make dclean for OpenSSL 1.0.2 and below; or make distclean for OpenSSL 1.1.0 and above. Otherwise, some of the old configuration lingers even after changing the option.

How to use cmake's 'make install' from a pbuilder env debian/rules script?

This is to compile and link a static library (so only a build time dependency) that the source is fetched from a repository (just like the source of the main program) on a ubuntu launchpad build bot.
currently i am doing:
#!/usr/bin/make -f
export PREFIX=/usr
export CFLAGS= -O3 -fomit-frame-pointer -flto -fwhole-program
export CXXFLAGS= -O3 -fomit-frame-pointer -flto -fwhole-program
%:
dh $#
override_dh_auto_configure:
cd src/munt;cmake -DCMAKE_CXX_FLAGS="-O3 -fomit-frame-pointer -flto" mt32emu;make;make install
#...compile of the program that depends on mt32emu...
But it fails with:
Install the project...
-- Install configuration: ""
-- Installing: /usr/local/lib/libmt32emu.a
CMake Error at cmake_install.cmake:36 (FILE):
file INSTALL cannot copy file
"/tmp/buildd/dosbox-0.74+20121225/src/munt/libmt32emu.a" to
"/usr/local/lib/libmt32emu.a".
make[2]: *** [install] Error 1
make[2]: Leaving directory `/tmp/buildd/dosbox-0.74+20121225/src/munt'
make[1]: *** [override_dh_auto_configure] Error 2
make[1]: Leaving directory `/tmp/buildd/dosbox-0.74+20121225'
make: *** [build] Error 2
dpkg-buildpackage: error: debian/rules build gave error exit status 2
E: Failed autobuilding of package
I: unmounting /var/cache/pbuilder/ccache filesystem
I: unmounting dev/pts filesystem
I: unmounting proc filesystem
I: cleaning the build env
I: removing directory /var/cache/pbuilder/build//2751 and its subdirectories
The idea is to install a static library dependency that is is not packaged in the ubuntu repositories in the launchpad pbuilder env, so it can be used as if it was a system dependency already.
If i try to do 'sudo make install' (and add sudo to the build-deps in debian/control), it asks me for the 'pbuilder' password when testing locally, which i'm assuming will hang the machine on the ubuntu buildbots.
edit: it actually fails on the buildbots because 'no tty present and no askpass program specified'.
There are several things you can do to clean up your rules file, especially when you are using dh.
In the % target, all of the dh command take a parameter builddirectory, which specifies what directory you are building in. This tells the builder to cd to that directory and then call commands (make, cmake, etc.).
In addition, you should just let dh install the files for you. This is done automatically. You shouldn't have to call make install manually.
Here's a slightly easier-to-read rules file:
#!/usr/bin/make -f
export PREFIX=/usr
export CFLAGS= -O3 -fomit-frame-pointer -flto -fwhole-program
export CXXFLAGS= -O3 -fomit-frame-pointer -flto -fwhole-program
%:
dh $# --builddirectory=src/munt
override_dh_auto_configure:
cd src/munt && cmake -DCMAKE_CXX_FLAGS="-O3 -fomit-frame-pointer -flto" mt32emu
#...compile of the program that depends on mt32emu...
Is this just a permissions issue? (i.e. -- must use 'sudo' to install to '/usr/local'?)
Must you install it to '/usr/local'?
If it's just a static library, purely needed for the build of the "the program that depends on mt32emu" then you could put it anywhere, and just tell the dependent program where it is.
To install somewhere else, use -DCMAKE_INSTALL_PREFIX=/directory/where/you/have/write/privileges. Or use DESTDIR= with the make install.
I eventually 'solved' this by depending on launchpad repository dependencies, that is, building a whole package for the library and building that on launchpad and then importing the archive where that was placed to my other builds. Made it explicit i guess.