building tpm2-tss, tpm2-tools, tpm2-abrmd on x86 platform - tpm

I need to build the intel sample application using Yocto for x86 environment, which is having dependency on tpm2-tss, tpm2-tools, tpm2-abrmd.
reference link :
for building tpm2-tss, tpm2-tools, tpm2-abrmd : https://github.com/jiazhang0/meta-secure-core/tree/master/meta-tpm2/recipes-tpm
intel sample application : https://www.intel.com/content/www/us/en/developer/articles/code-sample/secret-key-provisioning-in-c-using-ptt.html
I have added the .bb files into present build (my own project build) but is having issues with run time dependencies.
Can anybody help me to resolve the dependencies.
ERROR: ParseError at /home/builduser/Linux_am335x/trunk/build/meta-crestron/recipes-external/tpm2-tss/tpm2-tss_2.4.6.bb:51: unparsed line: 'FILES:libtss2-tcti-device = "${libdir}/libtss2-tcti-device.so.*"'
I work on 16.04.1-Ubuntu, I have tried installing the libraries using :
sudo apt-get install libtss2-utils
sudo apt-get install libtss2-dev
And found the libraries present at /usr/lib/x86_64-linux-gnu.
Thanks in advance!

Related

Paho MQTT throws undefined reference error during compile

I have a problem using Paho MQTT client in C.
I downloaded the pre built binaries for my system (Windows 10 64) from their projects page. I unpacked the zip file to a folder in the documents folder, where I also created a .c file with the example at the bottom of the Paho product page. My editor is atom and my compiler is gcc.
When I tried to compile it in Atom, I got this error:
undefined reference to MQTTClient_create'
So I went searching and found plenty of topics, but I still couldn't figure out, how to resolve this issue. From this stackoverflow topic I gather that it's a linker problem and that I need to link the files during compile, so here's what I tried:
gcc MQTT.c -L "C:\Users\Pete\Documents\MQTT on C\Examples\Paho\lib" -l paho-mqtt3c
Which still gives me the same undefined reference error. When I try to link to the dll of the same name, the compiler does not find the file.
Can anyone point me in the right direction, please?
Any help is appreciated!
I'd be interested to know if you have registered the Paho MQTT dll in Windows?
You should have paho-mqtt3c.dll as part of the download.
I don't know if this will work for you, but I have the same issue (undefined reference to MQTTClient_create)...
Copy the dll file into c:/windows/system32
Run CMD Prompt as Administrator and type:
regsvr32 i/ paho-mqtt3c.dll
Worth a try.
The problem was that I was compiling the program with the 32-bit gcc compiler for the 64-bit library. Installing and using MinGW64 worked.
I had the same issue in OS X. This is how I resolved it
I compiled the paho-mqtt library in Linux/EC2 instance.
Installed all the dependencies:
sudo yum install install build-essential gcc make cmake cmake-gui cmake-curses-gui
sudo yum install cmake
sudo yum install doxygen graphviz
cmake -DPAHO_WITH_SSL=TRUE -DPAHO_BUILD_DOCUMENTATION=FALSE -DPAHO_BUILD_STATIC=TRUE -DPAHO_BUILD_SHARED=FALSE -DPAHO_MQTT_C_PATH=../paho.mqtt.c/ -DPAHO_MQTT_C_LIB=../paho.mqtt.c/src/libpaho.mqtt3as-static.a
make
make html
make install
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/ec2-user/paho.mqtt.c/src
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH
sudo ldconfig
gcc test1.c -o test1 -lpaho-mqtt3c
Compiled successfully..
./test1
This solution works for OS X as well. Replace step 2 with
brew install cmake doxygen openssl-devel

problems building CodeLite

Having a heck of a time trying to build CodeLite for an ARM-based Ubuntu Linux target. (Build instructions here: http://codelite.org/Developers/Linux). I get an error from CMAKE that says Could not locate GTK2. Looking in the CmakeLists.txt file I can see that this is a result of find_package(GTK2) failing to find GTK2. I think I have installed gtk according to what the CodeLite build instructions say to do using the command sudo apt-get install libgtk2.0-dev.
In terms of cmake, I don't understand what a "package" is. How would I [manually] locate this package on my filesystem and how do I get cmake to find it?
For my aarch64 ubuntu 17.04, the libraries and headers were under /usr/lib/aarch64-linux-gnu, so invoking cmake with them produced the correct build files:
cmake -DCMAKE_INCLUDE_PATH=/usr/lib/aarch64-linux-gnu/ -DCMAKE_LIBRARY_PATH=/usr/lib/aarch64-linux-gnu/ -DCMAKE_BUILD_TYPE=Release .. -DCOPY_WX_LIBS=1

Build mozilla JSS

I followed NSS build instructions and built NSS successfully.
Then I follow JSS build instructions and building fails with error:
In file included from CryptoManager.c:6:0:
../../../../dist/public/nss/secitem.h:15:21: fatal error: plarena.h: No such file or directory
compilation terminated.
This result is on Ubuntu 16.04 LTS.
On WIndows I get:
All directories (dist, jss, nspr and nss) are on the same level.
What am I doing wrong?
Check my post here. Basically it's due to missing packages. If not working, this file is somewhere under nspr. Copy it and place it beside the .c file which needs it.
EDIT:
To sum it up:
1. Install build-essential and gcc with g++.
2. Try to install zlib1g-dev and libc6-dev, if they are absent.
3. And, install zlib1g-dev.
4. cd into the nss directory, and run the build like this:
gmake nss_build_all NSS_SSL_ENABLE_ZLIB=
if you are under a x64 environment, add USE_64=1, too.
It should work.

How to compile c++ programs in the new c++ driver provided by Datastax in Linux

I am new to Cassandra. I installed c++ driver from Datastax. Can some one please provide me the steps like in which path I have to create the ā€˜.cā€™ file and how I can compile it. I can see some example programs in example folder. Can anyone plz tell me how to compile the example programs.
The cpp-driver uses cmake and depends on libuv. So the first steps would be to ensure you have cmake installed as well as libuv. Depending on your linux distribution it may be as simple as using package manager like apt or yum (i.e. sudo apt-get install cmake libuv-dev)
Building is just a matter of running the following steps in the cpp-driver directory:
cmake .
make
sudo make install
This will install libcassandra.so to somewhere in your lib path. You can then link by providing '-lcassandra' in your parameters to clang or gcc (i.e. clang myfile.c -o myfile -lcassandra)
There is very comprehensive documentation on building from source here.

Building mysql++ libraries for powerpc

I have an embedded application written in C++ (running on a PowerPC in linux environment) which accesses an external database. So my application needs mysql++ libraries which needs to be built using a powerpc compiler. Before building the libraries, I wanted to build mysql++ libraries for linux on my Ubuntu VM to check the procedure. I downloaded the latest package from Official Website. Then I followed the steps mentioned.
Ran ./configure from the root directory, I got the below error.
*checking for MySQL library directory... configure: error: Didn't find mysqlclient library in '/usr/lib64 /usr/lib /usr/lib64/mysql /usr/lib/mysql /usr/local/lib64 /usr/local/lib /usr/local/lib/mysql /usr/local/mysql/lib /usr/local/mysql/lib/mysql /usr/mysql/lib/mysql /opt/mysql/lib /opt/mysql/lib/mysql /sw/lib /sw/lib/mysql'*
I tried locate mysqlclient and did not find any references, hence I followed instructions given in other forums and tried to install the libmysqlclient15-dev using the below command.
sudo apt-get install libmysqlclient15-dev
The output is as shown below
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'libmysqlclient-dev' instead of 'libmysqlclient15-dev'
libmysqlclient-dev is already the newest version.
The following packages were automatically installed and are no longer required:
libcommons-collections3-java junit4 libecj-java libdb5.1-java libasm3-java libgcj-bc gcj-4.6-jre-lib libgnomeui-common libcommons-el-java
junit linux-headers-3.2.0-32 linux-headers-3.2.0-29 libcommons-compress-java libregexp-java libdb-java libswt-cairo-gtk-3-jni libjasper-java
libbonoboui2-common libbonoboui2-0 libdb5.1-java-gcj libcommons-httpclient-java libservlet2.4-java liblucene2-java libswt-gtk-3-java
libcommons-cli-java libslf4j-java libgcj12 libxml-commons-external-java libswt-webkit-gtk-3-jni linux-headers-3.2.0-29-generic-pae
libswt-gtk-3-jni ant gcj-4.6-base libcommons-logging-java default-jdk libswt-glx-gtk-3-jni libcommons-codec-java jarwrapper
libequinox-osgi-java libgcj-common libapache-pom-java libgnomeui-0 libjetty-java libjline-java libxerces2-java sat4j
libcommons-beanutils-java libdb-je-java fastjar libcommons-digester-java libcommons-parent-java libhamcrest-java libjtidy-java
libxml-commons-resolver1.1-java libicu4j-java linux-headers-3.2.0-32-generic-pae libicu4j-4.4-java libwebkitgtk-1.0-common
libcommons-lang-java libwebkitgtk-1.0-0 libjavascriptcoregtk-1.0-0 libjsch-java ant-optional libswt-gnome-gtk-3-jni
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
After this I tried to locate libmysqlclient and I still couldn't find the libraries (.so files). I tried ./configure again and it failed in the same location with the same error message. How can I install libmysqlclient ?
Once this is solved I will rebuild the mysql++ library using my toolchain for powerpc. Has anyone tried this ? To build mysql++ library I need mysqlclient, in the earlier example I would install it by executing the command apt-get, but the libraries would be compiled using a gnu compiler ? How to cross compile mysqlclient for powerpc ? I guess I need to do the below
Build mysqlclient for powerpc.
Use those libraries and build mysql++ libraries for powerpc.
Use mysql++ and mysqlclient libraries in my application and compile for powerpc.
I am new to linux and databases.
I finally solved this problem. I did the below.
Downloaded the Connector/C (libmysql) source files from here
Cross compiled it for powerpc, below is the command given to cmake
cmake -DCMAKE_INSTALL_PREFIX="~/mysqlclient_C/lib" -DCMAKE_C_COMPILER="ppc_4xx-gcc" -DCMAKE_C_FLAGS="-I/opt/ELDK/4.2/ppc_4xx/usr/include/" -DCMAKE_CXX_COMPILER="ppc_4xx-g++" -DCMAKE_CXX_FLAGS="-I/opt/ELDK/4.2/ppc_4xx/usr/include/" -DCMAKE_EXE_LINKER_FLAGS="-lm"
Then a simple make generated the libmysql libraries.
Downloaded mysql++ source files from here
Cross compiled it for powerpc, below is my configure command
./configure --target=powerpc-linux --host=powerpc-linux --prefix="$HOME/mysql++/lib" --enable-thread-check --with-mysql="$HOME/mysqlclient_C/lib" CC=ppc_4xx-gcc CXX=ppc_4xx-g++ LDFLAGS=-lm CFFLAGS="-I/opt/ELDK/4.2/ppc_4xx/usr/include" CXXFLAGS="-I/opt/ELDK/4.2/ppc_4xx/usr/include"
The mysql++ libraries is generated now.
I have not tested the built libraries yet.

Resources