Generated codes of protobuf are different between two mac - protocol-buffers

I'm using two mac. The results of compiling of protobuf are not the same. I have no idea.
Please help me.
docker run --rm -v$PWD:$PWD -w $PWD thethingsindustries/protoc \
--java_out=$PWD/java \
-I:${PWD} \
--grpc-java_out=$PWD/java \
mypath/*.proto
For example,
Both uses 3.15.5 version protobuf installed by brew.

Related

Missing OCI support when building GDAL

So I am building a DOTNET application that runs on Debian, and makes use of ogr2ogr to copy data from an oracle database towards an Postgres database.
The problem is that I cannot get GDAL to recognize the OCI driver.
These are the installation commands that I have collected for now:
#Install dependencies used by GDAL and ora2pg
apt-get update && apt-get install -y -q --no-install-recommends \
libc-bin unzip curl ca-certificates rpm libaio1 \
#Package manager for installing Oracle
alien \
# Install postgresql
postgresql-client \
# Used for the POSTGRES_HOME variable
libpq-dev \
#Package manager used for installation of perl database drivers
cpanminus \
# Proj build
sqlite libsqlite3-dev pkg-config g++ make
#Install Oracle
curl -o oracle-instantclient-basic.x86_64.rpm https://download.oracle.com/otn_software/linux/instantclient/199000/oracle-instantclient19.9-basic-19.9.0.0.0-1.x86_64.rpm
curl -o oracle-instantclient-devel.x86_64.rpm https://download.oracle.com/otn_software/linux/instantclient/199000/oracle-instantclient19.9-devel-19.9.0.0.0-1.x86_64.rpm
curl -o oracle-instantclient-sqlplus.x86_64.rpm https://download.oracle.com/otn_software/linux/instantclient/199000/oracle-instantclient19.9-sqlplus-19.9.0.0.0-1.x86_64.rpm
alien -i oracle-instantclient-basic.x86_64.rpm && alien -i oracle-instantclient-devel.x86_64.rpm && alien -i oracle-instantclient-sqlplus.x86_64.rpm
EXPORT ORACLE_HOME=/usr/lib/oracle/19.9/client64
EXPORT TNS_ADMIN=/usr/lib/oracle/19.9/client64/network/admin
EXPORT LD_LIBRARY_PATH=/usr/lib/oracle/19.9/client64/lib
EXPORT PATH=$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/oracle/19.9/client64/bin
#Install Postgres en Oracle drivers for perl, ora2pg
cpanm DBD::Oracle
cpanm DBD::Pg
#Setup
wget https://download.osgeo.org/proj/proj-6.3.2.tar.gz
tar -zxf proj-6.3.2.tar.gz -C /opt/
/opt/proj-6.3.2/configure --prefix=/usr --disable-static --enable-lto
make -C /opt/proj-6.3.2/
make install -C /opt/proj-6.3.2/
RUN wget http://download.osgeo.org/gdal/3.2.2/gdal-3.2.2.tar.gz
/opt/gdal-3.2.2/configure
make -C /opt/proj-6.3.2/
make install -C /opt/proj-6.3.2/
Is there anyone who can tell me what I am missing, because I cannot find any answers on the internet...
So after a lot off testing, my colleague found the problem.
Apparently the scripts search for a folder in $ORACLE_HOME/sdk.
Now by installing it, like above, it doesn't install the sdk folder on the correct location.
So we solved it by adding an extra step extracting the SDK zip package on the correct location.
This is the result:
Dockerfile
Above solution did not work for me. I needed a GDAl container with OCI. Based on some other info I found I build an image that works.
https://github.com/botenvouwer/gdal-oci
Currently you have to clone and build the image yourself. You should (but don't have to) pass the version to your docker build as ARG GDAL_VERSION.

How to use gifsicle in AWS lambda

Is there a way to use gifsicle in AWS lambda?
I know there is a package called pygifsicle, but it seems it requires the gifsicle version of AWS Linux 2?
I don't see a binary built for RedHat version of gifsicle
So my questions are,
Do I need to build one for AWS Linux 2 to use it along with pygifsicle?
Even if I build gifsicle for AWS Linux 2, how to use it along with pygifsicle?
As I read the documentation you can build one binary for Building Gifsicle on UNIX and can package that with your lambda zip file which can be called as a normal command in lambda function.
Like it is being called in the pygifsicle
subprocess.call(["gifsicle", *options, *sources, "--colors",
str(colors), "--output", destination])
My Dockerfile where I'm building it from the source.
FROM public.ecr.aws/lambda/python:3.8-arm64
RUN yum -y install install make gcc wget gzip
RUN wget https://www.lcdf.org/gifsicle/gifsicle-1.93.tar.gz
RUN tar -xzf gifsicle-1.93.tar.gz
RUN cd gifsicle-1.93 && \
./configure && \
make && \
make install
COPY requirements.txt ./
RUN yum update -y && \
pip install -r requirements.txt
COPY . .
CMD ["app.handler"]

OpenCV3 installation on Mac

I tried to install OpenCV3 for Mac with the following command in terminal:
brew install opencv3 --with-contrib -with-ffmpeg
It repeatedly gets stuck at this point:
cmake .. -DCMAKE_C_FLAGS_RELEASE=-DNDEBUG -DCMAKE_CXX_FLAGS_RELEASE=-DNDEBUG -DCMAKE
Can someone please tell me how to fix this?
You need to install Xcode command line tools first. Go to the AppStore and download and install Xcode from Apple for free.
Then run:
xcode-select --install
to get make,cmake, and all the command-line development tools.
Also, consider adding the QuickTime back-end, by additionally specifying --with-qt5, i.e.:
brew install opencv3 --with-contrib -with-ffmpeg --with-qt5
That gives you extra options to save the images you generate and display with the highgui module.
I also had the exact same issue. Someone else had also reported this problem on the brew github, but they could also not reproduce the issue. In my case though, it would go a step further and get stuck after calling make for hours:
cmake .. -DCMAKE_C_FLAGS_RELEASE=-DNDEBUG -DCMAKE_CXX_FLAGS_RELEASE=-DNDEBUG -DCMAKE
make
I went ahead and tracked the processes in the Activity Monitor on my Mac and found out that it kicks off a batch of clang processes in sequence on multiple threads. But I had several apps running that were robbing it of CPU and Memory resources. So I shut down Safari, Finder, IDEs (XCode, PyCharm) etc, and this time it did complete.
Solution: was to just let it run with as much CPU and memory overhead it needs. And with no other power-hungry apps running in the background, it finished in 25mins.
CMake Approach:
Your next best approach is to bypass using package manager, like brew, and follow the instructions given on PyImageSearch to build OpenCV manually using CMake:
Install dependencies like CMake, pkg-config (and possibly others...)
Clone OpenCV and OpenCV_Contrib git repos:
https://github.com/opencv/opencv
https://github.com/opencv/opencv_contrib
Checkout version [e.g. 3.2.0]
Make build directory inside opencv directory
Run CMake with the appropriate parameters for your system:
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local/opencv3 \
-D PYTHON2_PACKAGES_PATH=/usr/local/lib/python2.7/site-packages \
-D PYTHON2_LIBRARY=/usr/local/opt/python/bin \
-D PYTHON2_INCLUDE_DIR=/usr/local/Frameworks/Python.framework/Headers \
-D BUILD_OPENCV_PYTHON2=ON \
-D INSTALL_C_EXAMPLES=OFF \
-D INSTALL_PYTHON_EXAMPLES=OFF \
-D BUILD_EXAMPLES=OFF \
-D OPENCV_EXTRA_MODULES_PATH=/Users/Salman_Naqvi/Downloads/opencv_contrib/modules ..
Compile using: make -j4
Install it on MacOS: make install
--> It'll be installed in the directory specified by: CMAKE_INSTALL_PREFIX=/usr/local/opencv3

Cannot find JHipster's mvn command with container

I'm using Bitbucket's Pipelines to automate my deployments. I am working on an Angular Project but use Maven to deploy my artifacts.
I was looking around to find a Docker container that contained both npm and maven and came across jhipster (v3.7.1). After installing, I cannot run "mvn" or "./mvnw" in any way. It says the command cannot be found.
Suggestions appreciated. In the meantime, I'm using pbarnoux/maven-angular and this container works fine.
if you have a closer look at the jhipster dockerfile you can see that maven is not installed i.e. the command is not available and your information that mvn cannot be run is correct. As a solution you cold add the maven at a package to all the other utilities to be installed:
# install utilities apt-get install -y \
maven \
wget \
curl \
vim \
git \
zip \
bzip2 \
fontconfig \
python \
g++ \
build-essential && \

Install opencv 3.0.0-beta on ubuntu 14.04 with anaconda python 2.7

Please can anyone help with what to change on installing opencv 3.0.0-beta on ubuntu 14.04 having GPU running theano so that it doesn't remove my nvidia as it did intially. I use anaconda python 2.7 and after installing opencv, it works with c++ example but not with python example because of Error importing module cv2. Figured out its not linking with python and "install conda cv2" but it asks to make cmake. I did but that does not complete successfully anymore. Any help. Thanks on what to change in cmake in the link
https://askubuntu.com/questions/537268/installing-opencv-in-ubuntu-14-04
I was having a similar issue getting OpenCV 3.0 beta to compile with the python wrappers using Anaconda. I ended up using the following call to cmake:
cd <open_cv_source_directory>
mkdir RELEASE
cd RELEASE
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/home/<user>/opencv \
-D PYTHON_INCLUDE_DIR=/home/<user>/anaconda/include/python2.7/ \
-D PYTHON_INCLUDE_DIR2=/home/<user>/anaconda/include/python2.7 \
-D PYTHON_LIBRARY=/home/<user>/anaconda/lib/libpython2.7.so \
-D PYTHON_PACKAGES_PATH=/home/<user>/anaconda/lib/python2.7/site-packages/ \
-D BUILD_EXAMPLES=ON \
-D BUILD_NEW_PYTHON_SUPPORT=ON \
-D PYTHON2_LIBRARY=/home/lm/anaconda/lib/libpython2.7.so \
-D BUILD_opencv_python3=OFF \
-D BUILD_opencv_python2=ON ..
I'm not sure if all of that was needed, but it now configures correctly and then builds/installs correctly.
I was facing similar problem as you. OpenCV 3.0 beta has to be built from source and there is some bug in CMake due to which the CMake will not link the Python libs.
One option is to follow this excelent tutorial Install opencv for Python 3.3
It is for Python 3.3 but I was able to compile against 2.7.9 just fine. If you are using CMake GUI you can check in the output, after you run generete, which modules will be built and which won't.
When I just launched the CMake it successfully found all required libs and all was fine. But when I changed some settings it failed to find Python. So I think you are better off using the command line tool and specify manually all the options you need.
Yes, there is something wrong with the cmake script of opencv3.0.0, when dealing with anaconda installed in a local directory. I tried to config the cmake build options as instructed in http://docs.opencv.org/3.0.0/d7/d9f/tutorial_linux_install.html , but it turned out that python libs could not be correctly found. Then, i tried multiple combinations of cmake build options and found the following works:
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/home/css/opencv-3.0.0 -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D OPENCV_EXTRA_MODULES_PATH=/home/css/opencv-code/opencv_contrib/modules -D BUILD_EXAMPLES=ON -D BUILD_opencv_python2=ON -D PYTHON2_EXECUTABLE=/home/css/anaconda2/bin/python -D PYTHON_INCLUDE_DIR=/home/css/anaconda2/include/python2.7 -D PYTHON_INCLUDE_DIR2=/home/css/anaconda2/include/python2.7 -D PYTHON_LIBRARY=/home/css/anaconda2/lib/libpython2.7.so -D PYTHON2_NUMPY_INCLUDE_DIRS=/home/css/anaconda2/lib/python2.7/site-packages/numpy/core/include ..
When finish make & make install, just link cv2.so under /lib/python2.7/site-packages/cv2.so into anaconda's site-packages

Resources