libuuid not linking in ubuntu 16.04 - c

The above problem is not resolved in ubuntu 16.04 .
I tried it but still not working . here are the results of steps I followed :
~$ apt-cache search libuuid
libuuid-perl - Perl extension for using UUID interfaces as defined in e2fsprogs libuuid1 - Universally Unique ID library uuid-dev - Universally Unique ID library - headers and static libraries uuid-runtime - runtime components for the Universally Unique ID library libdata-uuid-libuuid-perl - uuid.h based UUID generation module libuuid-tiny-perl - pure Perl module to generate v1, v3, v4, and v5 UUIDs libuuidm-ocaml-dev - Universally unique identifiers for OCaml php-uuid - PHP UUID extension
~$ sudo apt-get install uuid-runtime
Reading package lists... Done Building dependency tree
Reading state information... Done uuid-runtime is already the newest version (2.27.1-6ubuntu3.6). The following packages were automatically installed and are no longer required: linux-headers-4.15.0-29 linux-headers-4.15.0-29-generic linux-headers-4.15.0-43 linux-headers-4.15.0-43-generic linux-image-4.15.0-29-generic linux-image-4.15.0-43-generic linux-modules-4.15.0-29-generic linux-modules-4.15.0-43-generic linux-modules-extra-4.15.0-29-generic linux-modules-extra-4.15.0-43-generic Use 'sudo apt autoremove' to remove them. 0 upgraded, 0 newly installed, 0 to remove and 77 not upgraded.
~$ sudo apt-get install libuuid1
Reading package lists... Done Building dependency tree
Reading state information... Done libuuid1 is already the newest version (2.27.1-6ubuntu3.6). The following packages were automatically installed and are no longer required: linux-headers-4.15.0-29 linux-headers-4.15.0-29-generic linux-headers-4.15.0-43 linux-headers-4.15.0-43-generic linux-image-4.15.0-29-generic linux-image-4.15.0-43-generic linux-modules-4.15.0-29-generic linux-modules-4.15.0-43-generic linux-modules-extra-4.15.0-29-generic linux-modules-extra-4.15.0-43-generic Use 'sudo apt autoremove' to remove them. 0 upgraded, 0 newly installed, 0 to remove and 77 not upgraded.
~$ sudo apt-get install uuid-dev
Reading package lists... Done Building dependency tree
Reading state information... Done uuid-dev is already the newest version (2.27.1-6ubuntu3.6). The following packages were automatically installed and are no longer required: linux-headers-4.15.0-29 linux-headers-4.15.0-29-generic linux-headers-4.15.0-43 linux-headers-4.15.0-43-generic linux-image-4.15.0-29-generic linux-image-4.15.0-43-generic linux-modules-4.15.0-29-generic linux-modules-4.15.0-43-generic linux-modules-extra-4.15.0-29-generic linux-modules-extra-4.15.0-43-generic Use 'sudo apt autoremove' to remove them. 0 upgraded, 0 newly installed, 0 to remove and 77 not upgraded.
Following is the code in my test.c file
#include <stdio.h>
#include <uuid/uuid.h>
int get_uuid();
int main()
{
get_uuid();
return 1;
}
int get_uuid()
{
uuid_t uuid;
uuid_generate(uuid);
return 1;
}
Error: /tmp/cchyLkZt.o: In function get_uuid':
test5.c:(.text+0x34): undefined reference touuid_generate' collect2: error: ld returned 1 exit status
Compilation Command -
cc -luuid test.c

Related

Unable to compile PnetCDF: 'tst_rec_vars' test fails

I am trying to install PnetCDF from source. I used the 1.12.2 version for installation. MPICH, Zlib, Szip, HDF5 and NetCDF-4 have been installed from source successfully (HDF5 and NetCDF-4 have been built with parallel I/O support).
MPICH is installed as follows (v3.4.2):
./configure --prefix=${DIR}/mpich --with-device=ch4:ofi CFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64" --enable-fortran
make
make check
make install
export PATH=${DIR}/mpich/bin:${PATH}
Where DIR is the root directory all the libraries are installed to (with their own directory).
Zlib (v1.2.11):
./configure --prefix=${DIR}/grib2
make
make check
make install
export CPPFLAGS="-I${DIR}/grib2/include"
export LDFLAGS="-L${DIR}/grib2/lib"
export LD_LIBRARY_PATH="${DIR}/grib2/lib:$LD_LIBRARY_PATH"
Szip (v2.1.1):
./configure --prefix=${DIR}/szip
CC=mpicc
make
make check
make install
export LD_LIBRARY_PATH="${DIR}/szip/lib:$LD_LIBRARY_PATH"
export CPPFLAGS="-I${DIR}/szip/include ${CPPFLAGS}"
export LDFLAGS="-L${DIR}/szip/lib ${LDFLAGS}"
HDF5 (v1.8.22):
export HDF5=${DIR}/hdf5
./configure --prefix=${HDF5} --with-szlib=${DIR}/szip --with-zlib=${DIR}/grib2 --enable-parallel CC=mpicc --enable-fortran FC=mpifort
make
make check
make install
export LD_LIBRARY_PATH="${HDF5}/lib:$LD_LIBRARY_PATH"
export CPPFLAGS="-I${HDF5}/include ${CPPFLAGS}"
export LDFLAGS="-L${HDF5}/lib ${LDFLAGS}"
export PATH="${HDF5}/bin:${PATH}"
NetCDF4-C (v4.8.0):
./configure --prefix=${DIR}/netcdf --disable-dap --enable-parallel-tests --enable-large-file-tests --disable-extreme-numbers CC=mpicc
make
make check
make install
export PATH="${NETCDF}/bin:${PATH}"
export LD_LIBRARY_PATH="${NETCDF}/lib:${LD_LIBRARY_PATH}"
export CPPFLAGS="-I${NETCDF}/include ${CPPFLAGS}"
export LDFLAGS="-L${NETCDF}/lib ${LDFLAGS}"
export LIBS="$(nc-config --libs) ${LIBS}"
NetCDF4-Fortran (v4.5.3):
./configure --prefix=${NETCDF} --enable-large-file-tests --enable-parallel-tests CC=${DIR}/mpich/bin/mpicc FC=mpifort F77=mpif77
make
make check
make install
The HDF5 configuration shown by h5pcc -showconfig is given below (only the part I think relevant is included):
Features:
---------
Parallel HDF5: yes
High-level library: yes
Build HDF5 Tests: yes
Build HDF5 Tools: yes
Threadsafety: no
Default API mapping: v18
With deprecated public symbols: yes
I/O filters (external): deflate(zlib),szip(encoder)
MPE:
Direct VFD: no
(Read-Only) S3 VFD: no
(Read-Only) HDFS VFD: no
dmalloc: no
Clear file buffers before write: yes
Using memory checker: no
Function stack tracing: no
Strict file format checks: no
Optimization instrumentation: no
And the output of nc-config --all:
--cc -> /media/case/work/hwrf/libraries/mpich/bin/mpicc
--cflags -> -I/media/case/work/hwrf/libraries/netcdf/include -I/media/case/work/hwrf/libraries/hdf5/include -I/media/case/work/hwrf/libraries/szip/include -I/media/case/work/hwrf/libraries/grib2/include
--libs -> -L/media/case/work/hwrf/libraries/netcdf/lib -lnetcdf
--static -> -lhdf5_hl -lhdf5 -lm -ldl -lz -lcurl
--has-c++ -> no
--cxx ->
--has-c++4 -> no
--cxx4 ->
--has-fortran -> yes
--fc -> mpifort
--fflags -> -I/media/case/work/hwrf/libraries/netcdf/include -I/media/case/work/hwrf/libraries/netcdf/include
--flibs -> -L/media/case/work/hwrf/libraries/netcdf/lib -lnetcdff
--has-f90 ->
--has-f03 -> yes
--has-dap -> no
--has-dap2 -> no
--has-dap4 -> no
--has-nc2 -> yes
--has-nc4 -> yes
--has-hdf5 -> yes
--has-hdf4 -> no
--has-logging -> no
--has-pnetcdf -> no
--has-szlib -> yes
--has-cdf5 -> yes
--has-parallel4 -> yes
--has-parallel -> yes
--has-nczarr -> no
--prefix -> /media/case/work/hwrf/libraries/netcdf
--includedir -> /media/case/work/hwrf/libraries/netcdf/include
--libdir -> /media/case/work/hwrf/libraries/netcdf/lib
--version -> netCDF 4.8.0
So far, so good. Everything was installed without any failure. All make checks have been passed.
The trouble arises when I try to compile PnetCDF from source. I tried PnetCDF version 1.11.2 for installation (in fact, I triedd several older versions as well, more on that later). The installation is attempted as following:
./configure --prefix=${DIR}/pnetcdf --enable-large-single-req --enable-netcdf4 --enable-shared=yes --with-netcdf4="${DIR}/netcdf" MPICC=mpicc MPIF77=mpif77 MPIF90=mpif90 MPICC=mpicc MPIF77=mpif77 MPIF90=mpif90
make
make tests
make check
make ptest
make ptests
But, it fails at make ptest. The failed test is tst_rec_vars.c and the error message is:
Error at line 78 of tst_rec_vars.c: expect dim X len 4 but got 3
Error at line 78 of tst_rec_vars.c: expect dim X len 4 but got 3 fail with 2 mismatches
make[2]: *** [Makefile:1354: ptest4] Error 1
make[2]: Leaving directory '/media/case/work/hwrf/libraries/source/pnetcdf-1.12.2/test/nc4'
make[1]: *** [Makefile:780: ptests] Error 1
make[1]: Leaving directory '/media/case/work/hwrf/libraries/source/pnetcdf-1.12.2/test'
make: *** [Makefile:965: ptests] Error 1
Heres the test that is failing (GitHub link): tst_rec_vars.c
It seems that the test is checking a NetCDF file for the lenth of dimension in it. I assume the NetCDF file it is checking is tst_rec_vars.nc. The output of ncdump -h on this file is given below:
netcdf tst_rec_vars {
dimensions:
X = UNLIMITED ; // (4 currently)
variables:
int U(X) ;
int V(X) ;
}
That is, the NetCDF file's X dimension indeed has a length 4, although the test program beleives it is only 3. But, if I were to run the test manually as ./tst_rec_vars, it runs correctly.
*** TESTING C tst_rec_vars for record variables to NetCDF4 file ------ pass
Could it be due to parallel processing/threading? The test in question is run under a section titled test/nc4: Parallel testing on 4 MPI processes. I assume the NetCDF file was tested before it was formed completely, which could explain why I got a length 1 X dimension in the NetCDF file from ncdump at one point.
>>>ncdump -h tst_rec_vars.nc
netcdf tst_rec_vars {
dimensions:
X = UNLIMITED ; // (1 currently)
variables:
int U(X) ;
int V(X) ;
}
What exactly is going on here? How do I fix it?
Edit:
I'm trying to install it on CentOS 7, since I was encountering the above mentioned issue, I tried to install it on a Debian 11 system. But I am getting the very exact error in both systems.

How to compile the C GNU Scientific Library (GSL) to web assembly using emscripten?

The goal is to compile the latest stable GSL to web assembly and make it available as a Node.js module.
I tried the following procedure inspired by this section of the emscripten manual:
git clone git://git.savannah.gnu.org/gsl.git
cd gsl
git checkout tags/release-2-6
autoreconf -i
emconfigure ./configure
emmake make
Unfortunately, I get multiple wasm-ld: error: duplicate symbol.
But compiling the GSL (make) works perfectly fine.
I am using emsdk version 2.0.16 on Ubuntu 18.04.
Does anyone know, how to fix this problem?
Help will be much appreciated.
Finally found a solution inspired by this gist. The problem had to do with dynamic linking and shared libraries.
Anyway, the following code successfully compiles the GSL to a Node.js module:
git clone git://git.savannah.gnu.org/gsl.git
cd gsl
git checkout tags/release-2-6
autoreconf -i
emconfigure ./configure
# Note the flag indicating STATIC linking:
# -------------------------======---------
emmake make LDFLAGS=-all-static
emcc -g -O2 -o .libs/gsl.js -s MODULARIZE -s EXPORTED_RUNTIME_METHODS=\[ccall\] -s LINKABLE=1 -s EXPORT_ALL=1 ./.libs/libgsl.a -lm
The above creates the node module ./.libs/gsl.js which can be used as shown in the following example script:
// test_gsl.js
var factory = require('./.libs/gsl.js');
factory().then((instance) => {
// Compute the value of the Bessel function for x = 5.0:
var besselRes = instance._gsl_sf_bessel_J0(5.0);
// Calculate the hypergeometric cumulative probability distribution for:
// 4: Number of successes (white balls among the taken)
// 7: Number of white balls in the urn
// 19: Number of black balls in the urn
// 13: Number of balls taken
var hg = instance._gsl_cdf_hypergeometric_P(4, 7, 19, 13);
// Do the same using `ccall`
var hg_ccal = instance.ccall("gsl_cdf_hypergeometric_P",
"number",
["number", "number", "number", "number" ],
[4, 7, 19, 13]);
console.log(`besselRes is: ${besselRes}`);
console.log(`gsl_cdf_hypergeometric_P(4,7,19,13): ${hg}`);
console.log(`ccall("gsl_cdf_hypergeometric_P",4,7,19,13): ${hg_ccal}`);
});
Please note that all GSL functions are prefixed with an underscore (_) in the generated Node.js module.
The above script (node ./test_gsl.js) generates this output:
besselRes is: -0.17759677131433826
gsl_cdf_hypergeometric_P(4,7,19,13): 0.8108695652173905
ccall("gsl_cdf_hypergeometric_P",4,7,19,13): 0.8108695652173905
I sincerely hope, this post helps any one.
Have a good one and Cheers!

Ansible install RethinkDB on ubuntu 16

I am trying to use ansible package to install a specific version of RethinkDB on ubuntu 16.04.
I use :
- name: Ensure rethinkDB package repository is present
apt_repository: repo='deb http://download.rethinkdb.com/apt xenial main' state=present
tags:
- rethinkdb
- name: install RethinkDB
package: name=rethinkdb-2.3.2 state=latest
tags:
- rethinkdb
However I get the following error:
TASK [install RethinkDB]
******************************************************* task path: /Users/nha/.../playbook.yml:173 fatal:
[machine]: FAILED! => {"changed": false, "failed": true, "msg": "No
package matching 'rethinkdb-2.3.2' is available"} to retry, use:
--limit #ops/ansible/playbook.retry
Even leaving out the version, I get the error:
TASK [install RethinkDB]
******************************************************* task path: /Users/nha/.../playbook.yml:173 fatal:
[machine]: FAILED! => {"cache_update_time": 0, "cache_updated": false,
"changed": false, "failed": true, "msg": "'/usr/bin/apt-get -y -o
\"Dpkg::Options::=--force-confdef\" -o
\"Dpkg::Options::=--force-confold\" install 'rethinkdb'' failed:
E: There were unauthenticated packages and -y was used without
--allow-unauthenticated\n", "stderr": "E: There were unauthenticated packages and -y was used without --allow-unauthenticated\n", "stdout":
"Reading package lists...\nBuilding dependency tree...\nReading state
information...\nThe following additional packages will be installed:\n
libcurl3\nThe following NEW packages will be installed:\n libcurl3
rethinkdb\n0 upgraded, 2 newly installed, 0 to remove and 0 not
upgraded.\nNeed to get 11.2 MB of archives.\nAfter this operation,
40.2 MB of additional disk space will be used.\nWARNING: The following packages cannot be authenticated!\n rethinkdb\n", "stdout_lines":
["Reading package lists...", "Building dependency tree...", "Reading
state information...", "The following additional packages will be
installed:", " libcurl3", "The following NEW packages will be
installed:", " libcurl3 rethinkdb", "0 upgraded, 2 newly installed, 0
to remove and 0 not upgraded.", "Need to get 11.2 MB of archives.",
"After this operation, 40.2 MB of additional disk space will be
used.", "WARNING: The following packages cannot be authenticated!", "
rethinkdb"]} to retry, use: --limit #ops/ansible/playbook.retry
The first error message states that the RethinkDB apt repo doesn't contain a package for a 2.3.2 version.
The second error is because you haven't yet added the apt key to trust this repo. RethinkDB's Ubuntu installation instructions also mentions that you will need to add their apt key.
You can easily do this with the apt_key module:
- name: add rethinkdb apt key
apt_key: url=https://download.rethinkdb.com/apt/pubkey.gpg
As an aside, it doesn't really make much sense to specify a version and then also specify latest on the state.

Installing multiples packages with chef

When I try to install multiples packages with a wildcard naming I got the following error:
* yum_package[mysql-server] action install (up to date)
* yum_package[mysql*] action install
* No candidate version available for mysql*
============================================================================ ====
Error executing action `install` on resource 'yum_package[mysql*]'
============================================================================ ====
Recipe code is:
package 'mysql-server' do
action :install
end
package 'mysql*' do
action :install
end
You have to use the exact package name. The chef package resource does no magic to find matching packages.
The name of the resource (the part just after package) is used as the package name and given to the underlying system (yum on RH like systems, apt on debian like systems)
If you have multiples packages to install and a common configuration you can loop over them in your recipe instead:
['mysql-server','mysql-common','mysql-client'].each do |p|
package p do
action :install
end
end
The array creation could be simplified with some ruby syntax as the words builder %w:
%w(mysql-server mysql-common mysql-client).each [...]
Since chef 12.1 the package resource accept an array of packages directly like this:
package %w(mysql-server mysql-common mysql-client)
This can be resolved using chef cases. Please see below
add the following to your attributes file:
packages = []
case node[:platform_family]
when 'rhel' #based on your OS
packages = [
"package1",
"package2",
"package3",
"package4",
"package5",
"package6",
"package7" ## Last line without comma
]
end
default[:cookbookname][:packages] = packages
Then, add the following to your recipe file (recipes/default.rb):
node[:cookbookname][:packages].each do |pkg|
package pkg do
action :install
retries 3
retry_delay 5
end
end

rpm and Yum don't believe a package is installed after Chef installs

Running chef-solo (Installing Chef Omnibus (12.3)) on centos6.6
My recipe has the following simple code:
package 'cloud-init' do
action :install
end
log 'rpm-qi' do
message `rpm -qi cloud-init`
level :warn
end
log 'yum list' do
message `yum list cloud-init`
level :warn
end
But it outputs the following:
- install version 0.7.5-10.el6.centos.2 of package cloud-init
* log[rpm-qi] action write[2015-07-16T16:46:35+00:00] WARN: package cloud-init is not installed
[2015-07-16T16:46:35+00:00] WARN: Loaded plugins: fastestmirror, presto
Available Packages
cloud-init.x86_64 0.7.5-10.el6.centos.2 extras
I am at a loss as to why rpm/yum and actually rpmquery don't see the package as installed.
EDIT: To clarify I am specifically looking for the following string post package install to then apply a change to the file (I understand this is not a very chef way to do something I am happy to accept suggestions):
rpmquery -l cloud-init | grep 'distros/__init__.py$'
I have found that by using the following:
install_report = shell_out('yum install -y cloud-init').stdout
cloudinit_source = shell_out("rpmquery -l cloud-init | grep 'distros/__init__.py$'").stdout
I can then get the file I am looking for and perform
Chef::Util::FileEdit.new(cloudinit_source.chomp(''))
The file moves based on the distribution but I need to edit that file specifically with in place changes.
Untested code, just to give the idea:
package 'cloud-init' do
action :install
notifies :run,"ruby_block[update_cloud_init]"
end
ruby_block 'update_cloud_init' do
block do
cloudinit_source = shell_out("rpmquery -l cloud-init | grep 'distros/__init__.py$'").stdout
rc = Chef::Util::FileEdit.new(cloudinit_source.chomp(''))
rc.search_file_replace_line(/^what to find$/,
"replacement datas for the line")
rc.write_file
end
end
ruby_block example taken and adapted from here
I would better go using a template to manage the whole file, what I don't understand is why you don't know where it will be at first...
Previous answer
I assume it's a compile vs converge problem. at the time the message is stored (and so your command is executed) the package is not already installed.
Chef run in two phase, compile then converge.
At compile time it build a collection of resources and at converge time it execute code for the resource to get them in the described state.
When your log resource is compiled, the ugly back-ticks are evaluated, at this time there's a package resource in the collection but the resource has not been executed, so the output is correct.
I don't understand what you want to achieve with those log resources at all.
If you want to test your node state after chef-run use a handler maybe calling ServerSpec as in Test-Kitchen.

Resources