CMake install directory permission - eclipse

I have built a project using cmake (LLVM project) and tried to install it by issuing the following command:
$ cmake3 --build . --target install
If I run it using root then there is no problem and the files will be installed under the directory /usr/local/.
My problem is when I want to install the project using normal user.
I get the following error:
CMake Error at cmake_install.cmake:36 (file):
file INSTALL cannot set permissions on "/usr/local/include/llvm"
I have changed the permission of directory /usr/local/ to 777 recursively, and their ownership to root:wheel and I added my normal user to group wheel. But I still cannot install the files into the /usr/local/ directory.
The main issue is about building project in Eclipse which fails at "Build Install" command.

chmod 777 -R / is a very scary command. I've destroyed a system once by doing that.
The philosophy I use for this is:
If I need to deploy something through my IDE to debug or test before packaging, I deploy it locally within my home directory.
I only install stuff to my system (outside of home) if it has been packaged first (*.deb, *.rpm, *.tar.gz) so that I can remove it without problems.
For me, I do this with:
cmake $src
cmake --build . --target install -- DESTDIR=stage
This will configure my project, make it, then install it locally in a folder called ./stage which resides in my build directory. I can then run my executable from ./stage/usr/bin. Note that this only works if make is your generator.
Once I've tested it and I'm happy, I package it and deploy to my system or upload to a repository:
cpack
sudo dpkg -i <package>.deb

We should use USE_SOURCE_PERMISSIONS in our install function.
Example:
install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Release/" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}" USE_SOURCE_PERMISSIONS)

Related

Installation of protoc-gen-grpc-web

I am currently working on using grpc-web to write a simple client for my service. I have created a service.proto file which was successfully compiled using protoc. The problem arose when I tried to generate the gRPC-Web service client stub using the plugin protoc-gen-grpc-web which doesnt work despite having installed the latter.
Got the following error :
protoc -I=./ service.proto --grpc-web_out=import_style=commonjs,mode=grpcwebtext:./
protoc-gen-grpc-web: program not found or is not executable
--grpc-web_out: protoc-gen-grpc-web: Plugin failed with status code 1.
Any suggestions on how to solve this issue? Thank you!
You'll need to make the protoc-gen-grpc-web plugin executable and move it to a directory that is discoverable from your PATH environment variable.
From grpc-web/README:
For example, in MacOS, you can do:
$ sudo mv ~/Downloads/protoc-gen-grpc-web-1.2.1-darwin-x86_64 \
/usr/local/bin/protoc-gen-grpc-web
$ chmod +x /usr/local/bin/protoc-gen-grpc-web
You don't even have to install the plugin globally and make it discoverable from your PATH:
protoc accepts --plugin arguments to point to a required plugin. For protoc-gen-grpc-web (as for many others) there's even npm support, so you can get it with npm i --save-dev protoc-gen-grpc-web and then run protoc with --plugin=protoc-gen-grpc-web=./node_modules/.bin/protoc-gen-grpc-web
I'm using MacOS. You need to install this first with brew
$ brew install protoc-gen-grpc-web
The best solution that I could use for Linux based system was globally installing protoc-gen-grpc-web. This directly takes the files from the /bin of the node_modules files created globally across your system
sudo npm install -g protoc-gen-grpc-web

pyrcc5: No such file or directory

I want to install labelImg for mac OS in python 3.7. here is the repo: https://github.com/tzutalin/labelImg
I have installed previous modules via 'pip3 install pyqt5 lxml' successfully. Cloned the repo, entered the folder 'labelImg', but only 'make qt5py3' does not work..
but when I execute 'make qt5py3', i get the error
pyrcc5 -o libs/resources.py resources.qrc
make: pyrcc5: No such file or directory
make: *** [qt5py3] Error 1
What can I do here? What might have caused the issue?
-find 'pyrcc5' under python bin, and copy 'path'
-under labelImg find 'Makefile' and edit
-change line
qt5py3: pyrcc5 to qt5py3: 'copied path'/pyrcc5
and save
-and
make qt5py3
python labelImg.py
should works.
I had the same issues as the OP, but with Python 3.6.11. In addition, I got ModuleNotFoundErrors for pyqt5 and libxml2, even though brew confirmed they were both installed. Also, I was trying to install in a virtual environment set up using pyenv.
What finally worked for me was:
1) use global env, not virtual
2) use pip (not pip3) to install pyqt5 and lxml
3) change the makefile as #zippo suggested
After I did that, I was able to get labelImg to start by running:
python labelImg.py

Cpplint could not find executable

I am trying to activate cpplint within vs code. I have installed it in Anacanda environment where executable
/home/ubuntu/anaconda3/bin/cpplint
I have a link to it
ls -l /home/ubuntu/anaconda3/bin/cpplint
Unfortunately per visual code cpplint extension still getting error of "Cpplint could not find executable"
Please, advice to configure it correctly.
Download and install
sudo apt-get install python-pip
pip install --user cpplint
Verify install result
ls -l /usr/local/bin/cpplint
If you still have issues check cpplint.cpplintPath and verify the execution path is set correctly.
Also, if you installed cpplint into ~/.local/ directories, by default ~/.local/bin is not included in PATH. So to fix just that add:
export PATH=$PATH:~/.local/bin/
to your ~/.bashrc

Docker: kafka confluent go client error

I am trying to use apache kafka with go, things look good when i execute the project with go run but when i use docker build i get error....
# pkg-config --cflags rdkafka
Package rdkafka was not found in the pkg-config search path.
Perhaps you should add the directory containing `rdkafka.pc'
to the PKG_CONFIG_PATH environment variable
No package 'rdkafka' found
pkg-config: exit status 1
I installed librdkafka from https://github.com/confluentinc/confluent-kafka-go
git clone https://github.com/edenhill/librdkafka.git
cd librdkafka
./configure --prefix /usr
make
sudo make install
I tried
PKG_CONFIG_PATH=/usr/lib/pkgconfig
source ~/.bashrc
but not luck. Any help is appreciated.
Probably you should include librdkafka.dll, msvcr120.dll and zlib.dll in your project root. At least this is what i should do to get this work on Windows. Not sure about Linux.
This below line inside the Dockerfile worked for me as this sets the environmental variable and this will persist when a container is run from the resulting image.
ENV PKG_CONFIG_PATH ${PKG_CONFIG_PATH}:/usr/lib/pkgconfig/

How to enable pcntl extensions in MAMP pro?

I am using laravel/horizon with Osx MAMP pro
when I run the composer it requires laravel/horizon:~1.0
it shows a message -
laravel/horizon v1.0.8 requires ext-pcntl * -> the requested PHP
extension pcntl is missing from your system.
I checked the folder /Applications/MAMP/bin/php7.1.1/php/ext,it doesn't contain pcntl extension.
How can I install that?
download php from http://www.php.net/releases/
tar -xzvf php-7.2.1.tar.gz
cd php-7.2.1/ext/pcntl
/Applications/MAMP/bin/php/php7.2.1/bin/phpize
as # drewjoh metioned ./configure --with-php-config=/Applications/MAMP/bin/php/php7.2.1/bin/php-config --prefix=/Applications/MAMP/bin/php/php7.2.1/bin/php
make && make install
the terminal shows
Installing shared extensions: /Applications/MAMP/bin/php/php7.2.1/lib/php/extensions/no-debug-non-zts-20170718/
open MAMP PRO menu->File ->Edit Template->PHP->7.2.1 add extension=pcntl.so at the end of the php.ini file .
run the command php --ri pcntl and shows
pcntl pcntl support => enabled
Just an addition. Perhaps you followed the above step and still can't get it installed to /Applications/MAMP/bin/php/php7.2.1/lib/php/extensions/no-debug-non-zts-20170718/. Here is something I did that worked for me.
I added the --with-php-config before the --prefix flag and it worked. See step below.
download your MAMP php version from http://www.php.net/releases/ Mine is php7.2.22
Open your terminal and cd into your download folder. Then run this command to decompress the tar.gz file
tar -xzvf php-7.2.22.tar.gz
Cd into the pcntl directory after decompressing.
cd php-7.2.22/ext/pcntl
Run the next line from your terminal to Configure for PHP Api, Zend Module Api, and Zend Extension Api.
/Applications/MAMP/bin/php/php7.2.22/bin/phpize
Then run
./configure --with-php-config=/Applications/MAMP/bin/php/php7.2.22/bin/php-config --prefix=/Applications/MAMP/bin/php/php7.2.22/bin/php; make && make install;
You should see
Installing shared extensions: /Applications/MAMP/bin/php/php7.2.22/lib/php/extensions/no-debug-non-zts-20170718/
Then you can repeat the last two steps above.
You can download the precompiled extensions from here https://github.com/khanakiaphp/mamp_extensions