Error When Importing ROS Projects & Workspace in CLion - bash

I wanted to give CLion a try for working with the ROS source code. I created a ROS Workspace and have the following folder structure:
joesan#joesan-InfinityBook-S-14-v5:~/Projects/Private/ros-projects$ cd catkin_ws/
drwxrwxr-x joesan joesan 4 KB Sun Aug 30 10:48:27 2020  .
drwxrwxr-x joesan joesan 4 KB Sun Aug 30 10:48:10 2020  ..
.rw-rw-r-- joesan joesan 98 B Sun Aug 30 10:48:27 2020  .catkin_workspace
drwxrwxr-x joesan joesan 4 KB Sun Aug 30 10:48:27 2020  build
drwxrwxr-x joesan joesan 4 KB Sun Aug 30 10:48:26 2020  devel
drwxrwxr-x joesan joesan 4 KB Sun Aug 30 12:13:50 2020  src
joesan#joesan-InfinityBook-S-14-v5:~/Projects/Private/ros-projects/catkin_ws$
I have sourced this location in the .bash_profile as below:
# Dynamically source all setup.bash files from multiple catkin ros workspaces
find /home/joesan/Projects/Private/ros-projects -wholename '*/devel/setup.bash' | xargs source
I then source the .bash_profile from within my .bashrc
Now, when I tried to open the project in CLion, I see the following error:
CMake Error at CMakeLists.txt:65 (message):
find_package(catkin) failed. catkin was neither found in the workspace nor
in the CMAKE_PREFIX_PATH. One reason may be that no ROS setup.sh was
sourced before.
I launch CLion via a Desktop shortcut entry that I created. How do I make CLion aware of this .bash_profile such that it can find catkin?

I managed to fix this by doing the following, but make sure that you have a Desktop entry created for Jetbrains CLion beforehand!
Open the jetbrains-clion.desktop located in the .local folder:
~/.local/share/applications/jetbrains-clion.desktop
In this desktop entry, modify the Exec= line as:
Exec=bash -i -c "/opt/softwares/clion-2020.2.1/bin/clion.sh" %f

Related

Multi-root setup

I got this message when editing my Go project in vscode:
The Go language server is currently not supported in a multi-root set-up with different GOPATHs.
My question is: what is a "multi-root-set-up"? I do not intend to make my project "multi-root". How to avoid this message, and let the language server analyze my code?
BTW, the directory layout of my project is:
drwxrwxr-x 5 xrfang xrfang 4096 1月 21 22:33 docs
drwxrwxr-x 2 xrfang xrfang 4096 1月 21 22:33 exp
-rw-rw-r-- 1 xrfang xrfang 789 2月 3 20:52 Makefile
drwxrwxr-x 3 xrfang xrfang 4096 2月 12 22:03 pkg
drwxrwxr-x 7 xrfang xrfang 4096 1月 31 11:56 resources
drwxrwxr-x 8 xrfang xrfang 4096 2月 12 21:27 src
-rw-rw-r-- 1 xrfang xrfang 304 1月 21 22:33 TODO
-rwxrwxr-x 1 xrfang xrfang 395 1月 21 22:33 upgrade.sh
drwxrwxr-x 2 xrfang xrfang 4096 2月 12 21:28 utils
The go.mod file is in src directory. And pkg is generated by the compiler, which is quite strange, because most of my other Go project does not generate pkg in the repository folder.
If you are using modules (go.mod), try to open vscode from the directory where go.mod exists.
If you are using GOPATH with the multiple paths and your intention is to work in the GOPATH mode, that's not supported as Ian said.
I hope https://github.com/golang/vscode-go#setting-up-your-workspace provides more info.
Also, make sure to have "go.inferGopath" setting disabled. I suspect the repository has been structured to work with the GOPATH mode and append the workspace root to the GOPATH. It's possible that vscode Go plugin + gopls does not like it. :-(
The error message is referring to your GOPATH environment variable. GOPATH permits multiple paths separate by a colon, but gopls does not support that.

After deleting Gradle's build cache and building, some tasks are still marked as FROM-CACHE

I start off by deleting Gradle's build cache
$ rm -rf $GRADLE_HOME/caches/build-cache-*
I manually confirm this directory is gone. I also clean to ensure nothing from incremental build will interfere
$ ./gradlew clean
I then run a build w/ build-cache enabled:
$ ./gradlew --build-cache --scan app:assembleDebug
...
238 actionable tasks: 172 executed, 49 from cache, 17 up-to-date
Checking the generated report I see that some tasks are still marked as FROM-CACHE. How is this happening?
FWIW I'm using Gradle 5.6.3. I also don't use a remote build cache.
UPDATE: after clearing build cache, here's what's left in the cache dir:
$ pwd
/Users/jasonatwood/.gradle/caches
$ ls -al
total 24
drwx------ 11 jasonatwood staff 352 Dec 13 18:11 .
drwxr-xr-x 9 jasonatwood staff 288 Oct 15 17:24 ..
drwxr-xr-x 14 jasonatwood staff 448 Oct 29 16:07 5.4.1
drwxr-xr-x 15 jasonatwood staff 480 Nov 26 18:25 5.6.3
drwxr-xr-x 35 jasonatwood staff 1120 Dec 11 14:14 jars-3
drwxr-xr-x 5 jasonatwood staff 160 Oct 15 17:44 journal-1
drwxr-xr-x 7 jasonatwood staff 224 Oct 15 17:50 modules-2
drwxr-xr-x 5 jasonatwood staff 160 Oct 15 17:50 transforms-2
-rw-r--r-- 1 jasonatwood staff 39 Oct 15 17:27 transforms-2.lock
-rw------- 1 jasonatwood staff 28 Oct 22 16:34 user-id.txt
-rw-r--r-- 1 jasonatwood staff 17 Dec 13 18:00 user-id.txt.lock
If I understand correctly, I don't need to delete any of these.
The local task cache in the .gradle directory within the root project might interfere.
In order to disable the local/global caching altogether, use gradle.properties:
org.gradle.caching=false
If you remove the local build cache and don't use a remove cache, Gradle should indeed not be able to fetch anything cached on the next build. However, I don't think you actually removed anything.
The GRADLE_HOME environment variable, if you have it, should points to an unpacked local Gradle distribution. It could be something like /Users/jasonatwood/gradle-6.0-all. It would be wrong to set it to a path that is not a Gradle distribution.
The Gradle build cache resides in /Users/jasonatwood/.gradle/caches/build-cache-1.
When you try to remove it with $ rm -rf $GRADLE_HOME/caches/build-cache-*, you are using GRADLE_HOME as if it is pointing to the root of your home folder (/Users/jasonatwood), which it most likely isn't.
So instead, use this for removing it: $ rm -rf ~/.gradle/caches/build-cache-*
Or, at the very least, verify that the cache folder has indeed been removed.
If I run a --scan and look at the FROM-CACHE tasks in the generated HTML report.
I then look at the build cache keys for those FROM-CACHE tasks. I then go find those keys on my local machine. I see they are generated at the same time as the rest of the build. So I'm guessing that Gradle is using build cache within a build and not just across builds.
Sometimes there is a need to invalidate cache every time you restart the IDEA. This may be due to shared indexes reuse. What I did Settings --> Tools --> Shared Indexes -> Download Automatically and it resolved all the pain.
Earlier the setting was Don't download use Local.

How to fix symbol __vdso_clock_gettime, version GLIBC_PRIVATE not defined in file libc.so.6 with link time reference [duplicate]

This question already has answers here:
Multiple glibc libraries on a single host
(11 answers)
Closed 4 years ago.
when I try to fix the problem /lib64/libc.so.6: version 'GLIBC_2.14' not found in CentOS 6 system by install latest glibc version to my home directory, I found my computer crashed.
$ conda
/public/home/liuxs/anaconda3/bin/python: relocation error: /lib64/librt.so.1: symbol __vdso_clock_gettime, version GLIBC_PRIVATE not defined in file libc.so.6 with link time reference
$ python
python: relocation error: /lib64/librt.so.1: symbol __vdso_clock_gettime, version GLIBC_PRIVATE not defined in file libc.so.6 with link time reference
I try my best to remove all the thing I have done and google to fix this, I failed. I cannot understand the problem, how it occurs and which part should I focus -- libc.so.6 or librt.so.1? Which is the key.
I have no root permission, so I cannot change the files for lib, lib64 etc.
$ ls -l $(locate librt.so.1)
lrwxrwxrwx 1 root root 13 Jul 6 2017 /lib64/librt.so.1 -> librt-2.12.so
lrwxrwxrwx 1 root root 17 Jul 6 2017 /lib64/rtkaio/librt.so.1 -> librtkaio-2.12.so
lrwxrwxrwx 1 root root 13 Aug 1 2017 /lib/i686/nosegneg/librt.so.1 -> librt-2.12.so
lrwxrwxrwx 1 root root 13 Aug 1 2017 /lib/librt.so.1 -> librt-2.12.so
lrwxrwxrwx 1 root root 17 Aug 1 2017 /lib/rtkaio/i686/nosegneg/librt.so.1 -> librtkaio-2.12.so
lrwxrwxrwx 1 root root 17 Aug 1 2017 /lib/rtkaio/librt.so.1 -> librtkaio-2.12.so
$ ls -l $(locate libc.so.6)
lrwxrwxrwx 1 root root 19 Dec 25 13:51 /lib64/libc.so.6 -> /lib64/libc-2.12.so
lrwxrwxrwx 1 root root 12 Aug 1 2017 /lib/i686/nosegneg/libc.so.6 -> libc-2.12.so
lrwxrwxrwx 1 root root 12 Aug 1 2017 /lib/libc.so.6 -> libc-2.12.so
I also have these two files in conda directory, which can not be locate
$ ls -l $(find . -name "libc.so.6")
-rwxrwxr-x 1 liuxs liuxs 3985000 Jun 21 2017 ./lib/libc.so.6
lrwxrwxr-x 1 liuxs liuxs 14 May 10 19:26 ./pkgs/gcc_impl_linux-64-7.2.0-habb00fd_3/x86_64-conda_cos6-linux-gnu/sysroot/lib/libc.so.6 -> libc-2.12.2.so
lrwxrwxr-x 1 liuxs liuxs 14 Mar 28 12:06 ./x86_64-conda_cos6-linux-gnu/sysroot/lib/libc.so.6 -> libc-2.12.2.so
[liuxs#HPC-login anaconda3]$ ls -l $(find . -name "librt.so.1")
lrwxrwxr-x 1 liuxs liuxs 15 Mar 28 11:25 ./pkgs/gcc_impl_linux-64-7.2.0-habb00fd_3/x86_64-conda_cos6-linux-gnu/sysroot/lib/librt.so.1 -> librt-2.12.2.so
lrwxrwxr-x 1 liuxs liuxs 15 Mar 28 12:06 ./x86_64-conda_cos6-linux-gnu/sysroot/lib/librt.so.1 -> librt-2.12.2.so
I think maybe it's file in anaconda3 make this error but I dont know how to locate the source of problem. And I dont know when I run conda or python, which librt.so.1 and libc.so.6 the commands use.
Hope someone can help me out of this.
I found how to fix this, the problem came from
-rwxrwxr-x 1 liuxs liuxs 3985000 Jun 21 2017 ./lib/libc.so.6
I change its name fro backup, and the system is okay now. Even though I don't very understand why it works. But the interesting thing is No matter where the file libc.so.6 is, the system will give an error. Maybe it's not a good answer, I modify its name from ./lib/libc.so.6 to ./lib/libc.so.6.bk in case I need it latter.
Thanks comment from #nos.
You are trying to run a program that is fundamentally incompatible
with the runtime of your CentOS 6 machine. You should find a pre-built
binary that is suitable for CentOS 6, or if this is an open source
project, build it yourself

Go Project in IntelliJ Not Resolving Dependencies

I have IntelliJ CE and I just imported a Go project that I cloned from GitHub. On my Mac, I have some folder organization where I group projects that I work on based on the technologies. For example., in my Projects folder on my Mac, I have the following sub folders:
- go-projects
- scala-projects
- rust-projects
- ruby-projects
So I obviously checked out the Go project in the go-projects folder which looks like this:
Joes-MacBook-Pro:go-projects joe$ ll
total 0
drwxr-xr-x 3 joe staff 102B Oct 28 07:51 bin/
drwxr-xr-x 19 joe staff 646B Oct 24 06:48 golang-restful-starter-kit/
drwxr-xr-x 3 joe staff 102B Oct 28 07:51 pkg/
drwxr-xr-x 3 joe staff 102B Oct 27 10:23 src/
And if I get into the src folder, it looks like this:
Joes-MacBook-Pro:go-projects joe$ cd src
total 0
drwxr-xr-x 6 joe staff 204B Nov 7 19:14 github.com/
Joes-MacBook-Pro:src joe$ cd github.com/
total 0
drwxr-xr-x 3 joe staff 102B Oct 28 08:20 btcsuite/
drwxr-xr-x 16 joe staff 544B Nov 7 19:16 eth-client/
drwxr-xr-x 3 joe staff 102B Oct 27 10:24 ethereum/
drwxr-xr-x 3 joe staff 102B Oct 28 07:51 tools/
Joes-MacBook-Pro:github.com joe$
Here is my Go related environment settings:
# For Go projects, we set the GOPATH
export GOROOT="/usr/local/go"
export GOPATH="/Users/joe/Projects/Private/go-projects"
export GODEPS="/Users/joe/Projects/Private/go-projects/bin/godep"
Now I import one of the Go project into IntelliJ and I get to see the following error saying that it is not able to resolve a directory as it can be seen in the screenshot below!
How can I get rid of this error? Any ideas?
I just realized that when I clone the project, I should not do a git clone but rather do:
go get -u github.com/golang/lint/golint
Not sure why this is so, but after doing this my IntelliJ was able to resolve every file on my project!
For golang projects, it's good to have Goland installed ( also a product of JetBrains )Goland Download. Moreover for the above concern you can use:
go get *the_project_to_clone*

no ocijdbc12 in java.library.path sqldeveloper mac os

I am trying to get SQLDeveloper to work on my Mac laptop. I need to make a TNS connection but whenever I try to create one I get the error message: no ocijdbc12 in java.library.path.
I have latest instantclient installed and I only see these files:
instantclient_11_2:
total 380640
-rw-rw-rw-# 1 red staff 484 Apr 10 2014 BASIC_README
-rwxrwxrwx# 1 red staff 14348 Apr 10 2014 adrci
-rwxrwxrwx# 1 red staff 40768 Apr 10 2014 genezi
-r-xr-xr-x# 1 red staff 66167420 Feb 7 2014 libclntsh.dylib.11.1
-r-xr-xr-x# 1 red staff 2817872 Jan 29 2014 libnnz11.dylib
-r-xr-xr-x# 1 red staff 1897664 Feb 7 2014 libocci.dylib.11.1
-rwxrwxrwx# 1 red staff 118707148 Apr 10 2014 libociei.dylib
-r-xr-xr-x# 1 red staff 159004 Jan 7 2014 libocijdbc11.dylib
-r--r--r--# 1 red staff 2091135 Jan 28 2014 ojdbc5.jar
-r--r--r--# 1 red staff 2739616 Jan 28 2014 ojdbc6.jar
-rwxrwxrwx# 1 red staff 162380 Apr 10 2014 uidrvci
-r--r--r--# 1 red staff 66779 Jan 7 2014 xstreams.jar
There's a libocijdbc11.dylib but no libocijdbc12.dylib. What's up with that?
After a recent JAVA upgrade, my SqlDeveloper install stopped working, errors related to :
The native OCI driver could not be loaded. The system property java.library.path contains the entries from the environment variable 'DYLD_LIBRARY_PATH' check it to verify that the expected native library directory /usr/lib/java is present and precedes any other client installations.
I upgraded to SqlDeveloper 18.1.0 = no luck.
I tried many fixes - modifying '/.sqldeveloper/18.1.0/product.conf', futzing with $PATH, etc - they all failed
FINALLY - I upgraded the instant client to instantclient_12_2 IT WORKED!
Note - the place you set environment vars is now: ${HOME}/.sqldeveloper//env.sh
in my case, /Users/REDACTED/.sqldeveloper/18.1.0/env.sh contains:
export TNS_ADMIN="${HOME}/Downloads/instantclient_12_2"
export DYLD_LIBRARY_PATH=$TNS_ADMIN
export LD_LIBRARY_PATH=$TNS_ADMIN
export SQLPATH=$TNS_ADMIN
if ! echo $PATH | fgrep "${DYLD_LIBRARY_PATH}" /dev/null ; then
export PATH="${DYLD_LIBRARY_PATH}:${PATH}"
fi
This (using env.sh) is better than cluttering up your .bashrc files
My Solution:
Just use the setting in SQLDeveloper:
Tools > Preferences > Database > Advanced > Tnsnames Directory
Click Browse to select the location of the parent folder of your tnsnames file.

Resources