How to install cjson properly in Ubuntu 14.0LTS? - c

I am new in json and I don't know how to use but I found compare to XML json is better so, I am learning json in C programming in Ubuntu 14.0LTS.
I followed https://linuxprograms.wordpress.com/2010/05/20/install-json-c-in-linux/.
In this link, I installed libjson0 with the help of first command but when I installed libjson – debug symbols package with the help of second command which is mentioned in link then showing "E: Unable to locate package libjson0-dbg".
Also I gone through https://github.com/json-c/json-c. After cloning moved to json-c directory, in json-c directory I did sh autogen.sh then showing "autogen.sh: 2: autogen.sh: autoreconf: not found".
Why autoreconf is not works ? When I installed CppUTest and other stuffs then it works.
I also install build-essential which found in google for above problems but it can't works for me.
How can I installed cjson in a proper manner and how to use with the C-programms.

Try below commands:
$ sudo apt-get install libjson-glib-1.0-0 libjson-glib-1.0-0-dev
If you want to debug your programs and see the various steps of serializing/deserializing you can also install the libjson-glib – debug symbols package
$ sudo apt-get install libjson-glib-1.0-0-dbg
For documentation related to json-glib, you must install the following package
$ sudo apt-get install libjson-glib-1.0-0-doc
This documentation will then be available in file:///usr/share/gtk-doc/html/json-glib/index.html

Maybe your problem is related with the path.
The library is installed correctlly but you have tot tell the system where. Here a post on how to do it in Ubuntu How to set the environmental variable LD_LIBRARY_PATH in linux

Related

Error when trying to do (sudo apt install flex bison): The operation couldn’t be completed. Unable to locate a Java Runtime that supports apt [duplicate]

I was watching this, and, as you can see, the first command I am told to put in is:
sudo apt-get install python-setuptools
When I do this, it outputs:
sudo: apt-get: command not found
I have no idea why this is the case.
How can I resolve this so I am following the tutorial correctly?
Mac OS X doesn't have apt-get. There is a package manager called Homebrew that is used instead.
This command would be:
brew install python
Use Homebrew to install packages that you would otherwise use apt-get for.
The page I linked to has an up-to-date way of installing homebrew, but at present, you can install Homebrew as follows:
Type the following in your Mac OS X terminal:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
After that, usage of Homebrew is brew install <package>.
One of the prerequisites for Homebrew are the XCode command line tools.
Install XCode from the App Store.
Follow the directions in this Stack Overflow answer to install the XCode Command Line Tools.
Background
A package manager (like apt-get or brew) just gives your system an easy and automated way to install packages or libraries. Different systems use different programs. apt and its derivatives are used on Debian based linux systems. Red Hat-ish Linux systems use rpm (or at least they did many, many, years ago). yum is also a package manager for RedHat based systems.
Alpine based systems use apk.
Warning
As of 25 April 2016, homebrew opts the user in to sending analytics by default. This can be opted out of in two ways:
Setting an environment variable:
Open your favorite environment variable editor.
Set the following: HOMEBREW_NO_ANALYTICS=1 in whereever you keep your environment variables (typically something like ~/.bash_profile)
Close the file, and either restart the terminal or source ~/.bash_profile.
Running the following command:
brew analytics off
the analytics status can then be checked with the command:
brew analytics
As Homebrew is my favorite for macOS although it is possible to have apt-get on macOS using Fink.
MacPorts is another package manager for OS X:.
Installation instructions are at The MacPorts Project -- Download & Installation after which one issues sudo port install pythonXX, where XX is 27 or 35.
Conda can also be used as package manager. It can be installed from Anaconda.
Alternatively, a free minimal installer is Miniconda.
apt-get command is only available on Debian or Debian-based Linux distributions (such as Ubuntu, Linux Mint, Kali). It is not accessible on macOS. Alternatively, you can use package managers like Homebrew, MacPorts, and Nix. You can find equivalent commands for each as follows
brew install package_name
sudo port install package_name
nix-env -i package_name
Before installing above package managers, you need to install XCode first. Follow the operation instructions from this guide How to Fix "sudo apt-get command not found" Error on Mac Terminal.
Alternatively You can use the brew or curl command for installing things, wherever apt-get is mentioned with a URL...
For example,
curl -O http://www.magentocommerce.com/downloads/assets/1.8.1.0/magento-1.8.1.0.tar.gz

In Debian CMake cant find 'libmosquitto'

Im trying of compile a cmake project of C code in a Raspberry Pi with Debian 10, the CMakeList.txt search for package first, when ask for 'libmosquitto' show the error:
Checking for module 'libmosquitto'
No package 'libmosquitto' found.
Already have installed this package with the command:
sudo apt-get install libmosquitto-dev
Before this, the CMake show another error for the package json-c, but after install it with apt-get install, the problem gone, but now for this library the CMake not recognize mosquitto.
locate libmosquitto.pc
and then add this path to PKG_CONFIG_PATH
export PKG_CONFIG_PATH="Actual_Path to libmosquitto.pc"
This worked for me.

h5dump fails with "libhdf5_serial.so.100: cannot open shared object file"

I am on Ubunto 18.04. I installed libhdf5-serial-dev:
sudo apt-get install libhdf5-serial-dev
This installed ok - no errors. I can compile, link, and run a C++ file ok that creates and populates an HDF5 file. The resultant file looks good - I can read it ok with h5py and Python.
I installed hdf5-tools:
sudo apt-get install hdf5-tools
That also installed ok - no errors. But when I run h5dump I get:
h5dump: error while loading shared libraries: libhdf5_serial.so.100: cannot open shared object file: No such file or directory
That file does not exist in /usr/lib/x86_64-linux-gnu/hdf5/serial (or /usr/lib/x86_64-linux-gnu). No files with ".100" exist in either of those directories.
Any suggestions on what I've done wrong, and/or how to fix this?
None of the answers I found on the web helped me solve this problem - I tried every suggestion I found.
In the end, updating to Ubuntu 20.04 fixed the problem. Maybe reinstalling Ubuntu 18.04 would also have fixed the problem.

Installing glibtop on ubuntu

I'm new to ubuntu and i'm currently using it on windows 7 with vmware workstation.
I need to access the CPU usage with a C program on terminal, so i thought of using glibtop_get_cpu() function on glibtop library. I just wrote #include <glibtop.h> in my code and compiled it with "gcc" on terminal, and it said
fatal error: glibtop.h: No such file or directory
compilation terminated.
I tried to install the library using this:
sudo apt-get install liblib2.0-dev
but the terminal said:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package libglib2.0-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or is only available from another source
However the following packages replace it:
libglib2.0-0 libglib2.0-bin
E: Package 'libglib2.0-dev' has no installation candidate
any ideas about this?
You should install libgtop2-dev (sudo apt-get install libgtop2-dev).

sql.h header file missing though unixODBC is installed

I am on an up-to-date Ubuntu 12.04 system. I have unixodbc (v2.2.14 from ubuntu repos), MySQL and its relevant drivers installed. Also connected to a valid DSN. Verified by issuing isql DBName UName passwd.
I am trying to compile a C application that interacts with the database using ODBC. Almost everywhere I searched seemed to indicate that I should have "sql.h" installed somewhere. A find / -iname sql.h -print showed I don't have it.
So my question is: where is it? Did something go wrong with the install (no errors were reported though)? And what steps do you recommend? Reinstallation? Compilation from source code (the latest version?)?
You need to install the unixodbc-dev package to get the development header files.
sudo apt-get install unixodbc-dev
The -dev packages contain the require header files required to compile and build programs using these headers to make calls to the library. The library files themselves would be part of the regular package i.e. unixodbc in your case.
If you want to know which package provides a certain file, you could use apt-file:
sudo apt-file update
sudo apt-file find sql.h

Resources