CLion with UE4.19

$ git status
On branch 4.19
Your branch is up-to-date with ‘origin/4.19’.

I’m new to UE4 and CLion. In my day job, I’m a “Java” Software Engineer. Anyways… I saw that UE4.19 was supposed to come with a plugin for CLion integration. I’m having some difficulties… Not sure where to go as this plugin used to be from dotBunny. The new version appears to be from EpicGames.

Also, I’m running Ubuntu 16.04.5 with gcc 5.4.0

File → “Open CLion” does nothing. Can’t figure out how to configure where I’ve installed CLion in UE for it to do something.

More importantly, the generated CMakeLists.txt doesn’t seem to be working. Using the CLion default toolchain of bundled cmake, /usr/bin/cc, and /usr/bin/c++ I get:

c++: error trying to exec '/usr/lib/gcc/x86_64-linux-gnu/5/cc1plus': execv: Argument list too long

I thought I read somewhere that clang should be used instead; so I tried that (I have 3.8), with the following results:

Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0
Candidate multilib: .;@m64
Selected multilib: .;@m64
clang: error: no such file or directory: '('
clang: error: no such file or directory: '1.39'
clang: error: no such file or directory: ')'
clang: error: no such file or directory: '('
clang: error: no such file or directory: 'Steamv139'
clang: error: no such file or directory: ')'

Anyone have any ideas?

Thanks.

I made my stack size unlimited so that getconf ARG_MAX returns 4611686018427387903. Still getting execv: Argument list too long.

Looking through the source code; I discovered that the new UE4-CLion Plugin has hard-coded the location it looks for CLion based on platform. For linux, it’s specifically looking for “/opt/clion/bin/clion.sh”. Though I am still getting the same errors when I try to “Reload CMake” project in CLion.

Started trying to run some of these commands in a terminal. The cmake command works just fine. Then CLion runs /usr/bin/clang++ -xc++ ... @CMakeFiles/FakeTarget.dir/includes_CXX.rsp -g ( 1.39 ) ( Steamv139 ) -std=gnu++14 -fpch-preprocess -v -dD -E.

In terminal, resolving the variable and removing everything between the -g and the -std= causes the command to succeed.

For now, I’ll assume that the variable is actually resolvable the way CLion runs it. So, where did this steam stuff come from? I see references in various definition files; but changing them doesn’t do anything.

@inigmas I don’t know the reason for this problem, but you can circumvent the problem if you remove the following lines from Intermediate/ProjectFiles/cmake-definitions.cmake:

-DSTEAM_SDK_VER=TEXT("1.39")
-DSTEAM_SDK_VER_PATH=TEXT("Steamv139")

Initial results seem promising. I’ll check it out more after work. Also, I guess this is what I get for relying on the in-editor search… Not sure why it didn’t come up.

But thank you very much, @

So, in addition to removing the lines. I also, just now, tried just modifying them slightly. Replacing them with:

-DSTEAM_SDK_VER="1.39"
-DSTEAM_SDK_VER_PATH="Steamv139"

Now I’m wondering what the TEXT() thing was about… Those were the only fields to have them. Makes me think whatever built this file had some sort of ETL error. I don’t suppose anyone knows what the correct values for those definitions should be?

I’m guessing it won’t matter for me until I start trying to add support for Steam. ??

The same issue happens on UE4.18.3. The solution in the comment above helped me.

I don’t even see the options to open CLion or generate a CmakeLists file in the File menu. How do I check where Unreal looks for an installation of CLion? I am using Unreal Engine 4.19.1-3989454+++UE4+Release-4.19

It’s been a while since I’ve looked at it… If you’re not seeing the options to do these things; are you sure that the plugin is enabled?

I had originally looked through the plugin’s source code to see where it was looking for CLion. It’s been a while though, so I don’t have any links to share. Sorry.

I also cannot seem to find CLion in the list of active plugins, though if I browse through the library of built-in plugins, the Clion integration plugin is indeed checked. I am guessing that it searches for clion, but can’t find it, so it silently removes the plugin at the project level, despite retaining it in global options?

Building on CLion UE4 for Linux Tutorial

Hello, hopefully I am not too late to reply. I’ve been experimenting with Clion and have so far gotten it to work just as well as compiling Linux on Mac with xcode. The instructions are very similar, although you will need to make some adjustments.

To build UE4 on linux, you will need to first generate the CMakeFile.txt using the “./GenerateProjectFiles.sh” command with the terminal.

Afterwards, open the project with Clion. It will then proceed to scan and index the files, once that is done, you will need to configure the build. On the top dropdown menu that shows all the build Targets, first select ShaderCompilerWorker. Configure the settings so that the executable is FakeTarget and the working directory is the root folder of your UnrealEngine. For right now, ignore filling in ProgramArguments field.

Next, you want to click the build button and let it finish building ShaderCompilerWorker. It will scan the dependencies and build the module. After it finishes, it says that it will begin scanning for dependencies for FakeTarget. At this point, you can go ahead and click the stop button (near bottom left corner red square button). This will stop the build and let you continue onto the next step.

Once it stops, go back to the top drop down menu and select UE4Editor. Then Edit the Configurations, you will again need to put the same settings from before. Select FakeTarget as executable, directory as your UnrealEngine root folder. Leave ProgramArgument empty for right now. Then start the build. It will finish and you will need to stop the build once it starts scanning dependencies for FakeTarget.

Finally, once the build is stopped, go back to edit configurations for UE4Editor and change the executable to UE4Editor found in /Engine/Binaries/Linux. Then change the ProgramArgument to “/Engine/Binaries/Linux/UE4Editor”. I have found that not using quotations will give you a warning, but the warning does not affect the outcome.

If you want to build and compile your project, then you must, either use this command or create the CmakeFile from the editor.

$ ./GenerateProjectFiles.sh -project="/home/user/Documents/Unreal Projects/MyProject/MyProject.uproject" -game -engine

To create the CmakeFile from the editor, go to plugins and make sure that CLion is turned on. Afterwards, go to your Editor Preferences, select the “Source Code” tab, and in the dropdown menu select CLion. Lastly, in the File Menu, you should now see the option to “Refresh Clion”. This will generate the Cmakefiles. Also you will see the option “Open Clion”. Depending on how you installed Clion, to run CLion from the editor you may need to modify the file “Engine/Plugins/Developer/CLionSourceCodeAccess/Source/CLionSourceCodeAcess/Private/CLionSourceCodeAccessor.cpp”.

Replace “/opt/clion/bin/clion.sh” with your install location.

    // Linux Default Install
    if(FPaths::FileExists(TEXT("/opt/clion/bin/clion.sh")))
    {
	    return TEXT("/opt/clion/bin/clion.sh");
    }

By following this tutorial it will create a bare bones light UE4 editor. I am not certain if these instructions have equivalent results to those on “the building for Macs” instructions, but I have found that they work and if you need to compile the other modules, you can either follow similar steps to those above or simply compile the rest using the traditional “make” command in the terminal. But this will allow Linux users to build, test, and compile UE4 using the CLion IDE instead of only relying on Visual Studios.

I have tested this to work on UE4.15 and UE4.20, will most likely work with all versions in between although the in Editor menus for CLion differ. Also for older versions of UE4 you may need to manually add these lines in order for Cmake to compile the engine with Clang thus solve the GCC error you’re receiving. And yes, I know it says clang+±6.0, but for some reason that is how you activate the Linux ToolChain that comes with the engine and it will automatically select the correct version of Clang.

# CMake Flags
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS 1 CACHE BOOL "" FORCE)
set(CMAKE_CXX_USE_RESPONSE_FILE_FOR_INCLUDES 1 CACHE BOOL "" FORCE)

set(CMAKE_CXX_COMPILER /usr/bin/clang++-6.0)