Ansible task fails, but same command works manually [closed] - ansible

Closed. This question is not about programming or software development. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed yesterday.
Improve this question
I'm running command in Ansible task, as you can clearly see its configuring tomcat-native:
- name: configure tomcat apr native library
become_user: root
become: true
shell: "./configure --with-ssl=/usr/local/ssl --with-java-home=/usr/lib/jvm/java-11-amazon-corretto"
chdir: "/opt/tomcat/bin/tomcat-native-1.2.23-src/native"
register: configureoutput
Which gives me the following output:
TASK [../../../../roles/ghi.install_apr_tomcat : configure tomcat apr native library] ***
changed: [aps01]
changed: [aps02]
TASK [../../../../roles/ghi.install_apr_tomcat : debug] ************************
ok: [aps01] => {
"configureoutput": {
"changed": true,
"cmd": "./configure --with-ssl=/usr/local/ssl --with-java-home=/usr/lib/jvm/java-11-amazon-corretto",
"delta": "0:00:00.712919",
"end": "2023-02-17 21:14:13.094244",
"failed": false,
"rc": 0,
"start": "2023-02-17 21:14:12.381325",
"stderr": "./configure: line 3139: cd: /bin/apr-1-config//usr/lib64/apr-1/build: Not a directory\ncp: cannot stat '/apr_rules.mk': No such file or directory",
"stderr_lines": [
"./configure: line 3139: cd: /bin/apr-1-config//usr/lib64/apr-1/build: Not a directory",
"cp: cannot stat '/apr_rules.mk': No such file or directory"
],
"stdout": "checking build system type... x86_64-pc-linux-gnu\nchecking host system type... x86_64-pc-linux-gnu\nchecking target system type... x86_64-pc-linux-gnu\nchecking for a BSD-compatible install... /bin/install -c\nchecking for working mkdir -p... yes\nTomcat Native Version: 1.2.36\nchecking for chosen layout... tcnative\nchecking for APR... yes\nconfigure: APR 1.7.2 detected.\n setting CC to \"gcc\"\n setting CPP to \"gcc -E\"\nchecking JAVA_HOME... /usr/lib/jvm/java-11-amazon-corretto\n adding \"-I/usr/lib/jvm/java-11-amazon-corretto/include\" to TCNATIVE_PRIV_INCLUDES\nchecking for JDK os include directory... linux\n adding \"-I/usr/lib/jvm/java-11-amazon-corretto/include/linux\" to TCNATIVE_PRIV_INCLUDES\nchecking for gcc... gcc\nchecking whether the C compiler works... yes\nchecking for C compiler default output file name... a.out\nchecking for suffix of executables... \nchecking whether we are cross compiling... no\nchecking for suffix of object files... o\nchecking whether the compiler supports GNU C... yes\nchecking whether gcc accepts -g... yes\nchecking for gcc option to enable C11 features... none needed\nchecking for OpenSSL library... using openssl from /usr/local/ssl/lib and /usr/local/ssl/include\nchecking OpenSSL library version >= 1.0.2... ok\nchecking for OpenSSL DSA support... no\n adding \"-I/usr/local/ssl/include\" to TCNATIVE_PRIV_INCLUDES\n setting TCNATIVE_LDFLAGS to \"-L/usr/local/ssl/lib -Wl,-rpath,/usr/local/ssl/lib -lssl -lcrypto\"\n adding \"-DHAVE_OPENSSL\" to CFLAGS\n setting TCNATIVE_LIBS to \"\"\n setting TCNATIVE_LIBS to \" -L/bin/apr-1-config//usr/lib64 -lapr-1 -lpthread -ldl\"\n adding \"-DTCNATIVE_LINUX\" to CFLAGS\nchecking for apr_pollset_wakeup in -lapr-1... no\nconfigure: creating ./config.status\nconfig.status: creating Makefile\nconfig.status: executing default commands",
"stdout_lines": [
"checking build system type... x86_64-pc-linux-gnu",
"checking host system type... x86_64-pc-linux-gnu",
"checking target system type... x86_64-pc-linux-gnu",
"checking for a BSD-compatible install... /bin/install -c",
"checking for working mkdir -p... yes",
"Tomcat Native Version: 1.2.36",
"checking for chosen layout... tcnative",
"checking for APR... yes",
"configure: APR 1.7.2 detected.",
" setting CC to \"gcc\"",
" setting CPP to \"gcc -E\"",
"checking JAVA_HOME... /usr/lib/jvm/java-11-amazon-corretto",
" adding \"-I/usr/lib/jvm/java-11-amazon-corretto/include\" to TCNATIVE_PRIV_INCLUDES",
"checking for JDK os include directory... linux",
" adding \"-I/usr/lib/jvm/java-11-amazon-corretto/include/linux\" to TCNATIVE_PRIV_INCLUDES",
"checking for gcc... gcc",
"checking whether the C compiler works... yes",
"checking for C compiler default output file name... a.out",
"checking for suffix of executables... ",
"checking whether we are cross compiling... no",
"checking for suffix of object files... o",
"checking whether the compiler supports GNU C... yes",
"checking whether gcc accepts -g... yes",
"checking for gcc option to enable C11 features... none needed",
"checking for OpenSSL library... using openssl from /usr/local/ssl/lib and /usr/local/ssl/include",
"checking OpenSSL library version >= 1.0.2... ok",
"checking for OpenSSL DSA support... no",
" adding \"-I/usr/local/ssl/include\" to TCNATIVE_PRIV_INCLUDES",
" setting TCNATIVE_LDFLAGS to \"-L/usr/local/ssl/lib -Wl,-rpath,/usr/local/ssl/lib -lssl -lcrypto\"",
" adding \"-DHAVE_OPENSSL\" to CFLAGS",
" setting TCNATIVE_LIBS to \"\"",
" setting TCNATIVE_LIBS to \" -L/bin/apr-1-config//usr/lib64 -lapr-1 -lpthread -ldl\"",
" adding \"-DTCNATIVE_LINUX\" to CFLAGS",
"checking for apr_pollset_wakeup in -lapr-1... no",
"configure: creating ./config.status",
"config.status: creating Makefile",
"config.status: executing default commands"
]
}
}
But the same command completes successfully when I run it manually (Makefile is created only when configure was successful):
[root#ip-############ native]# ./configure --with-ssl=/usr/local/ssl --with-java-home=/usr/lib/jvm/java-11-amazon-corretto
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking for working mkdir -p... yes
Tomcat Native Version: 1.2.36
checking for chosen layout... tcnative
checking for APR... yes
configure: APR 1.7.2 detected.
setting CC to "gcc"
setting CPP to "gcc -E"
checking JAVA_HOME... /usr/lib/jvm/java-11-amazon-corretto
adding "-I/usr/lib/jvm/java-11-amazon-corretto/include" to TCNATIVE_PRIV_INCLUDES
checking for JDK os include directory... linux
adding "-I/usr/lib/jvm/java-11-amazon-corretto/include/linux" to TCNATIVE_PRIV_INCLUDES
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C11 features... none needed
checking for OpenSSL library... using openssl from /usr/local/ssl/lib and /usr/local/ssl/include
checking OpenSSL library version >= 1.0.2... ok
checking for OpenSSL DSA support... no
adding "-I/usr/local/ssl/include" to TCNATIVE_PRIV_INCLUDES
setting TCNATIVE_LDFLAGS to "-L/usr/local/ssl/lib -Wl,-rpath,/usr/local/ssl/lib -lssl -lcrypto"
adding "-DHAVE_OPENSSL" to CFLAGS
setting TCNATIVE_LIBS to ""
setting TCNATIVE_LIBS to " /usr/lib64/libapr-1.la -lpthread -ldl"
adding "-DTCNATIVE_LINUX" to CFLAGS
checking for apr_pollset_wakeup in -lapr-1... yes
adding "-DHAVE_POLLSET_WAKEUP" to CFLAGS
configure: creating ./config.status
config.status: creating Makefile
config.status: executing default commands
[root#ip-############ native]# ls -la
total 336
drwxrwxr-x 7 tomcat tomcat 4096 Feb 17 21:47 .
drwxrwxr-x 8 tomcat tomcat 304 Feb 8 15:52 ..
drwxrwxr-x 3 tomcat tomcat 257 Feb 17 21:47 build
-rwxrwxr-x 1 tomcat tomcat 2946 Feb 8 15:52 buildconf
-rw-rw-r-- 1 tomcat tomcat 1098 Feb 8 15:52 build.conf
-rw-rw-r-- 1 tomcat tomcat 6191 Feb 8 15:52 BUILDING
-rw-rw-r-- 1 tomcat tomcat 3587 Feb 8 15:52 build-outputs.mk
-rw-rw-r-- 1 tomcat tomcat 8769 Feb 8 15:52 config.layout
-rw-r--r-- 1 root root 10260 Feb 17 21:47 config.log
-rwxr-xr-x 1 root root 146 Feb 17 21:47 config.nice
-rwxr-xr-x 1 root root 26231 Feb 17 21:47 config.status
-rwxrwxr-x 1 tomcat tomcat 170805 Feb 8 15:52 configure
-rw-rw-r-- 1 tomcat tomcat 7269 Feb 8 15:52 configure.in
drwxrwxr-x 2 tomcat tomcat 78 Feb 8 15:52 include
-rw-rw-r-- 1 tomcat tomcat 6845 Feb 8 15:52 libtcnative.dsp
-rw-rw-r-- 1 tomcat tomcat 1214 Feb 8 15:52 libtcnative.dsw
-rw-rw-r-- 1 tomcat tomcat 17499 Feb 8 15:52 LICENSE.bin.win
-rw-r--r-- 1 root root 2766 Feb 17 21:47 Makefile
-rw-rw-r-- 1 tomcat tomcat 2376 Feb 8 15:52 Makefile.in
-rw-rw-r-- 1 tomcat tomcat 5413 Feb 8 15:52 NMAKEmakefile
-rw-rw-r-- 1 tomcat tomcat 9745 Feb 8 15:52 NMAKEmakefile.inc
-rw-rw-r-- 1 tomcat tomcat 695 Feb 8 15:52 NOTICE.bin.win
drwxrwxr-x 4 tomcat tomcat 31 Feb 8 15:52 os
drwxrwxr-x 2 tomcat tomcat 4096 Feb 8 15:52 src
drwxrwxr-x 4 tomcat tomcat 64 Feb 8 15:52 srclib
-rw-rw-r-- 1 tomcat tomcat 6833 Feb 8 15:52 tcnative.dsp
-rw-rw-r-- 1 tomcat tomcat 2833 Feb 8 15:52 tcnative.spec
And the most fun thing is: my task was working on February 10-th (merged into main branch), then somebody tried to deploy this code on February 15-th and it failed. Commit hash is the same, no MR/PR was merged into main branch.
Does anyone have detective skillzZz?
edit:
One more important thing to notice:
Ansible stderr says -
"stderr": "./configure: line 3139: cd: /bin/apr-1-config//usr/lib64/apr-1/build: Not a directory\ncp: cannot stat '/apr_rules.mk': No such file or directory",
if we look into that file, we'll see
[root#ip-172-24-8-48 ~]# sed -n 3139p /opt/tomcat/bin/tomcat-native-1.2.36-src/native/configure
APR_BUILD_DIR="`cd $APR_BUILD_DIR && pwd`"
So, the root of the problem might be it. For some reason Ansible calculating value for APR_BUILD_DIR in a wrong way. I don't get it. It's official tars from Tomcat website and I'm installing them in a required way.

Q: "cannot stat '/apr_rules.mk': No such file or directory"
A: The error is:
"stderr": "./configure: line 3139: cd: /bin/apr-1-config//usr/lib64/apr-1/build: Not a directory\ncp: cannot stat '/apr_rules.mk': No such file or directory",
You should find out why /apr_rules.mk is missing.
chdir is not a keyword it is parameter of the module shell. If you ran the task
- name: configure tomcat apr native library
become_user: root
become: true
shell: "./configure --with-ssl=/usr/local/ssl --with-java-home=/usr/lib/jvm/java-11-amazon-corretto"
chdir: "/opt/tomcat/bin/tomcat-native-1.2.23-src/native"
register: configureoutput
you must have seen this error:
ERROR! conflicting action statements: shell, chdir
The correct syntax is chdir nested as a parameter of shell
- name: configure tomcat apr native library
become_user: root
become: true
shell: "./configure --with-ssl=/usr/local/ssl --with-java-home=/usr/lib/jvm/java-11-amazon-corretto"
chdir: "/opt/tomcat/bin/tomcat-native-1.2.23-src/native"
register: configureoutput

Related

Unable to compile ESP-IDF example project

I'm trying to compile my first ESP32 example project.
I set up Visual Studio Code with all the latest tools. (Python, toolschain, etc).
I'm not sure what exactly I need as I'm new in this environment, so maybe I missed something.
I followed the user guide on how to create and compile the first project, I used the Blink project from the example folder.
Here is what I get.
> Executing task: cmake -G Ninja .. <
-- Project is not inside a git repository, or git repository has no commits; will not use 'git describe' to determine PROJECT_VER.
-- Building ESP-IDF components for target esp32s2
-- Checking Python dependencies...
Python requirements from C:\Users\dmitryke\esp\esp-idf\requirements.txt are satisfied.
-- Project sdkconfig file C:/ESP32_projects/blink/sdkconfig
Loading defaults file C:/ESP32_projects/blink/sdkconfig.defaults...
-- Components:
-- Component paths:
-- Configuring done
-- Generating done
-- Build files have been written to C:/ESP32_projects/blink/build
The terminal will be reused by tasks, press any key to close it.
> Executing task: cmake --build . <
[1/1] Linking C executable blink.elf
FAILED: blink.elf
cmd.exe /C "cd . && C:\Users\dmitryke\.espressif\tools\xtensa-esp32s2-elf\esp-2020r3-8.4.0\xtensa-esp32s2-elf\bin\xtensa-esp32s2-elf-gcc.exe -mlongcalls CMakeFiles/blink.elf.dir/project_elf_src.c.obj -o blink.elf -Wl,--cref -Wl,--Map=C:/ESP32_projects/blink/build/blink.map -fno-rtti -fno-lto && cd ."
c:/users/dmitryke/.espressif/tools/xtensa-esp32s2-elf/esp-2020r3-8.4.0/xtensa-esp32s2-elf/bin/../lib/gcc/xtensa-esp32s2-elf/8.4.0/../../../../xtensa-esp32s2-elf/bin/ld.exe: c:/users/dmitryke/.espressif/tools/xtensa-esp32s2-elf/esp-2020r3-8.4.0/xtensa-esp32s2-elf/bin/../lib/gcc/xtensa-esp32s2-elf/8.4.0/../../../../xtensa-esp32s2-elf/lib/no-rtti/crt0.o:(.literal+0x0): undefined reference to `main'
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
The terminal process "C:\windows\System32\WindowsPowerShell\v1.0\powershell.exe -Command cmake --build ." terminated with exit code: 1.
Terminal will be reused by tasks, press any key to close it.
I removed everything from the blink.c to avoid code errors.
blink.c
#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "driver/gpio.h"
#include "sdkconfig.h"
/* Can use project configuration menu (idf.py menuconfig) to choose the GPIO to blink,
or you can edit the following line and set a number here.
*/
#define BLINK_GPIO 0x01
void app_main(void)
{
while(1) { }
}
Another issue, there is an option to run idf.py menuconfig.
Sometimes it works and sometimes it says:
C:\ESP32_projects\blink>idf.py menuconfig
'idf.py' is not recognized as an internal or external command,
operable program or batch file.
Any help will be appreciated!
All ESP IDF tasks (cmake, idf.py, etc) must be run inside a prepared environment. I would start by losing the VSC (because it's just another potential failure point) and using the basic ESP IDF command prompt. Try running idf.py menuconfig, idf.py build and idf.py -p COMx flash for configuring, building and flashing your test project.
Once you've verified that the ESP IDF environment and your project works, go back to VSC and see what's wrong there.
As a working example, this is how I compile the same sample project on my machine (Linux, ESP IDF v4.2.1) from scratch:
$ cp -r ~/esp-idf/examples/get-started/blink/ .
$ cd blink
$ idf.py build
Running cmake in directory /home/tarmo/tmp/espidftest/blink/build
Executing "cmake -G Ninja -DPYTHON_DEPS_CHECKED=1 -DESP_PLATFORM=1 -DCCACHE_ENABLE=0 /home/tarmo/tmp/espidftest/blink"...
-- Found Git: /usr/bin/git (found version "2.30.2")
-- IDF_TARGET not set, using default target: esp32
-- The C compiler identification is GNU 8.4.0
-- The CXX compiler identification is GNU 8.4.0
[SNIP]
esptool.py v3.0
Generated /home/tarmo/tmp/espidftest/blink/build/bootloader/bootloader.bin
[934/934] Generating binary image from built executable
esptool.py v3.0
Generated /home/tarmo/tmp/espidftest/blink/build/blink.bin
Project build complete. To flash, run this command:
/home/tarmo/espressif/python_env/idf4.2_py3.9_env/bin/python ../esp-idf/components/esptool_py/esptool/esptool.py -p (PORT) -b 921600 --before default_reset
--after hard_reset --chip esp32 write_flash --flash_mode dio --flash_size detect --flash_freq 40m 0x1000 build/bootloader/bootloader.bin 0x8000 build/partition_table/partition-table.bin 0x10000 build/blink.bin
or run 'idf.py -p (PORT) flash'
$ ls -lha
drwxr-xr-x 8 tarmo tarmo 4,0K juuni 4 12:26 build
-rw-r--r-- 1 tarmo tarmo 234 juuni 4 12:25 CMakeLists.txt
-rw-r--r-- 1 tarmo tarmo 1,5K juuni 4 12:25 example_test.py
drwxr-xr-x 3 tarmo tarmo 4,0K juuni 4 12:26 main
-rw-r--r-- 1 tarmo tarmo 177 juuni 4 12:25 Makefile
-rw-r--r-- 1 tarmo tarmo 157 juuni 4 12:25 README.md
-rw-r--r-- 1 tarmo tarmo 33K juuni 4 12:25 sdkconfig
-rw-r--r-- 1 tarmo tarmo 3 juuni 4 12:25 sdkconfig.defaults
The command window is less concerning, i got it working.
My main problem is main not being linked.
I had the same problem with building the ESP-project in VS Code, but found a solution: The project needs to be created in a folder with a different name than the example name.
I tried the blink project and it works when creating it in c:\esp-idf\ rather than in c:\esp-idf\blink. The latter will make a folder named blink within the blink folder.
You can add this code to your main(), checking your esp-idf environment first:
gpio_reset_pin(BLINK_GPIO);
gpio_set_direction(BLINK_GPIO, GPIO_MODE_OUTPUT);
while(1) {
printf("Turning off the LED\n");
gpio_set_level(BLINK_GPIO, 0);
vTaskDelay(1000 / portTICK_PERIOD_MS);
printf("Turning on the LED\n");
gpio_set_level(BLINK_GPIO, 1);
vTaskDelay(1000 / portTICK_PERIOD_MS);
}
Don't forget to close the previous terminal and open it again.

Error When Importing ROS Projects & Workspace in CLion

I wanted to give CLion a try for working with the ROS source code. I created a ROS Workspace and have the following folder structure:
joesan#joesan-InfinityBook-S-14-v5:~/Projects/Private/ros-projects$ cd catkin_ws/
drwxrwxr-x joesan joesan 4 KB Sun Aug 30 10:48:27 2020  .
drwxrwxr-x joesan joesan 4 KB Sun Aug 30 10:48:10 2020  ..
.rw-rw-r-- joesan joesan 98 B Sun Aug 30 10:48:27 2020  .catkin_workspace
drwxrwxr-x joesan joesan 4 KB Sun Aug 30 10:48:27 2020  build
drwxrwxr-x joesan joesan 4 KB Sun Aug 30 10:48:26 2020  devel
drwxrwxr-x joesan joesan 4 KB Sun Aug 30 12:13:50 2020  src
joesan#joesan-InfinityBook-S-14-v5:~/Projects/Private/ros-projects/catkin_ws$
I have sourced this location in the .bash_profile as below:
# Dynamically source all setup.bash files from multiple catkin ros workspaces
find /home/joesan/Projects/Private/ros-projects -wholename '*/devel/setup.bash' | xargs source
I then source the .bash_profile from within my .bashrc
Now, when I tried to open the project in CLion, I see the following error:
CMake Error at CMakeLists.txt:65 (message):
find_package(catkin) failed. catkin was neither found in the workspace nor
in the CMAKE_PREFIX_PATH. One reason may be that no ROS setup.sh was
sourced before.
I launch CLion via a Desktop shortcut entry that I created. How do I make CLion aware of this .bash_profile such that it can find catkin?
I managed to fix this by doing the following, but make sure that you have a Desktop entry created for Jetbrains CLion beforehand!
Open the jetbrains-clion.desktop located in the .local folder:
~/.local/share/applications/jetbrains-clion.desktop
In this desktop entry, modify the Exec= line as:
Exec=bash -i -c "/opt/softwares/clion-2020.2.1/bin/clion.sh" %f

AWS CodeDeploy script does not exist during AfterInstall hook

I am having trouble with executing my install_dependencies.sh script in AfterInstall hook-
it seems like my deployment-archive from which CodeDeploy agent is trying to run the scripts from does not yet exists during the AfterInstall hook.
I am getting this error that causes my deployment to fail:
ERROR [codedeploy-agent(2643)]: InstanceAgent::Plugins::CodeDeployPlugin::CommandPoller: Error during perform:
InstanceAgent::Plugins::CodeDeployPlugin::ScriptError -
Script does not exist at specified location: /opt/codedeploy-agent/deployment-root/432f58a2-27d7-46c0-8091-1625eb8733af/d-Q3DGM6LPU/deployment-archive/scripts/install_dependencies.sh -
/opt/codedeploy-agent/lib/instance_agent/plugins/codedeploy/hook_executor.rb:118:in `block (2 levels) in execute'...
my appspec.yml file looks like this:
version: 0.0
os: linux
files:
- source: /
destination: /home/ec2-user/myApp
hooks:
AfterInstall:
- location: scripts/install_dependencies.sh
timeout: 300
runas: root
ApplicationStop:
- location: scripts/stop_server.sh
timeout: 300
runas: root
ApplicationStart:
- location: scripts/start_server.sh
timeout: 300
runas: root
for accessing the deployment-archive folder after the failed deployment attempt, i do get files in their correct path (the same path that appeared in the Error log):
[ec2-user#ip-172-31-10-87 scripts]$ cd /opt/codedeploy-agent/deployment-root/432f58a2-27d7-46c0-8091-1625eb8733af/d-Q3DGM6LPU/deployment-archive/scripts/
[ec2-user#ip-172-31-10-87 scripts]$ ls -ln
total 12
-rwxrwxrwx 1 0 0 261 Aug 21 13:33 install_dependecies.sh
-rwxrwxrwx 1 0 0 69 Aug 21 13:33 start_server.sh
-rwxrwxrwx 1 0 0 56 Aug 21 13:33 stop_server.sh
my EC2 instance os is-
[ec2-user#ip-172-31-10-87 ~]$ cat /etc/issue
Amazon Linux AMI release 2018.03
[ec2-user#ip-172-31-10-87 ~]$ uname -a
Linux ip-172-31-10-87 4.14.62-65.117.amzn1.x86_64 #1 SMP Fri Aug 10 20:03:52
UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
I have already checked for execution permissions, and the content of my script files is empty (with only "exit 0" statement) in order to help sandbox the problem.
as far as i've seen in all examples- the scripts folder is expected to be in my deployed package and not outside of my deployment.
my appspec.yml is in the root folder of my project, and so is my scripts folder.
if I eliminate the AfterInstall/BeforeInstall hooks from my appspec- the problem does not occur.
What am i missing? why does these file are not accessible during the AfterInstall/BeforeInstall hooks?
please help,
thanks

How to fix symbol __vdso_clock_gettime, version GLIBC_PRIVATE not defined in file libc.so.6 with link time reference [duplicate]

This question already has answers here:
Multiple glibc libraries on a single host
(11 answers)
Closed 4 years ago.
when I try to fix the problem /lib64/libc.so.6: version 'GLIBC_2.14' not found in CentOS 6 system by install latest glibc version to my home directory, I found my computer crashed.
$ conda
/public/home/liuxs/anaconda3/bin/python: relocation error: /lib64/librt.so.1: symbol __vdso_clock_gettime, version GLIBC_PRIVATE not defined in file libc.so.6 with link time reference
$ python
python: relocation error: /lib64/librt.so.1: symbol __vdso_clock_gettime, version GLIBC_PRIVATE not defined in file libc.so.6 with link time reference
I try my best to remove all the thing I have done and google to fix this, I failed. I cannot understand the problem, how it occurs and which part should I focus -- libc.so.6 or librt.so.1? Which is the key.
I have no root permission, so I cannot change the files for lib, lib64 etc.
$ ls -l $(locate librt.so.1)
lrwxrwxrwx 1 root root 13 Jul 6 2017 /lib64/librt.so.1 -> librt-2.12.so
lrwxrwxrwx 1 root root 17 Jul 6 2017 /lib64/rtkaio/librt.so.1 -> librtkaio-2.12.so
lrwxrwxrwx 1 root root 13 Aug 1 2017 /lib/i686/nosegneg/librt.so.1 -> librt-2.12.so
lrwxrwxrwx 1 root root 13 Aug 1 2017 /lib/librt.so.1 -> librt-2.12.so
lrwxrwxrwx 1 root root 17 Aug 1 2017 /lib/rtkaio/i686/nosegneg/librt.so.1 -> librtkaio-2.12.so
lrwxrwxrwx 1 root root 17 Aug 1 2017 /lib/rtkaio/librt.so.1 -> librtkaio-2.12.so
$ ls -l $(locate libc.so.6)
lrwxrwxrwx 1 root root 19 Dec 25 13:51 /lib64/libc.so.6 -> /lib64/libc-2.12.so
lrwxrwxrwx 1 root root 12 Aug 1 2017 /lib/i686/nosegneg/libc.so.6 -> libc-2.12.so
lrwxrwxrwx 1 root root 12 Aug 1 2017 /lib/libc.so.6 -> libc-2.12.so
I also have these two files in conda directory, which can not be locate
$ ls -l $(find . -name "libc.so.6")
-rwxrwxr-x 1 liuxs liuxs 3985000 Jun 21 2017 ./lib/libc.so.6
lrwxrwxr-x 1 liuxs liuxs 14 May 10 19:26 ./pkgs/gcc_impl_linux-64-7.2.0-habb00fd_3/x86_64-conda_cos6-linux-gnu/sysroot/lib/libc.so.6 -> libc-2.12.2.so
lrwxrwxr-x 1 liuxs liuxs 14 Mar 28 12:06 ./x86_64-conda_cos6-linux-gnu/sysroot/lib/libc.so.6 -> libc-2.12.2.so
[liuxs#HPC-login anaconda3]$ ls -l $(find . -name "librt.so.1")
lrwxrwxr-x 1 liuxs liuxs 15 Mar 28 11:25 ./pkgs/gcc_impl_linux-64-7.2.0-habb00fd_3/x86_64-conda_cos6-linux-gnu/sysroot/lib/librt.so.1 -> librt-2.12.2.so
lrwxrwxr-x 1 liuxs liuxs 15 Mar 28 12:06 ./x86_64-conda_cos6-linux-gnu/sysroot/lib/librt.so.1 -> librt-2.12.2.so
I think maybe it's file in anaconda3 make this error but I dont know how to locate the source of problem. And I dont know when I run conda or python, which librt.so.1 and libc.so.6 the commands use.
Hope someone can help me out of this.
I found how to fix this, the problem came from
-rwxrwxr-x 1 liuxs liuxs 3985000 Jun 21 2017 ./lib/libc.so.6
I change its name fro backup, and the system is okay now. Even though I don't very understand why it works. But the interesting thing is No matter where the file libc.so.6 is, the system will give an error. Maybe it's not a good answer, I modify its name from ./lib/libc.so.6 to ./lib/libc.so.6.bk in case I need it latter.
Thanks comment from #nos.
You are trying to run a program that is fundamentally incompatible
with the runtime of your CentOS 6 machine. You should find a pre-built
binary that is suitable for CentOS 6, or if this is an open source
project, build it yourself

cmake can not open file

When compiling a simple project with cmake I get
$ cmake CMakeLists.txt
CMake Error: cmListFileCache: error can not open file /cygdrive/d/Balladen/helloWorld/CMakeFiles/CMakeSystem.cmake
-- The C compiler identification is GNU 4.8.2
CMake Error: cmListFileCache: error can not open file /cygdrive/d/Balladen/helloWorld/CMakeFiles/CMakeCCompiler.cmake
CMake Error: Could not find cmake module file:/cygdrive/d/Balladen/helloWorld/CMakeFiles/CMakeCCompiler.cmake
-- The CXX compiler identification is GNU 4.8.2
CMake Error: cmListFileCache: error can not open file /cygdrive/d/Balladen/helloWorld/CMakeFiles/CMakeCXXCompiler.cmake
CMake Error: Could not find cmake module file:/cygdrive/d/Balladen/helloWorld/CMakeFiles/CMakeCXXCompiler.cmake
CMake Error: cmListFileCache: error can not open file /cygdrive/d/Balladen/helloWorld/CMakeFiles/CMakeSystem.cmake
CMake Error: cmListFileCache: error can not open file /cygdrive/d/Balladen/helloWorld/CMakeFiles/CMakeRCCompiler.cmake
CMake Error: Could not find cmake module file:/cygdrive/d/Balladen/helloWorld/CMakeFiles/CMakeRCCompiler.cmake
CMakeLists.txt:
cmake_minimum_required(VERSION 2.8.4)
project('helloWorld')
## Target
set(TEST_SRCS main.cpp)
add_executable(helloWorld ${TEST_SRCS})
## Link libraries
target_link_libraries(helloWorld ${CMAKE_THREAD_LIBS_INIT})
The files CMakeCCompiler and CMakeCXXCompiler do not exist, the file CMakeSystem.cmake has no access rights. Therefore they can not be read.
$ ls -la *
-rw-r--r--+ 1 WUD Domain Users 10195 Mar 26 17:59 CMakeCache.txt
----------+ 1 WUD Domain Users 426 Mar 26 17:53 CMakeLists.txt
----------+ 1 WUD Domain Users 64 Mar 26 17:58 main.cpp
----------+ 1 WUD Domain Users 5667 Mar 26 17:34 Makefile
CMakeFiles:
total 16
drwxr-xr-x+ 1 WUD Domain Users 0 Mar 26 17:59 .
d---------+ 1 WUD Domain Users 0 Mar 26 17:59 ..
-rw-r--r-- 1 WUD Domain Users 85 Mar 26 17:59 cmake.check_cache
-rw-r--r-- 1 WUD Domain Users 72 Mar 26 17:59 CMakeError.log
-rw-r--r-- 1 WUD Domain Users 803 Mar 26 17:59 CMakeOutput.log
---------- 1 WUD Domain Users 221 Mar 26 17:59 CMakeRCCompiler.cmake
---------- 1 WUD Domain Users 402 Mar 26 17:59 CMakeSystem.cmake
drwxr-xr-x+ 1 WUD Domain Users 0 Mar 26 17:59 CMakeTmp
drwxr-xr-x+ 1 WUD Domain Users 0 Mar 26 17:59 CompilerIdC
drwxr-xr-x+ 1 WUD Domain Users 0 Mar 26 17:59 CompilerIdCXX
If I copy the files from an other project and add reading rights to all files in CMakeFiles, then it works fine. I have this problem with several projects. Running it on a mounted drive DOES help (for example on a true-crypt drive).
So I guess problems with access rights.
All hints I found in the internet did not help.
I'm working with Windows 7, Cygwin 32bit, cmake version 2.8.9
Any idea?
This appears to be an issue with cmake being unable to process files with path lengths above 260 characters or more on Windows. To fix this issue you would need to reduce your path size to below 260 or set LongPathsEnabled to 1 in the file registry. See this issue for more details:
https://gitlab.kitware.com/cmake/cmake/-/issues/21875

Resources