enable scl devtoolset

Completed

hi

 

I'm working using CLion from Win10 to CentOS(RHEL7),

and need to use non-default toolchain for the build 

my project cmake based and potentially can be built and debugged via CLion (without extra ssh commands and gdbserver run),

but I don't know how to apply scl enable devtoolset-X 

suppose to use bashrc or profile script.

the question is:

how does clion establish the connection to remote linux host? could you describe this in details for the understanding?

does it keep the connection between a builds ? or new one on each compilation? does deployment/ssh console host use the same? etc 

0
8 comments

Hello,

I think what you might be looking for is:

File -> Setting -> Build, Execution, Deployment -> Toolchain

Here you can see your setup, let us say you do everything locally, then you can directly point to devtoolset, example:

C Compiler: /opt/rh/devtoolset-7/root/usr/bin/gcc

C++ Compiler: /opt/rh/devtoolset-7/root/usr/bin/g++

Instead of the default C and C++ compiler (same for the Debugger).

You can use: "locate gcc | grep devtoolset" if you want to quickly find out where your devtoolset install is.

If you work on a remote system like it seems you do, then it is the same, in your remote toolchain you should be able to point to devtoolset.

Look on the top right of the "Toolchains" window and you will see a "System" or "Remote Host" drop-down list.

----

For your information the only thing devtoolset is doing for you is providing a newer version for C/C++ Compiler and other tools like CMake, Make, etc.

So all you have to do is tell CLion to point towards what devtoolset is providing.

When you do scl enable devtoolset, it is simply pointing towards what devtoolset provides.

Try:

g++ -v

scl enable devtoolset-7 bash

g++ -v

And you will see that the g++ version has changed after enabling devtoolset.

1

first case is mine 

CLion : Win10

Target app : CentOS

 

to apply devtoolset , I'm using .bashrc on remote host with an additional line something like:

source scl_source devtoolset-4

 

thank you for the first link, seems that is what I was looking for , I'll read this to search the answers on my questions

1

Hi all!

Just in case, we've recently released an opportunity to specify an environment script for a toolchain - https://www.jetbrains.com/help/clion/quick-tutorial-on-configuring-clion-on-windows.html#env-scripts. So you can try specifying the "enable" script provided with the devtoolset for your remote toolchain.

1

thank you for the reply,

actually just a replacing the paths of the toolchain with a specific for devtoolset, seems doesn't work for me in all cases, something with link paths 

anyway an applying that is a more correct way, isn't it? 

so bashrc script on remote host applies this to work properly, so default configured toolchain replaced on the compilation.

 

however my primary question is an understanding how clion works with ssh sessions,

it requires from time to time for various scenarios , this an applying devtoolset is just a case from those

0

I am not sure to understand your setup actually, is it:

[Windows 10 + CLion running on Windows] ---- Full Remote Mode ----> CentOS

Or is it:

Windows 10 + X11 Forwarding ----- (ssh -X with Xming or ThightVNC) -----> [CentOS + CLion running on CentOS]

Given what you are telling (and what I understand) it seems that you are actually in the second case.

In this second case CLion is simply running remotely and every time you close and re-open your ssh session you will have to launch you development environment again (devtoolset, environment variable, whatever your do which is temporary...). It has nothing to do with CLion here, it is just a regular ssh session forwarding CLion to you.

Otherwise if you want more info regarding the Full Remote Mode (which is also using ssh under the hood) then click the first link of this post.

0

Can you share your .bashrc script? I'm also encountering a similar issue :)

0

hi Alexs , unfortuntelly I can't share full .bashrc just the piece with devtoolset.

1. I moved all my configuring code from .bashrc to .profile because (I don't remember exactly when) sometimes .bashrc was not applied to the environment. so for now devtoolset in .profile

2. the command is "source scl_source enable devtoolset-4" . here "4" constant depends which devtoolset you need, 4 refers to GCC531 for me

0

Worked like a charm, thanks a lot Ernst! you're a champ!

0

Please sign in to leave a comment.