singularity relocation error when sourcing file in environment section - singularity-container

I'm trying to create a Singularity image for some application software that normally builds into a single directory. To use after building, you source a setup file "env.sh" that sets a bunch of environment variables including modifying PATH and LD_LIBRARY_PATH.
If my recipe looks like this:
Bootstrap: docker
From: ubuntu:20.04
%files
/path/to/myapp /opt/myapp
%post
cd /opt/myapp && make
%environment
. /opt/myapp/env.sh
so that env.sh is sourced automatically on launching the image, I get the following error:
Singularity runtime parent: relocation error: /lib/x86_64-linux-gnu/libnss_files.so.2: symbol __libc_readline_unlocked, version GLIBC_PRIVATE not defined in file libc.so.6 with link time reference
However, if I remove the %environment section from the recipe, then manually call . /opt/myapp/env.sh after invoking singularity shell, everything works as expected.
Given that the environment script is not doing anything other than setting some environment variables, why am I getting this error?

Related

How to fix libtool: undefined symbols not allowed in x86_64-pc-msys shared

I am trying to build heimdal package for msys2. To my dismay, during linking of the first constituent library, roken, dlls fail to be built, and that causes sort of a chain reaction further on.
The only message i get is:
libtool: undefined symbols not allowed in x86_64-pc-msys shared ... only static will be built
however, there is no information provided on what symbols are undefined. How can i find that out?
If i turn on output of commands wuth make V=1 i get libtool command that links from a large numbert of .lo files. If i try to run gcc over them (copying command from there), it does not recognize them as anything.
I am trying to follow instructions as outlined in msys2 package build script for heimdal.
On Windows building a shared library while allowing undefined symbols is not allowed.
Try to build with the -Wl,-no-undefined linker flag, for example by adding LDFLAGS="-Wl,-no-undefined" to the ./configure command.
If that didn't work try this after ./configure and before make:
sed -i.bak -e "s/\(allow_undefined=\)yes/\1no/" libtool
If you already had a failed build earlier you should also clean up any .la files like this before running make again:
rm $(find -name '*.la')

Yocto load kernel module

I try to add a kernel module to a yocto image and load it on boot.
I create a recipe to build and install a kernel module. Here's a part of the Makefile content:
modules_install: test_driver.ko
install -d $(MODULES_DIR)
install -m 0755 $< $(MODULES_DIR)
In my build/conf/local.conf, I add the package (subsystem being the name of my module recipe):
IMAGE_INSTALL_append = " subsystem"
After building the image, I can find the .ko file inside the MODULES_DIR directory (being /lib/modules/(shell uname -r)/kernel/drivers/test).
I want to do now is to load this module on boot. I found some clues about KERNEL_MODULE_AUTOLOAD and MACHINE_ESSENTIAL_*/MACHINE_EXTRA_*.
So I try KERNEL_MODULE_AUTOLOAD += "subsystem" or even KERNEL_MODULE_AUTOLOAD += "test_driver" in build/conf/local.conf or in my module recipe, but I couldn't have the driver loaded on boot.
I'm working against the fsl-image-machine-test image (sumo version).
The KERNEL_MODULE_AUTOLOAD need to be outside of the local.conf file. I put it now in my module recipe.
It needs to load the name of the module not the recipe, in my case :
KERNEL_MODULE_AUTOLOAD += "test_driver".

Telegraf test input and output plugins error multiple conf files

Telegraf version: Telegraf v1.0.1
I have the following files:
/etc/telegraf/telegraf.conf
main config file (which you create/get for free while installing telegraf). This file doesn't have any [[output.<plugin>]] stanza in it but does have valid default inputs.xx plugins enabled.
/etc/telegraf/telegraf.d/1-company-output-plugin.conf
(This file has valid outputs.<pluginname> plugin).
/etc/telegraf/telegraf.d/telegraf-additional-inputs-plugins.conf
(this file has additional inputs.<pluginname> plugins that I want to keep separate from the main conf file).
Running sudo service telegraf status shows Telegraf is running [OK]! and log file /var/log/telegrag/telegraf.log (looks good too without showing any errors).
If I make any changes to one of the above configuration files, I want to test those changes made (before I restart telegraf), so I'm running the following commands with -test or --test option but I'm getting the following error:
ubuntu#jenkins:~/test_aks_dir$ telegraf --config /etc/telegraf/telegraf.conf -test
2017/01/10 22:45:48 E! Error: no outputs found, did you provide a valid config file?
ubuntu#jenkins:~/test_aks_dir$ telegraf --config /etc/telegraf/telegraf.conf --test
2017/01/10 22:45:51 E! Error: no outputs found, did you provide a valid config file?
As you see above, both optons -test or --test worked but also gave a valid error message above.
As the above error was for not providing any configuration stanza for [[outputs.<plugin>]], I provided another --config file paramter for the file which contains the outputs plugin stanza, but now it gave an error for the missing inputs. file:
ubuntu#jenkins:~/test_aks_dir$ telegraf --config /etc/telegraf/telegraf.conf --config /etc/telegraf/telegraf.d/1-company-output-plugin.conf --test
2017/01/10 22:48:30 E! Error: no inputs found, did you provide a valid config file?
ubuntu#jenkins:~/test_aks_dir$
Note: The above command didn't error for providing multiple --config <someConfigFile> parameter values.
The same error comes if I want to test any change in the 3rd file : (/etc/telegraf/telegraf.d/telegraf-additional-inputs-plugins.conf)
How can I test an individual or selective configuration file changes using telegraf assuming I have multiple files here: /etc/telegraf/telegraf.d/*.conf ?
this is not possible at the moment, the only way to do it would be to specify the entire config directory

generate CMakeList.text for OS X

I'm trying to create a plugin for OBS using C, and compiling it using cmake .. && make see - https://github.com/jp9000/obs-studio/wiki/Install-Instructions#mac-osx
when running cmake .. && make from cmd it gives me an error that cmake: command not found and when I run it from the program it gives me an error - CMake Error: The source directory "/Users/gerwin/Desktop/soOBS" does not appear to contain CMakeList.text specify --help for usage, or press the help button on the cmake GUI
How can I generate a CMakeList.Text to compile my soOBS script to a .so file?
One problem is that cmake is not in your path. So, if you type cmake from your command line it cannot be found. The other problem is that you are not specifying correctly your source directory: you have to specify as source directory the location of the main/root CMakeLists.txt.
So, proceed as follow:
Locate your cmake executable, obtaining your <full path to cmake>
Open a shell
Go to your source directory (location of the main/root of obs-studio CMakeLists.txt)
mkdir build
cd build
<full path to cmake> ..The first argument .. is your source directory, location of the main CMakeLists.txt
make

What is cmake_install.cmake

I wrote a very simple HelloWorld.c program and ran Cmake. It created a cmake_install.cmake file in my build directory. Can somebody explain to me why CMake generated the file cmake_install.cmake? What is it's purpose and how can I use it?
CMakelists.txt :
cmake_minimum_required(VERSION 3.0)
PROJECT(FirstExample)
add_executable(prog first.c)
Thanks!
You generally don't use cmake_install.cmake directly. From the v3.12 page it states:
The install() command generates a file, cmake_install.cmake, inside
the build directory, which is used internally by the generated install
target and by CPack.
With your current CMakeLists.txt, the generated file doesn't do much. To create a useful install you would need to add more INSTALL commands to your CMakeLists.txt using the syntax below.
INSTALL(TARGETS targets... [EXPORT <export-name>]
[[ARCHIVE|LIBRARY|RUNTIME|FRAMEWORK|BUNDLE|
PRIVATE_HEADER|PUBLIC_HEADER|RESOURCE]
[DESTINATION <dir>]
[INCLUDES DESTINATION [<dir> ...]]
[PERMISSIONS permissions...]
[CONFIGURATIONS [Debug|Release|...]]
[COMPONENT <component>]
[OPTIONAL] [NAMELINK_ONLY|NAMELINK_SKIP]
] [...])
For further reading on this command, check out the documentation site and wiki.
If it's desired to manually execute the script as stated by Nic30g the 3.12 page states that cmake -P accepts the following variables:
COMPONENT
Set this variable to install only a single CPack component as opposed to all of them. For example, if you only want to install the Development component, run
cmake -DCOMPONENT=Development -P cmake_install.cmake
BUILD_TYPE
Set this variable to change the build type if you are using a multi-config generator. For example, to install with the Debug configuration, run
cmake -DBUILD_TYPE=Debug -P cmake_install.cmake.
DESTDIR
This is an environment variable rather than a CMake variable. It allows you to change the installation prefix on UNIX systems. See DESTDIR for details.
As previous answer tells, the cmake_install.cmake contains the commands generated by install command from your CMakeLists.txt.
You can execute it by cmake -P cmake_install.cmake and it performs the installation of your project even on windows.
https://cmake.org/pipermail/cmake/2007-April/013657.html