Issue compiling thrift 0.9.0 c++ client - c++

I have tried compiling a cpp application with thrift 0.9.0 on ubuntu precise32:
g++ hello_client.cpp gen-cpp/HelloSvc.cpp -lthrift
However, this results in:
In file included from /usr/local/include/thrift/transport/TSocket.h:25:0,
from hello_client.cpp:4:
/usr/local/include/thrift/transport/TTransport.h:34:1: error: 'uint32_t' does not name a type
/usr/local/include/thrift/transport/TTransport.h:107:3: error: 'uint32_t' does not name a type
...

I tried to fix 0.9.0 by:
1) Install python-dev (I noticed an error: missing python.h when building thrift)
sudo apt-get install python-dev
2) Building thrift with:
./configure CPPFLAGS="-DHAVE_INTTYPES_H -DHAVE_NETINET_IN_H"
Still the same errors, so I decided to checkout, build and install the latest thrift (HEAD version 6f2a5037105ccad05eb84ec0a60da3389c85eb3f in git).
With the latest thrift, there were no errors building the cpp client. However, running a.out returned an error:
./a.out: error while loading shared libraries: libthrift-1.0.0-dev.so: cannot open
shared object file: No such file or directory
Setting LD_LIBRARY_PATH to the newly built thrift library fixed this:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$THRIFT_SRC/lib/cpp/.libs/

Related

Python-2.7.18: cryptography-3.3.2 module installation from source failed

I need to install custom module of cryptography#3.3.2 with python-2.7.18 on Ubuntu-18.04, on installation from source got below error
build/temp.linux-x86_64-2.7/_openssl.c: In function '_cffi_d_i2d_re_X509_REQ_tbs':
build/temp.linux-x86_64-2.7/_openssl.c:50709:10: warning: implicit declaration of function 'i2d_re_X509_REQ_tbs'; did you mean 'i2d_re_X509_tbs'? [-Wimplicit-function-declaration]
return i2d_re_X509_REQ_tbs(x0, x1);
^~~~~~~~~~~~~~~~~~~
i2d_re_X509_tbs
=============================DEBUG ASSISTANCE=============================
If you are seeing a compilation error please try the following steps to
successfully install cryptography:
1) Upgrade to the latest pip and try again. This will fix errors for most
users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip
2) Read https://cryptography.io/en/latest/installation.html for specific
instructions for your platform.
3) Check our frequently asked questions for more information:
https://cryptography.io/en/latest/faq.html
=============================DEBUG ASSISTANCE=============================
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for cryptography
Failed to build cryptography
ERROR: Could not build wheels for cryptography which use PEP 517 and cannot be installed directly
Current pip version is : pip 20.3.4 (latest supported)
openssl version : OpenSSL 1.1.1
Also all required dependencies are installed.
If
pip install cryptography is done it successfully installs 3.3.2 version.
Kindly suggest.
I tried to install all dependencies but did not solved my problem.
Also attempted to install non patched cryptography-3.3.2 module from source but got the same error.

Failure to find x11 on nana cmake

I am loading up nana source in CLion and cmake gives me the an error saying x11 is set to NOTFOUND
I have tried installing x11 dev libs on ubuntu but it has not helped :/
EDIT: I have fixed the issue above by installing (2nd Code block)
sudo apt install libxft-dev
however now I am seeing the following error (1st Code Block)
CODE BLOCK 1
fatal error: X11/Xcursor/Xcursor.h: No such file or directory
#include <X11/Xcursor/Xcursor.h>
^~~~~~~~~~~~~~~~~~~~~~~
CODE BLCOK 2
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
/home/jirubizu/Downloads/nana_hotfix/X11_Xft_INCLUDE_PATH
used as include directory in directory /home/jirubizu/Downloads/nana_hotfix
X11_Xft_LIB (ADVANCED)
linked by target "nana" in directory /home/jirubizu/Downloads/nana_hotfix
expected to compile but for some reason its not
Try it before the load:
sudo apt install libxcursor-dev
here are many X11 packages. libxft-dev seems an odd choice. It os a small part of X11 and may or may not bring in X11 libraries you need. Perhaps try installing libxcursor-dev and see what happens.
from n. 'pronouns' m
It works for me
apt-get install libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev
That should do it!

C++ compiling project with shared object (libtensorflow_cc.so) failed

at the moment I'm facing some problems compiling (and running) a (huge) own project with support of Tensorflow. On my own system (Ubuntu 16.04 LTS) everything works fine. Same procedure on a cluster leads to a compile error and I'm not able to find a solution yet.
System information
Have I written custom code: YES
OS Platform and Distribution (e.g., Linux Ubuntu 16.04): CentOS 7.4.1708
TensorFlow installed from (source or binary): source (using the git repo)
TensorFlow version (use command below): 1.9
Python version: 2.7.15
Bazel version (if compiling from source): 0.16
GCC/Compiler version (if compiling from source): 7.30
CUDA/cuDNN version: not used
GPU model and memory: Tesla K20m
Exact command to reproduce:
Cloned tensorflow repo from github
Configure Bazel (./configure in tensorflow repo)
Built libtensorflow_cc.so with bazel (worked fine!!!)
Downloaded dependencies with delivered script tensorflow/contrib/makefile/download_dependencies.sh
(tried installing protobuf & eigen manually, too)!
Installed protobuf with ./autogen.sh && ./configure && make && make install
Installed Eigen from downloaded dependencies
Copied libraries, headers and includes into own project:
$ cp bazel-bin/tensorflow/libtensorflow_cc.so ../tf_project/lib/
$ cp bazel-bin/tensorflow/libtensorflow_framework.so ../tf_project/lib/
$ cp /tmp/proto/lib/libprotobuf.a ../tf_project/lib/
$ mkdir -p ../tf_project/include/tensorflow
$ cp -r bazel-genfiles/ * ../tf_project/include/
$ cp -r tensorflow/cc ../tf_project/include/tensorflow
$ cp -r tensorflow/core ../tf_project/include/tensorflow
$ cp -r third_party ../tf_project/include
$ cp -r /tmp/proto/include/ * ../tf_project/include
$ cp -r /tmp/eigen/include/eigen3/ * ../tf_project/include
Remark: On my own system it works this way for weeks now. I can use tensorflow in my own project with an exported model trained with keras inside a python project. I make predictions using client_sessions and many other functions of the tensorflow framework and it works properly.
Problem: At the cluster I can compile tensorflow as dynamic library, install protobuf and eigen.
When I try to compile my project (similar process regarding my own system) without significant changes it doesn't work and stops with following error message:
.../tensorflow/include/tensorflow/core/framework/tensor.pb.h:12:2: error: #error This file was generated by a newer version of protoc which is
#error This file was generated by a newer version of protoc which is
^~~~~
.../include/tensorflow/core/framework/tensor.pb.h:13:2: error: #error incompatible with your Protocol Buffer headers. Please update
#error incompatible with your Protocol Buffer headers. Please update
^~~~~
.../include/tensorflow/core/framework/tensor.pb.h:14:2: error: #error your headers.
#error your headers.
^~~~~
.../include/tensorflow/core/framework/tensor.pb.h:27:10: fatal error: google/protobuf/inlined_string_field.h: No such file or directory
#include <google/protobuf/inlined_string_field.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
So, clearly this should be the issue:
This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer headers. Please update your headers.
and
fatal error: google/protobuf/inlined_string_field.h: No such file or directory
Tried solutions:
I tried different versions of protobuf but there was an error every single try.
I tried installing protobuf and eigen manually (without the download_dependencies.sh script)
I'm wondering because my own installation following exact the same steps works properly. Maybe there is an issue with one of the components unless I tried different versions to make sure that these aren't "new" issues.
Can someone help me solving this error that I can compile and run this project at the other machine?
Looking forward to get helpful solutions :) Thank you very much for the support!
Best regards from Germany!
First, I checked on github, tensorflow r1.9 requires protobuf >=3.6.0. With download_dependencies.sh script, you always get protobuf 3.5.0, in which lack of inlined_string_field.h and some other headers.
Second, some errors that ask you to update protobuf version. I tried many versions of protobuf too. Only version 3.6.0 works well, rather than version 3.6.1 or older ones.
For these errors,
error This file was generated by a newer version of protoc which is
fatal error: google/protobuf/inlined_string_field.h: No such file or directory
It is a mismatch version problem. My solutions is that manually download protobuf 3.6.0 from
https://github.com/protocolbuffers/protobuf/releases/download/v3.6.0/protoc-3.6.0-linux-x86_64.zip
install it and cp /usr/local/include/google to somewhere/tf/include. It works quite well for me. I don't know if you tried version 3.6.0.
download_dependencies.sh script would provide a mismatch version of
protobuf. See the issue I posted on github
https://github.com/tensorflow/tensorflow/issues/22536
Also, I noticed your copied files are different from mine. I did in this way.
sudo mkdir /usr/local/tensorflow/include
sudo cp -r tensorflow/contrib/makefile/downloads/eigen/Eigen /usr/local/tensorflow/include/
sudo cp -r tensorflow/contrib/makefile/downloads/eigen/unsupported /usr/local/tensorflow/include/
sudo cp -r tensorflow/contrib/makefile/gen/protobuf/include/google /usr/local/tensorflow/include/
sudo cp tensorflow/contrib/makefile/downloads/nsync/public/* /usr/local/tensorflow/include/
sudo cp -r bazel-genfiles/tensorflow /usr/local/tensorflow/include/
sudo cp -r tensorflow/cc /usr/local/tensorflow/include/tensorflow
sudo cp -r tensorflow/core /usr/local/tensorflow/include/tensorflow
sudo mkdir /usr/local/tensorflow/include/third_party
sudo cp -r third_party/eigen3 /usr/local/tensorflow/include/third_party/
sudo mkdir /usr/local/tensorflow/lib
sudo cp bazel-bin/tensorflow/libtensorflow_*.so /usr/local/tensorflow/lib
Btw, I run build_all_linux.sh instead of download_dependencies.sh.
I hope it will be helpful for you.
I meet this problem before, following is my solution:
I successfully built tensorflow-r1.8 with bazel. And I found protoc in following path is 3.5.0:
/home/zsb/.cache/bazel/_bazel_zsb/1372f28eb0671f692e7ac38330377d8c/execroot/org_tensorflow/bazel-out/host/bin/external/protobuf_archive/protoc --version
but actually my system config is using protoc version 3.4.0
I confirmed this by type "protoc --version" directly.
So finally I update system protobuffer version to 3.5.0 and this problem fixed.

Makefile error raspberry-pi 3

I have an issue with Codelite compilation, running on raspbian jessie - these are the (known) steps I have taken to produce it.
First I installed Codelite with apt-get install Codelite, then produced a c++ project.
When running build project I get the error:
/bin/sh -c ' -j 4 -e -f Makefile'
/bin/sh: 1: -j: not found
0 errors, 0 warnings
I note that this error has been found and corrected previously, through running a different version of Codelite from 6.1.1 (that which apt-get installs). I therefore found the updated version of armhf .deb codelite from the rasbian archive with gdebi-gtk. However the updated version (9.1.1) produces the following error (install attempt with the graphical debian):
Error: Dependency is not satisfiable: libclang 1-3.8 (>=3.2)
I do not understand why the package manager cannot update these packages - do they not exist for the pi? I ran the manager as root, so I do not think it is a permissions issue.
EDIT 1:
Thank you for that Fabre. My Enviromental Variables file now looks like this:
CodeLiteDir=/usr/share/codelite
export MAKE=make
I still get the same error however.

autotools syntax error with ax_check_compile_flag

I am using autotools for building my C++ application. In my configure.ac I have the following line:
AX_CHECK_COMPILE_FLAG([-Wall], [CPPFLAGS="$CPPFLAGS -Wall"])
which causes the following error when executing ./configure (after running autoreconf -i):
./configure: line 3825: syntax error near unexpected token `-Wall,'
./configure: line 3825: `AX_CHECK_COMPILE_FLAG(-Wall, CPPFLAGS="$CPPFLAGS -Wall")'
My system: Linux web 3.2.0-4-amd64 #1 SMP Debian 3.2.65-1+deb7u2 x86_64 GNU/Linux
On my Ubuntu machine it works well, why do I get this error?
autoreconf isn't magic (though I encounter package maintainers who obviously believe this). When you ran autoreconf, it failed to find the AX_CHECK_COMPILE_FLAG macro, and produced a corrupt configure script. Usually that produces an error/diagnostic message at the same time.
'AX_CHECK_COMPILE_FLAG` comes from the autoconf archive project, and Debian has a package which provides this, named autoconf-archive. Likely, you forgot to install it:
sudo apt-get install autoconf-archive