Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fresh install and launch prints ERROR in cling::CIFactory::createCI(): #536

Open
1 task done
matthesoundman opened this issue Sep 26, 2024 · 4 comments
Open
1 task done
Labels

Comments

@matthesoundman
Copy link

  • Checked for duplicates

Describe the bug

After fresh install using brew install cling launching cling with cling from terminal prints an error.

ERROR in cling::CIFactory::createCI():
  resource directory /tmp/cling-20240911-4658-shhoyi/cling-1.1/build/lib/clang/16 not found!

****************** CLING ******************
* Type C++ code and press enter to run it *
*             Type .q to exit             *
*******************************************
[cling]$

Expected behavior

The expected behavior is to not show an error and launch without issues.

To Reproduce

On macOS:

  1. Install cling using: brew install cling
  2. Run cling using: cling

Setup

  1. 1.1
  2. ProductName:    macOS
    ProductVersion: 15.0
    BuildVersion:   24A335
    
  3. homebrew cling - Homebrew Formulae

Additional context

cling still seems to operate fine when I tried it out, but the error seems odd.

@lkcola
Copy link

lkcola commented Nov 27, 2024

have you fixed this? i encounter the same problem

@islwx
Copy link

islwx commented Nov 27, 2024

have you fixed this? i encounter the same problem
+1
I compiled a cling executable using the method in the README, but encountered the same issue on OSX 14.3

@islwx
Copy link

islwx commented Nov 27, 2024

have you fixed this? i encounter the same problem

#531 is a temporary solution and built cling myself, then built Clang before building Cling

@mhdadk
Copy link

mhdadk commented Dec 4, 2024

have you fixed this? i encounter the same problem

#531 is a temporary solution and built cling myself, then built Clang before building Cling

I used the script given in this comment, and it worked for me but with a catch: I could not move the cling binary, nor the build directory in which it exists, after building the cling binary. If I do so, then I still get the same ERROR in cling::CIFactory::createCI().

After building the cling binary, I wanted to move it to a directory on my PATH so that I can use it from anywhere. However, once I did so and launched cling, it gave me the same ERROR in cling::CIFactory::createCI().

Additionally, if I don't move cling outside the directory that it is in, and instead move the entire build directory that the cling binary is in (e.g. moving ~/Downloads/cling-build/* to ~/Desktop/cling-build/*), I get the same error. I am running Ubuntu 24.10.

Interestingly, cling works fine even with the error showing. Additionally, if I move the cling binary back inside the directory that it was in, or if I move the whole parent directory back to where it was, and then launch the cling binary from there, the error goes away.

It seems that the error stems from here:

// FIXME: Handle cases, where the cling is part of a library/framework.
// There we can't rely on the find executable logic.
if (!llvm::sys::fs::is_directory(resourcePath)) {
cling::errs()
<< "ERROR in cling::CIFactory::createCI():\n resource directory "
<< resourcePath << " not found!\n";
resourcePath = "";
} else {
sArguments.addArgument("-resource-dir", std::move(resourcePath));
}

After running cling from bash, I can see that resourcePath translates to the same absolute path (i.e. /home/<username>/Downloads/cling/cling-build/lib/clang/18) even after I move the cling binary around. This suggests that resourcePath is not a relative path (such as ../../cling-build/lib/clang/18), which could explain why moving the binary outside the folder it is in causes the error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants