Bitbake build for qpid-cpp-1.39.0 fails - bitbake

I must preface this saying I have very little knowledge of Yocto/Bitbake, make, cmake, autoconf, etc.
I have an application, written in C++, that I have been unable to get built. The issue I am having is that I have been unable to get some dependencies built in Yocto/Bitbake. The application has dependencies on the following libraries:
Paho-MQTT (https://github.com/eclipse/paho.mqtt.c.git)
Jansson JSON parser (http://www.digip.org/jansson/releases/jansson-2.10.tar.gz)
Apache QPID C++ (https://www-us.apache.org/dist/qpid/cpp/1.39.0/qpid-cpp-1.39.0.tar.gz)
When running the bitbake recipe for apache qpid, I am receiving the following error:
CMake Error at src/CMakeLists.txt:84 (message):
| Can't find amqp 0-10 spec for framing code generation
I do not have any ideas how to get past this error.
I am running Docker/Yocto on a Macbook and have followed the instructions to get everything installed and running. The application (and dependent libraries) are being compiled for a Multitech Conduit gateway running mLinux version 4.1.6. I followed the instructions at http://www.multitech.net/developer/software/mlinux/mlinux-building-images/building-a-custom-linux-image/ to download and build the default images for mLinux 4.0 and higher.
I could not find an existing recipe for building qpid-cpp-1.39.0. I was able to find a recipe for qpid_0.20 (http://git.yoctoproject.org/cgit/cgit.cgi/meta-cloud-services/tree/meta-openstack/recipes-extended/qpid/qpid_0.20.bb?h=master) that I attempted to modify to support qpid-cpp-1.39.0. When running bitbake against the recipe, I receive the following output:
pokyuser#8c538668c625:/workdir/mlinux-4.x/build$ bitbake qpid-cpp
NOTE: Started PRServer with DBfile: /workdir/mlinux-4.x/build/cache/prserv.sqlite3, IP: 127.0.0.1, PORT: 41127, PID: 10213
Loading cache: 100% |#############################################################################################################################################| Time: 0:00:01
Loaded 2996 entries from dependency cache.
Parsing recipes: 100% |###########################################################################################################################################| Time: 0:00:01
Parsing of 2213 .bb files complete (2207 cached, 6 parsed). 3001 targets, 177 skipped, 0 masked, 0 errors.
WARNING: No bb files matched BBFILE_PATTERN_user '^/workdir/mlinux-4.x/layers/user-layer/'
NOTE: Resolving any missing task queue dependencies
Build Configuration:
BB_VERSION = "1.32.0"
BUILD_SYS = "x86_64-linux"
NATIVELSBSTRING = "Ubuntu-16.04"
TARGET_SYS = "arm-mlinux-linux-gnueabi"
MACHINE = "mtcdt"
DISTRO = "mlinux"
DISTRO_VERSION = "4.1.7"
TUNE_FEATURES = "arm armv5 thumb dsp arm926ejs"
TARGET_FPU = "soft"
user-layer = "master:c9360c9479287f3ba229c9a37142baa5a22cce67"
meta-mlinux = "HEAD:4a060176a58345749e5907084cf1647f8b8cae23"
meta-multitech = "HEAD:55db4fd0bb04ccaedb10de0b249151a663b0d916"
meta-mono = "HEAD:b8e5da7138c61fb9ade87712a2fc28dc6283ab25"
meta-nodejs = "HEAD:78018dc7dc02b5039a165801d09c00564687a1b6"
meta-java = "HEAD:a265b31ec7d022be254abdf959360a7624208585"
meta-oe
meta-ruby
meta-perl
meta-python
meta-networking
meta-webserver
meta-multimedia
meta-filesystems = "HEAD:fe5c83312de11e80b85680ef237f8acb04b4b26e"
meta = "HEAD:ddf907ca95a19f54785079b4396935273b3747f6"
meta-jansson
meta-paho-mqtt
meta-clearblade-sdk
meta-qpid-cpp = "master:c9360c9479287f3ba229c9a37142baa5a22cce67"
Initialising tasks: 100% |########################################################################################################################################| Time: 0:00:02
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
ERROR: qpid-cpp-1.39.0-r0 do_configure: Function failed: do_configure (log file is located at /workdir/mlinux-4.x/build/tmp/work/arm926ejste-mlinux-linux-gnueabi/qpid-cpp/1.39.0-r0/temp/log.do_configure.10486)
ERROR: Logfile of failure stored in: /workdir/mlinux-4.x/build/tmp/work/arm926ejste-mlinux-linux-gnueabi/qpid-cpp/1.39.0-r0/temp/log.do_configure.10486
Log data follows:
| DEBUG: Executing python function sysroot_cleansstate
| DEBUG: Python function sysroot_cleansstate finished
| DEBUG: Executing shell function do_configure
| -- The C compiler identification is GNU 6.2.0
| -- The CXX compiler identification is GNU 6.2.0
| -- Check for working C compiler: /workdir/mlinux-4.x/build/tmp/sysroots/x86_64-linux/usr/bin/arm-mlinux-linux-gnueabi/arm-mlinux-linux-gnueabi-gcc
| -- Check for working C compiler: /workdir/mlinux-4.x/build/tmp/sysroots/x86_64-linux/usr/bin/arm-mlinux-linux-gnueabi/arm-mlinux-linux-gnueabi-gcc -- works
| -- Detecting C compiler ABI info
| -- Detecting C compiler ABI info - done
| -- Detecting C compile features
| -- Detecting C compile features - done
| -- Check for working CXX compiler: /workdir/mlinux-4.x/build/tmp/sysroots/x86_64-linux/usr/bin/arm-mlinux-linux-gnueabi/arm-mlinux-linux-gnueabi-g++
| -- Check for working CXX compiler: /workdir/mlinux-4.x/build/tmp/sysroots/x86_64-linux/usr/bin/arm-mlinux-linux-gnueabi/arm-mlinux-linux-gnueabi-g++ -- works
| -- Detecting CXX compiler ABI info
| -- Detecting CXX compiler ABI info - done
| -- Detecting CXX compile features
| -- Detecting CXX compile features - done
| -- Build type is "RelWithDebInfo" (has debug symbols)
| -- Found PythonInterp: /usr/bin/python2.7 (found suitable version "2.7.12", minimum required is "2.7")
| -- Found PythonInterp: /usr/bin/python2.7 (found version "2.7.12")
| -- Found PkgConfig: /workdir/mlinux-4.x/build/tmp/sysroots/x86_64-linux/usr/bin/pkg-config (found version "0.29.1")
| -- Found Ruby: /workdir/mlinux-4.x/build/tmp/sysroots/x86_64-linux/usr/bin/ruby (found version "2.2.0")
| -- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
| -- Could NOT find VALGRIND (missing: VALGRIND_EXECUTABLE)
| -- Found CyrusSASL: /workdir/mlinux-4.x/build/tmp/sysroots/mtcdt/usr/lib/libsasl2.so
| CMake Error at src/CMakeLists.txt:84 (message):
| Can't find amqp 0-10 spec for framing code generation
|
|
| -- Configuring incomplete, errors occurred!
| See also "/workdir/mlinux-4.x/build/tmp/work/arm926ejste-mlinux-linux-gnueabi/qpid-cpp/1.39.0-r0/build/CMakeFiles/CMakeOutput.log".
| WARNING: exit code 1 from a shell command.
| ERROR: Function failed: do_configure (log file is located at /workdir/mlinux-4.x/build/tmp/work/arm926ejste-mlinux-linux-gnueabi/qpid-cpp/1.39.0-r0/temp/log.do_configure.10486)
ERROR: Task (/workdir/mlinux-4.x/layers/meta-qpid-cpp/recipes-qpid-cpp/qpid-cpp/qpid-cpp_1.39.0.bb:do_configure) failed with exit code '1'
NOTE: Tasks Summary: Attempted 1273 tasks of which 1267 didn't need to be rerun and 1 failed.
Summary: 1 task failed:
/workdir/mlinux-4.x/layers/meta-qpid-cpp/recipes-qpid-cpp/qpid-cpp/qpid-cpp_1.39.0.bb:do_configure
Summary: There was 1 WARNING message shown.
Summary: There was 1 ERROR message shown, returning a non-zero exit code.
The recipe I used is as follows:
DESCRIPTION = "AMQP message brokers"
HOMEPAGE = "http://qpid.apache.org/"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=b1e01b26bacfc2232046c90a330332b3"
SECTION = "mq"
DEPENDS = "boost perl-native python util-linux cyrus-sasl"
RDEPENDS_${PN} = "cyrus-sasl-bin"
SRC_URI = "git://github.com/apache/qpid-cpp;protocol=https"
SRCREV = "0f5d21861f6935ed2e4eb6e21f1d3cef19e22aa5"
S = "${WORKDIR}/git"
#S = "${WORKDIR}/${PN}-${PV}"
inherit cmake python-dir perlnative cpan-base update-rc.d pkgconfig ruby
OECMAKE_FIND_ROOT_PATH_MODE_PROGRAM = "BOTH"
# Env var which tells perl if it should use host (no) or target (yes) settings
export PERLCONFIGTARGET = "${#is_target(d)}"
export PERL_INC = "${STAGING_LIBDIR}${PERL_OWN_DIR}/perl/${#get_perl_version(d)}/CORE"
export PERL_LIB = "${STAGING_LIBDIR}${PERL_OWN_DIR}/perl/${#get_perl_version(d)}"
export PERL_ARCHLIB = "${STAGING_LIBDIR}${PERL_OWN_DIR}/perl/${#get_perl_version(d)}"
export PERL="${STAGING_BINDIR}/perl"
EXTRA_OECONF += " --without-help2man SASL_PASSWD=/usr/sbin/saslpasswd2"
EXTRA_OEMAKE += " CPPFLAGS=-Wno-unused-function \
pyexecdir=${PYTHON_SITEPACKAGES_DIR} \
pythondir=${PYTHON_SITEPACKAGES_DIR} \
"
INITSCRIPT_NAME = "qpidd"
INITSCRIPT_PARAMS = "defaults"
Knowing that I have just started learning Yocto/Bitbake just three days ago, I'm hoping that someone out there can help me determine what the problem is so that I can compile the apache qpid-cpp-1.39.0 library for mLinux.

According to find_file documentation:
The CMake variable CMAKE_FIND_ROOT_PATH specifies one or more
directories to be prepended to all other search directories. This
effectively “re-roots” the entire search under given locations. Paths
which are descendants of the CMAKE_STAGING_PREFIX are excluded from
this re-rooting, because that variable is always a path on the host
system. By default the CMAKE_FIND_ROOT_PATH is empty.
And since cmake called from bitbake environment is effectively a cross-compilation, then this variable should be also ignored. I added a patch files/0001-Qpid-cross-compile.patch, which worked for me:
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 82141efdb..3ba403a32 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
## -78,7 +78,7 ## endif (NOT CMAKE_SYSTEM_NAME STREQUAL Windows AND BUILD_TESTING)
# rubygen subdir is excluded from stable distributions
# If the main AMQP spec is present, then check if ruby and python are
# present, and if any sources have changed, forcing a re-gen of source code.
-find_file(QPID_AMQP_SPEC NAMES amqp.0-10-qpid-errata.stripped.xml PATHS ${qpid-cpp_SOURCE_DIR}/specs ${qpid-cpp_SOURCE_DIR}/../specs NO_DEFAULT_PATH)
+find_file(QPID_AMQP_SPEC NAMES amqp.0-10-qpid-errata.stripped.xml PATHS ${qpid-cpp_SOURCE_DIR}/specs ${qpid-cpp_SOURCE_DIR}/../specs NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
mark_as_advanced(QPID_AMQP_SPEC)
if (NOT QPID_AMQP_SPEC)
message(FATAL_ERROR "Can't find amqp 0-10 spec for framing code generation")
## -106,7 +106,7 ## else (regen_amqp)
message(STATUS "No need to generate AMQP protocol sources")
endif (regen_amqp)
-find_file(QPID_BROKER_MANAGEMENT_SPEC NAMES management-schema.xml PATHS ${CMAKE_CURRENT_SOURCE_DIR}/qpid/broker ${qpid-cpp_SOURCE_DIR}/../specs NO_DEFAULT_PATH)
+find_file(QPID_BROKER_MANAGEMENT_SPEC NAMES management-schema.xml PATHS ${CMAKE_CURRENT_SOURCE_DIR}/qpid/broker ${qpid-cpp_SOURCE_DIR}/../specs NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
mark_as_advanced(QPID_BROKER_MANAGEMENT_SPEC)
if (NOT QPID_BROKER_MANAGEMENT_SPEC)
message(FATAL_ERROR "Can't find broker management spec for code generation")

Related

CMake configure and generate LMMS errors

I'm trying to configure and build LMMS from sources following the guide:
https://github.com/LMMS/lmms/wiki/dependencies-windows#windows-msvc
I have
Windows 7 x64
msvc 2019
Qt 5.15.1 both x32 and x64 with Qt Creator 4.13.2
CMake 3.16.1
First, at the end of (I use --triplet x64-windows option)
.\vcpkg install fftw3 libsamplerate libsndfile sdl2 --triplet x64-windows
I get
...
The package fftw3:x64-windows provides CMake targets:
find_package(FFTW3 CONFIG REQUIRED)
target_link_libraries(main PRIVATE FFTW3::fftw3)
find_package(FFTW3f CONFIG REQUIRED)
target_link_libraries(main PRIVATE FFTW3::fftw3f)
find_package(FFTW3l CONFIG REQUIRED)
target_link_libraries(main PRIVATE FFTW3::fftw3l)
The package libsndfile:x64-windows provides CMake targets:
find_package(SndFile CONFIG REQUIRED)
target_link_libraries(main PRIVATE SndFile::sndfile)
The package sdl2:x64-windows provides CMake targets:
find_package(SDL2 CONFIG REQUIRED)
target_link_libraries(main PRIVATE SDL2::SDL2 SDL2::SDL2main)
Do the captions "CONFIG REQUIRED" require some actions from me before the next steps?
As the instruction wrote, I add vcpkg path to the CMAKE_PREFIX_PATH:STRING:
CMAKE_PREFIX_PATH:STRING=%{Qt:QT_INSTALL_PREFIX};g:\audio_sources\lmms\vcpkg\installed\x64-windows
Then in Qt Creator when opening CMakeLists.txt I get:
Running C:\Program Files\CMake\bin\cmake.exe -S G:/audio_sources/lmms -B C:/Users/Ber/AppData/Local/Temp/QtCreator-IYdlTJ/qtc-cmake-UUUBKujd -GNinja "-DCMAKE_BUILD_TYPE:String=Debug" "-DCMAKE_CXX_COMPILER:STRING=C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.27.29110/bin/HostX64/x64/cl.exe" "-DCMAKE_C_COMPILER:STRING=C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.27.29110/bin/HostX64/x64/cl.exe" "-DCMAKE_PREFIX_PATH:STRING=C:/Qt/5.15.1/msvc2019_64;g:\audio_sources\lmms\vcpkg\installed\x64-windows" "-DQT_QMAKE_EXECUTABLE:STRING=C:/Qt/5.15.1/msvc2019_64/bin/qmake.exe" in C:\Users\Ber\AppData\Local\Temp\QtCreator-IYdlTJ\qtc-cmake-UUUBKujd.
-- The C compiler identification is MSVC 19.27.29110.0
-- The CXX compiler identification is MSVC 19.27.29110.0
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.27.29110/bin/HostX64/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.27.29110/bin/HostX64/x64/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.27.29110/bin/HostX64/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.27.29110/bin/HostX64/x64/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Deprecation Warning at CMakeLists.txt:15 (CMAKE_POLICY):
The OLD behavior for policy CMP0050 will be removed from a future version
of CMake.
The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
CMake Warning at cmake/modules/PluginList.cmake:104 (message):
Compiling with MSVC. The following plugins are not available:
LadspaEffect;zynaddsubfx
Call Stack (most recent call first):
CMakeLists.txt:21 (INCLUDE)
Checking submodules...
-- Skipping plugins/zynaddsubfx/zynaddsubfx matches "plugins/zynaddsubfx/zynaddsubfx" (absent in PLUGIN_LIST)
-- Skipping plugins/LadspaEffect/calf/veal matches "plugins/LadspaEffect/calf/veal" (absent in PLUGIN_LIST)
-- Skipping plugins/LadspaEffect/swh/ladspa matches "plugins/LadspaEffect/swh/ladspa" (absent in PLUGIN_LIST)
-- Skipping plugins/LadspaEffect/tap/tap-plugins matches "plugins/LadspaEffect/tap/tap-plugins" (absent in PLUGIN_LIST)
-- Checking qt5-x11embed...
-- Found src/3rdparty/qt5-x11embed/CMakeLists.txt
-- Checking rpmalloc...
-- Found src/3rdparty/rpmalloc/rpmalloc/configure.py
-- Checking game-music-emu...
-- Found plugins/FreeBoy/game-music-emu/CMakeLists.txt
-- Checking adplug...
-- Found plugins/OpulenZ/adplug/Makefile.am
-- Checking exprtk...
-- Found plugins/Xpressive/exprtk/Makefile
-- Checking weakjack...
-- Found src/3rdparty/weakjack/weakjack/.gitignore
-- Checking mingw-std-threads...
-- Found src/3rdparty/mingw-std-threads/LICENSE
-- Checking wiki...
-- Found doc/wiki/Home.md
-- Checking ringbuffer...
-- Found src/3rdparty/ringbuffer/CMakeLists.txt
-- Checking carla...
-- Found plugins/carlabase/carla/Makefile
-- Done validating submodules.
-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
-- Found Git: C:/Program Files/Git/cmd/git.exe (found version "2.24.0.windows.2")
Configuring LMMS
--------------------------
* Project version : 1.2.3-735+gf5d0524b1
* Major version : 1
* Minor version : 2
* Release version : 3
* Stage version : 735+gf5d0524b1
* Build version : 0
*
Optional Version Usage:
--------------------------
* Override version: -DFORCE_VERSION=x.x.x-x
* Ignore Git information: -DFORCE_VERSION=internal
PROCESSOR: AMD64
-- Target host is 64 bit
-- Looking for include file stdint.h
-- Looking for include file stdint.h - found
-- Looking for include file stdlib.h
-- Looking for include file stdlib.h - found
-- Looking for include file pthread.h
-- Looking for include file pthread.h - not found
-- Looking for include file semaphore.h
-- Looking for include file semaphore.h - not found
-- Looking for include file unistd.h
-- Looking for include file unistd.h - not found
-- Looking for include file sys/types.h
-- Looking for include file sys/types.h - found
-- Looking for include file sys/ipc.h
-- Looking for include file sys/ipc.h - not found
-- Looking for include file sys/shm.h
-- Looking for include file sys/shm.h - not found
-- Looking for include file sys/time.h
-- Looking for include file sys/time.h - not found
-- Looking for include file sys/times.h
-- Looking for include file sys/times.h - not found
-- Looking for include file sched.h
-- Looking for include file sched.h - not found
-- Looking for include file sys/soundcard.h
-- Looking for include file sys/soundcard.h - not found
-- Looking for include file soundcard.h
-- Looking for include file soundcard.h - not found
-- Looking for include file fcntl.h
-- Looking for include file fcntl.h - found
-- Looking for include file sys/ioctl.h
-- Looking for include file sys/ioctl.h - not found
-- Looking for include file ctype.h
-- Looking for include file ctype.h - found
-- Looking for include file string.h
-- Looking for include file string.h - found
-- Looking for include file process.h
-- Looking for include file process.h - found
-- Looking for include file locale.h
-- Looking for include file locale.h - found
-- Found Qt translations in C:/Qt/5.15.1/msvc2019_64/translations
-- Found SndFile: G:/audio_sources/lmms/vcpkg/installed/x64-windows/lib/sndfile.lib
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
-- Found SDL2: G:/audio_sources/lmms/vcpkg/installed/x64-windows/lib/SDL2.lib
-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
-- Could NOT find Lame (missing: LAME_INCLUDE_DIRS LAME_LIBRARIES)
-- Looking for vorbis_bitrate_addblock in vorbis
-- Looking for vorbis_bitrate_addblock in vorbis - not found
-- Found OggVorbis: G:/audio_sources/lmms/vcpkg/installed/x64-windows/lib/ogg.lib;G:/audio_sources/lmms/vcpkg/installed/x64-windows/lib/vorbis.lib;G:/audio_sources/lmms/vcpkg/installed/x64-windows/lib/vorbisfile.lib;G:/audio_sources/lmms/vcpkg/installed/x64-windows/lib/vorbisenc.lib
-- Found FFTW: G:/audio_sources/lmms/vcpkg/installed/x64-windows/include
-- Found OpenGL: opengl32
-- Could NOT find FLTK (missing: FLTK_LIBRARIES FLTK_INCLUDE_DIR FLTK_FLUID_EXECUTABLE)
-- Could NOT find Wine (missing: WINE_CXX WINE_LIBRARIES WINE_INCLUDE_DIRS)
-- Found SAMPLERATE: G:/audio_sources/lmms/vcpkg/installed/x64-windows/lib/libsamplerate-0.lib
-- Looking for include file sys/mman.h
-- Looking for include file sys/mman.h - not found
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Failed
-- Performing Test COMPILER_HAS_DEPRECATED
-- Performing Test COMPILER_HAS_DEPRECATED - Success
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
-- Bash competion is not supported on this platform.
-- Could NOT find UnixCommands (missing: BASH CP GZIP MV RM TAR)
Installation Summary
--------------------
* Install Directory : C:/Program Files (x86)/lmms
Supported audio interfaces
--------------------------
* ALSA : <not supported on this platform>
* JACK : <not supported on this platform>
* OSS : <not found or not supported on this platform>
* Sndio :
* PortAudio : not found, please install portaudio19-dev (or similar, version >= 1.9) ;if you require PortAudio support
* libsoundio : <disabled in this release>
* PulseAudio : <not supported on this platform>
* SDL : OK, using SDL2
Supported MIDI interfaces
-------------------------
* ALSA : <not supported on this platform>
* OSS : <not found or not supported on this platform>
* Sndio :
* JACK : <not supported on this platform>
* WinMM : OK
* AppleMidi : <not supported on this platform>
Supported file formats for project export
-----------------------------------------
* WAVE : OK
* FLAC : OK
* OGG/VORBIS : OK
* MP3/Lame : not found, please install libmp3lame-dev (or similar)
Optional plugins
----------------
* Lv2 plugins : not found, requires pkg-config
* SUIL for plugin UIs : not found, requires pkg-config
* ZynAddSubFX instrument : not found, please install fltk
* Carla Patchbay & Rack : OK (weak linking enabled)
* SoundFont2 player : not found, libfluidsynth-dev (or similar);is highly recommended
* Stk Mallets : not found, please install libstk0-dev (or similar) ;if you require the Mallets instrument
* VST-instrument hoster : OK
* VST-effect hoster : OK
* CALF LADSPA plugins : OK
* CAPS LADSPA plugins : OK
* CMT LADSPA plugins : OK
* TAP LADSPA plugins : OK
* SWH LADSPA plugins : OK
* GIG player : not found, libgig needed for decoding .gig files
Developer options
-----------------------------------------
* Debug FP exceptions : Disabled
-----------------------------------------------------------------
IMPORTANT:
after installing missing packages, remove CMakeCache.txt before
running cmake again!
-----------------------------------------------------------------
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/Ber/AppData/Local/Temp/QtCreator-IYdlTJ/qtc-cmake-UUUBKujd
Elapsed time: 00:35.
Among other things, among the messages I see the lines
The following plugins are not available:
LadspaEffect;zynaddsubfx
While there are both LadspaEffect and zynaddsubfx source folders in the plugins dir.
What I am doing wrong?
Whether I really need to install pkg-config in addition to vcpkg ? Can I use pkg-config-lite-0.28-1 ?

Pre-programmed feature installs at apache karaf launch

I am working on an opendaylight project that uses apache karaf. At the start of the program, I need karaf to have some features installed. Currently (and this works) I manually type this into the shell and the features get installed:
$ bin/karaf
Apache Karaf starting up. Press Enter to open the shell now...
100% [========================================================================]
Karaf started in 9s. Bundle stats: 409 active, 410 total
________ ________ .__ .__ .__ __
\_____ \ ______ ____ ____ \______ \ _____ ___.__.| | |__| ____ | |___/ |_
/ | \\____ \_/ __ \ / \ | | \\__ \< | || | | |/ ___\| | \ __\
/ | \ |_> > ___/| | \| ` \/ __ \\___ || |_| / /_/ > Y \ |
\_______ / __/ \___ >___| /_______ (____ / ____||____/__\___ /|___| /__|
\/|__| \/ \/ \/ \/\/ /_____/ \/
Hit '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
Hit '<ctrl-d>' or type 'system:shutdown' or 'logout' to shutdown OpenDaylight.
opendaylight-user#root>feature:install odl-restconf odl-mdsal-apidocs odl-openflowplugin-flow-services-rest odl-openflowplugin-app-table-miss-enforcer odl-openflowplugin-nxm-extensions odl-restconf-all odl-openflowplugin-flow-services
opendaylight-user#root>
All this works. However, what I need is for this feature install to occur at the start automatically. I am aware there is a shell.init.script file and I have attempted to add this line to the botton of it:
feature:install odl-restconf odl-mdsal-apidocs odl-openflowplugin-flow-services-rest odl-openflowplugin-app-table-miss-enforcer odl-openflowplugin-nxm-extensions odl-restconf-all odl-openflowplugin-flow-services
But when I do this, I get the following error:
/opt/opendaylight-0.11.0/etc/shell.init.script: Command not found: feature:install
I am also aware that adding a featuresBoot element to org.apache.karaf.features.cfg
featuresBoot = odl-restconf (I shortened it to just one feature for ease of testing)
And I get this error:
org.apache.felix.resolver.reason.ReasonException: Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=odl-restconf; type=karaf.feature; version="[1.10.0,1.10.0]"; filter:="(&(osgi.identity=odl-restconf)(type=karaf.feature)(version>=1.10.0)(version<=1.10.0))" [caused by: Unable to resolve odl-restconf/1.10.0: missing requirement [odl-restconf/1.10.0] osgi.identity; osgi.identity=odl-restconf-nb-rfc8040; type=karaf.feature; version="[1.10.0,1.10.0]" [caused by: Unable to resolve odl-restconf-nb-rfc8040/1.10.0: missing requirement [odl-restconf-nb-rfc8040/1.10.0] osgi.identity; osgi.identity=odl-restconf-common; type=karaf.feature; version="[1.10.0,1.10.0]" [caused by: Unable to resolve odl-restconf-common/1.10.0: missing requirement [odl-restconf-common/1.10.0] osgi.identity; osgi.identity=odl-mdsal-broker; type=karaf.feature; version="[1.10.0,1.10.0]" [caused by: Unable to resolve odl-mdsal-broker/1.10.0: missing requirement [odl-mdsal-broker/1.10.0] osgi.identity; osgi.identity=org.opendaylight.controller.sal-binding-broker-impl; type=osgi.bundle; version="[1.10.0,1.10.0]"; resolution:=mandatory [caused by: Unable to resolve org.opendaylight.controller.sal-binding-broker-impl/1.10.0: missing requirement [org.opendaylight.controller.sal-binding-broker-impl/1.10.0] osgi.wiring.package; filter:="(&(osgi.wiring.package=org.osgi.service.blueprint)(version>=1.0.0)(!(version>=2.0.0)))"]]]]]
So, I can tell that karaf is at least acknowledging the shell.init.script and org.apache.karaf.features.cfg, however I am clearly using the wrong syntax. I have exhausted my googling in finding the right syntax or finding examples of this. In fact, when I do google for this issue, I get advice along the lines of "use the shell.init.script" file, without an example or a link to documentation for how to use it.
For example, here is a similar question script to run commands at start of apache karaf but the answers really aren't full or complete. I don't know where to put the suggested commands, etc.
Anyway, I hope someone here can show me what specific command one uses in either shell.init.script or org.apache.karaf.features.cfg to accomplish this goal. (The goal being the equivalent initialization command to accomplish what I can successfully do manually as noted at the top)
Update:
I also tried this type of command:
echo "feature:install odl-restconf odl-mdsal-apidocs odl-openflowplugin-flow-services-rest odl-openflowplugin-app-table-miss-enforcer odl-openflowplugin-nxm-extensions odl-restconf-all odl-openflowplugin-flow-services" | /opt/opendaylight-0.11.0/bin/karaf
Which also didn't work. I don't get any error messages, I just know my restconf isn't working. Funny enough I did see all the features getting piped into the karaf shell, and the shell did seem to freeze up (seemingly like it was processing the command) but no-go after the cursor returned to me.
Thanks to #jamo as his answer lead me to the answer. I needed to only add this to etc/org.apache.karaf.features.cfg:
featuresBoot = odl-restconf,odl-mdsal-apidocs,odl-openflowplugin-flow-services-rest,odl-openflowplugin-app-table-miss-enforcer,odl-openflowplugin-nxm-extensions,odl-restconf-all,odl-openflowplugin-flow-services, 25921329-8d07-420b-af13-94948bf1a78d
I believe the trick was having the final 25921329-8d07-420b-af13-94948bf1a78d which is some hex value that is in the default cfg file and I ensure it stayed in there.
we use the org.apache.karaf.features.cfg file exclusively in upstream ODL
system test. you can see it inside this log, but specifically, here is what
it looks like for one of our yangtools jobs:
################################################################################
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
################################################################################
#
# Comma separated list of features repositories to register by default
#
featuresRepositories = mvn:org.opendaylight.integration/features-test/0.12.1-SNAPSHOT/xml/features,mvn:org.apache.karaf.decanter/apache-karaf-decanter/1.2.0/xml/features, file:${karaf.etc}/5edc7e82-415e-4254-9731-f87670633bcb.xml
#
# Comma separated list of features to install at startup
#
featuresBoot = odl-infrautils-ready,odl-restconf, a3fb0299-0563-4506-b1a0-059253ab43b4
#
# Resource repositories (OBR) that the features resolver can use
# to resolve requirements/capabilities
#
# The format of the resourceRepositories is
# resourceRepositories=[xml:url|json:url],...
# for Instance:
#
#resourceRepositories=xml:http://host/path/to/index.xml
# or
#resourceRepositories=json:http://host/path/to/index.json
#
#
# Defines if the boot features are started in asynchronous mode (in a dedicated thread)
#
featuresBootAsynchronous=false
#
# Service requirements enforcement
#
# By default, the feature resolver checks the service requirements/capabilities of
# bundles for new features (xml schema >= 1.3.0) in order to automatically installs
# the required bundles.
# The following flag can have those values:
# - disable: service requirements are completely ignored
# - default: service requirements are ignored for old features
# - enforce: service requirements are always verified
#
#serviceRequirements=default
#
# Store cfg file for config element in feature
#
#configCfgStore=true
#
# Configuration of features processing mechanism (overrides, blacklisting, modification of features)
# XML file defines instructions related to features processing
# versions.properties may declare properties to resolve placeholders in XML file
# both files are relative to ${karaf.etc}
#
#featureProcessing=org.apache.karaf.features.xml
#featureProcessingVersions=versions.properties
You have a typo in your question with featuresBook, but I am guessing that's
just a typo on not your problem. It's very strange that feature:install works,
but not featuresBoot.

Without root access, run R with tuned BLAS when it is linked with reference BLAS

Can any one tell me why I can not successfully test OpenBLAS's dgemm performance (in GFLOPs) in R via the following way?
link R with the "reference BLAS" libblas.so
compile my C program mmperf.c with OpenBLAS library libopenblas.so
load the resulting shared library mmperf.so into R, call the R wrapper function mmperf and report dgemm performance in GFLOPs.
Point 1 looks strange, but I have no choice because I have no root access on machines I want to test, so actual linking to OpenBLAS is impossible. By "not successfully" I mean my program ends up reporting dgemm performance for reference BLAS instead of OpenBLAS. I hope someone can explain to me:
why my way does not work;
is it possible at all to make it work (this is important, because if it is impossible, I must write a C main function and do my job in a C program.)
I've investigated into this issue for two days, here I will include various system output to assist you to make a diagnose. To make things reproducible, I will also include the code, makefile as well as shell command.
Part 1: system environment before testing
There are 2 ways to invoke R, either using R or Rscript. There are some differences in what is loaded when they are invoked:
~/Desktop/dgemm$ readelf -d $(R RHOME)/bin/exec/R | grep "NEEDED"
0x00000001 (NEEDED) Shared library: [libR.so]
0x00000001 (NEEDED) Shared library: [libpthread.so.0]
0x00000001 (NEEDED) Shared library: [libc.so.6]
~/Desktop/dgemm$ readelf -d $(R RHOME)/bin/Rscript | grep "NEEDED"
0x00000001 (NEEDED) Shared library: [libc.so.6]
Here we need to choose Rscript, because R loads libR.so, which will automatically load the reference BLAS libblas.so.3:
~/Desktop/dgemm$ readelf -d $(R RHOME)/lib/libR.so | grep blas
0x00000001 (NEEDED) Shared library: [libblas.so.3]
~/Desktop/dgemm$ ls -l /etc/alternatives/libblas.so.3
... 31 May /etc/alternatives/libblas.so.3 -> /usr/lib/libblas/libblas.so.3.0
~/Desktop/dgemm$ readelf -d /usr/lib/libblas/libblas.so.3 | grep SONAME
0x0000000e (SONAME) Library soname: [libblas.so.3]
Comparatively, Rscript gives a cleaner environment.
Part 2: OpenBLAS
After downloading source file from OpenBLAS and a simple make command, a shared library of the form libopenblas-<arch>-<release>.so-<version> can be generated. Note that we will not have root access to install it; instead, we copy this library into our working directory ~/Desktop/dgemm and rename it simply to libopenblas.so. At the same time we have to make another copy with name libopenblas.so.0, as this is the SONAME which run time loader will seek for:
~/Desktop/dgemm$ readelf -d libopenblas.so | grep "RPATH\|SONAME"
0x0000000e (SONAME) Library soname: [libopenblas.so.0]
Note that the RPATH attribute is not given, which means this library is intended to be put in /usr/lib and we should call ldconfig to add it to ld.so.cache. But again we don't have root access to do this. In fact, if this can be done, then all the difficulties are gone. We could then use update-alternatives --config libblas.so.3 to effectively link R to OpenBLAS.
Part 3: C code, Makefile, and R code
Here is a C script mmperf.c computing GFLOPs of multiplying 2 square matrices of size N:
#include <R.h>
#include <Rmath.h>
#include <Rinternals.h>
#include <R_ext/BLAS.h>
#include <sys/time.h>
/* standard C subroutine */
double mmperf (int n) {
/* local vars */
int n2 = n * n, tmp; double *A, *C, one = 1.0;
struct timeval t1, t2; double elapsedTime, GFLOPs;
/* simulate N-by-N matrix A */
A = (double *)calloc(n2, sizeof(double));
GetRNGstate();
tmp = 0; while (tmp < n2) {A[tmp] = runif(0.0, 1.0); tmp++;}
PutRNGstate();
/* generate N-by-N zero matrix C */
C = (double *)calloc(n2, sizeof(double));
/* time 'dgemm.f' for C <- A * A + C */
gettimeofday(&t1, NULL);
F77_CALL(dgemm) ("N", "N", &n, &n, &n, &one, A, &n, A, &n, &one, C, &n);
gettimeofday(&t2, NULL);
/* free memory */
free(A); free(C);
/* compute and return elapsedTime in microseconds (usec or 1e-6 sec) */
elapsedTime = (double)(t2.tv_sec - t1.tv_sec) * 1e+6;
elapsedTime += (double)(t2.tv_usec - t1.tv_usec);
/* convert microseconds to nanoseconds (1e-9 sec) */
elapsedTime *= 1e+3;
/* compute and return GFLOPs */
GFLOPs = 2.0 * (double)n2 * (double)n / elapsedTime;
return GFLOPs;
}
/* R wrapper */
SEXP R_mmperf (SEXP n) {
double GFLOPs = mmperf(asInteger(n));
return ScalarReal(GFLOPs);
}
Here is a simple R script mmperf.R to report GFLOPs for case N = 2000
mmperf <- function (n) {
dyn.load("mmperf.so")
GFLOPs <- .Call("R_mmperf", n)
dyn.unload("mmperf.so")
return(GFLOPs)
}
GFLOPs <- round(mmperf(2000), 2)
cat(paste("GFLOPs =",GFLOPs, "\n"))
Finally there is a simple makefile to generate the shared library mmperf.so:
mmperf.so: mmperf.o
gcc -shared -L$(shell pwd) -Wl,-rpath=$(shell pwd) -o mmperf.so mmperf.o -lopenblas
mmperf.o: mmperf.c
gcc -fpic -O2 -I$(shell Rscript --default-packages=base --vanilla -e 'cat(R.home("include"))') -c mmperf.c
Put all these files under working directory ~/Desktop/dgemm, and compile it:
~/Desktop/dgemm$ make
~/Desktop/dgemm$ readelf -d mmperf.so | grep "NEEDED\|RPATH\|SONAME"
0x00000001 (NEEDED) Shared library: [libopenblas.so.0]
0x00000001 (NEEDED) Shared library: [libc.so.6]
0x0000000f (RPATH) Library rpath: [/home/zheyuan/Desktop/dgemm]
The output reassures us that OpenBLAS is correctly linked, and the run time load path is correctly set.
Part 4: testing OpenBLAS in R
Let's do
~/Desktop/dgemm$ Rscript --default-packages=base --vanilla mmperf.R
Note our script needs only the base package in R, and --vanilla is used to ignore all user settings on R start-up. On my laptop, my program returns:
GFLOPs = 1.11
Oops! This is truely reference BLAS performance not OpenBLAS (which is about 8-9 GFLOPs).
Part 5: Why?
To be honest, I don't know why this happens. Each step seems to work correctly. Does something subtle occurs when R is invoked? For example, any possibility that OpenBLAS library is overridden by reference BLAS at some point for some reason? Any explanations and solutions? Thanks!
why my way does not work
First, shared libraries on UNIX are designed to mimic the way archive libraries work (archive libraries were there first). In particular that means that if you have libfoo.so and libbar.so, both defining symbol foo, then whichever library is loaded first is the one that wins: all references to foo from anywhere within the program (including from libbar.so) will bind to libfoo.sos definition of foo.
This mimics what would happen if you linked your program against libfoo.a and libbar.a, where both archive libraries defined the same symbol foo. More info on archive linking here.
It should be clear from above, that if libblas.so.3 and libopenblas.so.0 define the same set of symbols (which they do), and if libblas.so.3 is loaded into the process first, then routines from libopenblas.so.0 will never be called.
Second, you've correctly decided that since R directly links against libR.so, and since libR.so directly links against libblas.so.3, it is guaranteed that libopenblas.so.0 will lose the battle.
However, you erroneously decided that Rscript is better, but it's not: Rscript is a tiny binary (11K on my system; compare to 2.4MB for libR.so), and approximately all it does is exec of R. This is trivial to see in strace output:
strace -e trace=execve /usr/bin/Rscript --default-packages=base --vanilla /dev/null
execve("/usr/bin/Rscript", ["/usr/bin/Rscript", "--default-packages=base", "--vanilla", "/dev/null"], [/* 42 vars */]) = 0
execve("/usr/lib/R/bin/R", ["/usr/lib/R/bin/R", "--slave", "--no-restore", "--vanilla", "--file=/dev/null", "--args"], [/* 43 vars */]) = 0
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=89625, si_status=0, si_utime=0, si_stime=0} ---
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=89626, si_status=0, si_utime=0, si_stime=0} ---
execve("/usr/lib/R/bin/exec/R", ["/usr/lib/R/bin/exec/R", "--slave", "--no-restore", "--vanilla", "--file=/dev/null", "--args"], [/* 51 vars */]) = 0
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=89630, si_status=0, si_utime=0, si_stime=0} ---
+++ exited with 0 +++
Which means that by the time your script starts executing, libblas.so.3 has been loaded, and libopenblas.so.0 that will be loaded as a dependency of mmperf.so will not actually be used for anything.
is it possible at all to make it work
Probably. I can think of two possible solutions:
Pretend that libopenblas.so.0 is actually libblas.so.3
Rebuild entire R package against libopenblas.so.
For #1, you need to ln -s libopenblas.so.0 libblas.so.3, then make sure that your copy of libblas.so.3 is found before the system one, by setting LD_LIBRARY_PATH appropriately.
This appears to work for me:
mkdir /tmp/libblas
# pretend that libc.so.6 is really libblas.so.3
cp /lib/x86_64-linux-gnu/libc.so.6 /tmp/libblas/libblas.so.3
LD_LIBRARY_PATH=/tmp/libblas /usr/bin/Rscript /dev/null
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/usr/lib/R/library/stats/libs/stats.so':
/usr/lib/liblapack.so.3: undefined symbol: cgemv_
During startup - Warning message:
package ‘stats’ in options("defaultPackages") was not found
Note how I got an error (my "pretend" libblas.so.3 doesn't define symbols expected of it, since it's really a copy of libc.so.6).
You can also confirm which version of libblas.so.3 is getting loaded this way:
LD_DEBUG=libs LD_LIBRARY_PATH=/tmp/libblas /usr/bin/Rscript /dev/null |& grep 'libblas\.so\.3'
91533: find library=libblas.so.3 [0]; searching
91533: trying file=/usr/lib/R/lib/libblas.so.3
91533: trying file=/usr/lib/x86_64-linux-gnu/libblas.so.3
91533: trying file=/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/server/libblas.so.3
91533: trying file=/tmp/libblas/libblas.so.3
91533: calling init: /tmp/libblas/libblas.so.3
For #2, you said:
I have no root access on machines I want to test, so actual linking to OpenBLAS is impossible.
but that seems to be a bogus argument: if you can build libopenblas, surely you can also build your own version of R.
Update:
You mentioned in the beginning that libblas.so.3 and libopenblas.so.0 define the same symbol, what does this mean? They have different SONAME, is that insufficient to distinguish them by the system?
The symbols and the SONAME have nothing to do with each other.
You can see symbols in the output from readelf -Ws libblas.so.3 and readelf -Ws libopenblas.so.0. Symbols related to BLAS, such as cgemv_, will appear in both libraries.
Your confusion about SONAME possibly comes from Windows. The DLLs on Windows are designed completely differently. In particular, when FOO.DLL imports symbol bar from BAR.DLL, both the name of the symbol (bar) and the DLL from which that symbol was imported (BAR.DLL) are recorded in the FOO.DLLs import table.
That makes it easy to have R import cgemv_ from BLAS.DLL, while MMPERF.DLL imports the same symbol from OPENBLAS.DLL.
However, that makes library interpositioning hard, and works completely differently from the way archive libraries work (even on Windows).
Opinions differ on which design is better overall, but neither system is likely to ever change its model.
There are ways for UNIX to emulate Windows-style symbol binding: see RTLD_DEEPBIND in dlopen man page. Beware: these are fraught with peril, likely to confuse UNIX experts, are not widely used, and likely to have implementation bugs.
Update 2:
you mean I compile R and install it under my home directory?
Yes.
Then when I want to invoke it, I should explicitly give the path to my version of executable program, otherwise the one on the system might be invoked instead? Or, can I put this path at the first position of environment variable $PATH to cheat the system?
Either way works.
*********************
Solution 2:
*********************
Here we offer another solution, by exploiting environment variable LD_PRELOAD mentioned in our solution 1. The use of LD_PRELOAD is more "brutal", as it forces loading a given library into the program before any other program, even before the C library libc.so! This is often used for urgent patching in Linux development.
As shown in the part 2 of the original post, the shared BLAS library libopenblas.so has SONAME libopenblas.so.0. An SONAME is an internal name that dynamic library loader would seek at run time, so we need to make a symbolic link to libopenblas.so with this SONAME:
~/Desktop/dgemm$ ln -sf libopenblas.so libopenblas.so.0
then we export it:
~/Desktop/dgemm$ export LD_PRELOAD=$(pwd)/libopenblas.so.0
Note that a full path to libopenblas.so.0 needs be fed to LD_PRELOAD for a successful load, even if libopenblas.so.0 is under $(pwd).
Now we launch Rscript and check what happens by LD_DEBUG:
~/Desktop/dgemm$ LD_DEBUG=libs Rscript --default-packages=base --vanilla /dev/null |& grep blas
4860: calling init: /home/zheyuan/Desktop/dgemm/libopenblas.so
4860: calling init: /home/zheyuan/Desktop/dgemm/libopenblas.so
4865: calling init: /home/zheyuan/Desktop/dgemm/libopenblas.so
4868: calling fini: /home/zheyuan/Desktop/dgemm/libopenblas.so [0]
4870: calling init: /home/zheyuan/Desktop/dgemm/libopenblas.so
4869: calling init: /home/zheyuan/Desktop/dgemm/libopenblas.so
4867: calling fini: /home/zheyuan/Desktop/dgemm/libopenblas.so [0]
4860: find library=libblas.so.3 [0]; searching
4860: trying file=/usr/lib/R/lib/libblas.so.3
4860: trying file=/usr/lib/i386-linux-gnu/i686/sse2/libblas.so.3
4860: trying file=/usr/lib/i386-linux-gnu/i686/cmov/libblas.so.3
4860: trying file=/usr/lib/i386-linux-gnu/i686/libblas.so.3
4860: trying file=/usr/lib/i386-linux-gnu/sse2/libblas.so.3
4860: trying file=/usr/lib/i386-linux-gnu/libblas.so.3
4860: trying file=/usr/lib/jvm/java-7-openjdk-i386/jre/lib/i386/client/libblas.so.3
4860: trying file=/usr/lib/libblas.so.3
4860: calling init: /usr/lib/libblas.so.3
4860: calling init: /home/zheyuan/Desktop/dgemm/libopenblas.so
4874: calling init: /home/zheyuan/Desktop/dgemm/libopenblas.so
4876: calling init: /home/zheyuan/Desktop/dgemm/libopenblas.so
4860: calling fini: /home/zheyuan/Desktop/dgemm/libopenblas.so [0]
4860: calling fini: /usr/lib/libblas.so.3 [0]
Comparing with what we saw in solution 1 by cheating R with our own version of libblas.so.3, we can see that
libopenblas.so.0 is loaded first, hence found first by Rscript;
after libopenblas.so.0 is found, Rscript goes on searching and loading libblas.so.3. However, this will play no effect by the "first come, first serve" rule, explained in the original answer.
Good, everything works, so we test our mmperf.c program:
~/Desktop/dgemm$ Rscript --default-packages=base --vanilla mmperf.R
GFLOPs = 9.62
The outcome 9.62 is bigger than 8.77 we saw in the earlier solution merely by chance. As a test for using OpenBLAS we don't run the experiment many times for preciser result.
Then as usual, we unset environment variable in the end:
~/Desktop/dgemm$ unset LD_PRELOAD
*********************
Solution 1:
*********************
Thanks to Employed Russian, my problem is finally solved. The investigation requires important skills in Linux system debugging and patching, and I believe this is a great asset I learned. Here I would post a solution, as well as correcting several points in my original post.
1 About invoking R
In my original post, I mentioned there are two ways to launch R, either via R or Rscript. However, I have wrongly exaggerated their difference. Let's now investigate their start-up process, via an important Linux debugging facility strace (see man strace). There are actually lots of interesting things happening after we type a command in the shell, and we can use
strace -e trace=process [command]
to trace all system calls involving process management. As a result we can watch the fork, wait, and execution steps of a process. Though not stated in the manual page, #Employed Russian shows that it is possible to specify only a subclass of process, for example, execve for the execution steps.
For R we have
~/Desktop/dgemm$ time strace -e trace=execve R --vanilla < /dev/null > /dev/null
execve("/usr/bin/R", ["R", "--vanilla"], [/* 70 vars */]) = 0
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=5777, si_status=0, si_utime=0, si_stime=0} ---
execve("/usr/lib/R/bin/exec/R", ["/usr/lib/R/bin/exec/R", "--vanilla"], [/* 79 vars */]) = 0
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=5778, si_status=0, si_utime=0, si_stime=0} ---
+++ exited with 0 +++
real 0m0.345s
user 0m0.256s
sys 0m0.068s
while for Rscript we have
~/Desktop/dgemm$ time strace -e trace=execve Rscript --default-packages=base --vanilla /dev/null
execve("/usr/bin/Rscript", ["Rscript", "--default-packages=base", "--vanilla", "/dev/null"], [/* 70 vars */]) = 0
execve("/usr/lib/R/bin/R", ["/usr/lib/R/bin/R", "--slave", "--no-restore", "--vanilla", "--file=/dev/null"], [/* 71 vars */]) = 0
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=5822, si_status=0, si_utime=0, si_stime=0} ---
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=5823, si_status=0, si_utime=0, si_stime=0} ---
execve("/usr/lib/R/bin/exec/R", ["/usr/lib/R/bin/exec/R", "--slave", "--no-restore", "--vanilla", "--file=/dev/null"], [/* 80 vars */]) = 0
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=5827, si_status=0, si_utime=0, si_stime=0} ---
+++ exited with 0 +++
real 0m0.063s
user 0m0.020s
sys 0m0.028s
We have also used time to measure the start-up time. Note that
Rscript is about 5.5 times faster than R. One reason is that R will load 6 default packages on start-up, while Rscript only loads one base package by control: --default-packages=base. But it is still much faster even without this setting.
In the end both start-up processes are directed to $(R RHOME)/bin/exec/R, and in my original post, I have already exploited readelf -d to show that this executable will load libR.so, which are linked with libblas.so.3. According to #Employed Russian's explanation, the BLAS library loaded first will win, so there is no way my original method will work.
To successfully run strace, we have used the amazing file /dev/null as input file and output file when necessary. For example, Rscript demands an input file, while R demands both. We feed the null device to both to make the command run smoothly and the output clean. The null device is a physically existing file, but works amazingly. When reading from it, it contains nothing; while writing to it, it discards everything.
2. Cheat R
Now since libblas.so will be loaded anyway, the only thing we can do is to provide our own version of this library. As I have said in the original post, if we have root access, this is really easy, by using update-alternatives --config libblas.so.3, so that the system Linux will help us complete this switch. But #Employed Russian offers an awesome way to cheat the system without root access: let's check how R finds BLAS library on start-up, and make sure we feed our version before the system default is found! To monitor how shared libraries are found and loaded, use environment variable LD_DEBUG.
There are a number of Linux environment variables with prefix LD_, as documented in man ld.so. These variables can be assigned before an executable, so that we can change the running feature of a program. Some useful variables include:
LD_LIBRARY_PATH for setting run time library search path;
LD_DEBUG for tracing look-up and loading of shared libraries;
LD_TRACE_LOADED_OBJECTS for displaying all loaded library by a program (behaves similar to ldd);
LD_PRELOAD for forcing injecting a library to a program at the very start, before all other libraries are looked for;
LD_PROFILE and LD_PROFILE_OUTPUT for profiling one specified shared library. R user who have read section 3.4.1.1 sprof of Writing R extensions should recall that this is used for profiling compiled code from within R.
The use of LD_DEBUG can be seen by:
~/Desktop/dgemm$ LD_DEBUG=help cat
Valid options for the LD_DEBUG environment variable are:
libs display library search paths
reloc display relocation processing
files display progress for input file
symbols display symbol table processing
bindings display information about symbol binding
versions display version dependencies
scopes display scope information
all all previous options combined
statistics display relocation statistics
unused determined unused DSOs
help display this help message and exit
To direct the debugging output into a file instead of standard output a filename can be specified using the LD_DEBUG_OUTPUT environment variable.
Here we are particularly interested in using LD_DEBUG=libs. For example,
~/Desktop/dgemm$ LD_DEBUG=libs Rscript --default-packages=base --vanilla /dev/null |& grep blas
5974: find library=libblas.so.3 [0]; searching
5974: trying file=/usr/lib/R/lib/libblas.so.3
5974: trying file=/usr/lib/i386-linux-gnu/i686/sse2/libblas.so.3
5974: trying file=/usr/lib/i386-linux-gnu/i686/cmov/libblas.so.3
5974: trying file=/usr/lib/i386-linux-gnu/i686/libblas.so.3
5974: trying file=/usr/lib/i386-linux-gnu/sse2/libblas.so.3
5974: trying file=/usr/lib/i386-linux-gnu/libblas.so.3
5974: trying file=/usr/lib/jvm/java-7-openjdk-i386/jre/lib/i386/client/libblas.so.3
5974: trying file=/usr/lib/libblas.so.3
5974: calling init: /usr/lib/libblas.so.3
5974: calling fini: /usr/lib/libblas.so.3 [0]
shows various attempts that R program tried to locate and load libblas.so.3. So if we could provide our own version of libblas.so.3, and make sure R finds it first, then the problem is solved.
Let's first make a symbolic link libblas.so.3 in our working path to the OpenBLAS library libopenblas.so, then expand default LD_LIBRARY_PATH with our working path (and export it):
~/Desktop/dgemm$ ln -sf libopenblas.so libblas.so.3
~/Desktop/dgemm$ export LD_LIBRARY_PATH = $(pwd):$LD_LIBRARY_PATH ## put our working path at top
Now let's check again the library loading process:
~/Desktop/dgemm$ LD_DEBUG=libs Rscript --default-packages=base --vanilla /dev/null |& grep blas
6063: find library=libblas.so.3 [0]; searching
6063: trying file=/usr/lib/R/lib/libblas.so.3
6063: trying file=/usr/lib/i386-linux-gnu/i686/sse2/libblas.so.3
6063: trying file=/usr/lib/i386-linux-gnu/i686/cmov/libblas.so.3
6063: trying file=/usr/lib/i386-linux-gnu/i686/libblas.so.3
6063: trying file=/usr/lib/i386-linux-gnu/sse2/libblas.so.3
6063: trying file=/usr/lib/i386-linux-gnu/libblas.so.3
6063: trying file=/usr/lib/jvm/java-7-openjdk-i386/jre/lib/i386/client/libblas.so.3
6063: trying file=/home/zheyuan/Desktop/dgemm/libblas.so.3
6063: calling init: /home/zheyuan/Desktop/dgemm/libblas.so.3
6063: calling fini: /home/zheyuan/Desktop/dgemm/libblas.so.3 [0]
Great! We have successfully cheated R.
3. Experiment with OpenBLAS
~/Desktop/dgemm$ Rscript --default-packages=base --vanilla mmperf.R
GFLOPs = 8.77
Now, everything works as expected!
4. Unset LD_LIBRARY_PATH (to be safe)
It is a good practice to unset LD_LIBRARY_PATH after use.
~/Desktop/dgemm$ unset LD_LIBRARY_PATH

Waveform file not running under simulation

When I click under the button Run functional Simulation, I see this error:
Determining the location of the ModelSim executable...
Using: C:\altera\13.1\modelsim_ase\win32aloem
To specify a ModelSim executable directory, select: Tools -> Options -> EDA Tool Options
Note: if both ModelSim-Altera and ModelSim executables are available, ModelSim-Altera will be used.
**** Generating the ModelSim Testbench ****
quartus_eda --gen_testbench --check_outputs=on --tool=modelsim_oem --format=verilog ejem_1 -c ejem_1 --vector_source=I:/5 Semestre/Arquitectura Computacional/Ejem_1 - 18-02-15/Waveform1.vwf --testbench_file=I:/5 Semestre/Arquitectura Computacional/Ejem_1 - 18-02-15/simulation/qsim/Waveform1.vwf.vt
Error (23028): Unknown argument "Semestre/Arquitectura". Refer to --help for legal arguments.
Usage:
------
quartus_eda [-h | --help[=] | -v]
quartus_eda []
quartus_eda -t
Error.
This is the directory of ModelSim-Altera.
I'm working with Quartus 13.1 Cyclone III
C:\altera\13.1\modelsim_ase\win32aloem
How can I solve this problem?
Quartus is pretty stupid when it comes to spaces in directory names. Your path has multiple spaces
.../Arquitectura Computacional/Ejem_1 - 18-02-15/...
Try to build your project inside a no space directory path like
C:/altera/projects/my_project

cmake & Qt4: Cannot specify link libraries for target

Following some hello world with qt and cmake, this is my fold structure:
CMakeLists.txt
main.cpp
ui/mainwindow.ui
src/mainwindow.cpp
include/mainwindow.h
and this is CMakeList.txt:
cmake_minimum_required (VERSION 2.8)
# Project
set(PROJECTNAME "Hello")
project(${PROJECTNAME} C CXX)
set(${PROJECTNAME}_MAJOR_VERSION 0)
set(${PROJECTNAME}_MINOR_VERSION 1)
# qt
find_package(Qt4 REQUIRED)
set (QT_USE_QTMAIN TRUE)
include (${QT_USE_FILE})
add_definitions(${QT_DEFINITIONS})
# compilers
#set(CMAKE_CXX_FLAGS "-Wall -std=gnu++0x")
# files
include_directories(${CMAKE_CURRENT_BINARY_DIR})
include_directories(src)
include_directories(include)
set(${PROJECTNAME}_SOURCES
main.cpp
src/mainwindow.cpp
)
set(${PROJECTNAME}_HEADERS
include/mainwindow.h
)
set(${PROJECTNAME}_HEADERS_MOC
include/mainwindow.h
)
set(${PROJECTNAME}_FORMS
ui/mainwindow.ui
)
QT4_WRAP_CPP(${PROJECTNAME}_HEADERS_MOC ${${PROJECTNAME}_HEADERS_MOC})
QT4_WRAP_UI(${PROJECTNAME}_FORMS_HEADERS ${${PROJECTNAME}_FORMS})
QT4_ADD_RESOURCES(${PROJECTNAME}_RESOURCES_RCC ${${PROJECTNAME}_RESOURCES})
# executables and installation
add_executable (
${${PROJECTNAME}_HEADERS}
${${PROJECTNAME}_SOURCES}
${${PROJECTNAME}_HEADERS_MOC}
${${PROJECTNAME}_FORMS_HEADERS}
)
target_link_libraries(${PROJECTNAME} ${QT_LIBRARIES})
tried different ways of add target_link_libraries but still get:
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Looking for Q_WS_X11
-- Looking for Q_WS_X11 - found
-- Looking for Q_WS_WIN
-- Looking for Q_WS_WIN - not found.
-- Looking for Q_WS_QWS
-- Looking for Q_WS_QWS - not found.
-- Looking for Q_WS_MAC
-- Looking for Q_WS_MAC - not found.
-- Found Qt4: /usr/bin/qmake (found version "4.8.1")
CMake Error at CMakeLists.txt:61 (target_link_libraries):
Cannot specify link libraries for target "Hello" which is not built by
this project.
-- Configuring incomplete, errors occurred!
You are missing the target name as the first parameter to add_executable.
add_executable(
${PROJECTNAME}
${${PROJECTNAME}_HEADERS}
${${PROJECTNAME}_SOURCES}
${${PROJECTNAME}_HEADERS_MOC}
${${PROJECTNAME}_FORMS_HEADERS}
)

Resources