8000 Execute Code plugin fails to run C++ code using Cling installed via Homebrew (macOS) · Issue #410 · twibiral/obsidian-execute-code · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Execute Code plugin fails to run C++ code using Cling installed via Homebrew (macOS) #410

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

Open
render1ng opened this issue Mar 11, 2025 · 2 comments

Comments

@render1ng
Copy link

📌 Issue Summary
When attempting to execute C++ code blocks using Cling (installed via Homebrew) through the Execute Code plugin in Obsidian, the following error consistently occurs:

text
ERROR in cling::CIFactory::createCI():
resource directory /tmp/cling-20241210-4934-qyfwj6/cling-1.2/build/lib/clang/18 not found!
This error persists even after explicitly setting environment variables or creating symbolic links to match Clang resource directories.

🖥️ Environment Details
Operating System: macOS (Apple Silicon)

Obsidian Version: Latest available

Execute Code Plugin Version: Latest available

Cling Version: 1.2 (installed via Homebrew)

LLVM/Clang Version: LLVM 19 (installed via Homebrew)

⚙️ Steps to Reproduce
Install Cling and LLVM via Homebrew:

bash
brew install cling llvm
Configure the Execute Code plugin in Obsidian:

Set the C++ interpreter path to /opt/homebrew/bin/cling

Create and attempt to execute a simple C++ code block in Obsidian:

cpp

#include <iostream>

int main() {
    std::cout << "Hello from Cling!" << std::endl;
}

Observe the error message appearing in Obsidian:

text
ERROR in cling::CIFactory::createCI():
resource directory /tmp/cling-20241210-4934-qyfwj6/cling-1.2/build/lib/clang/18 not found!
🔧 Attempted Solutions (did not resolve the issue)
The following attempts were made but did not resolve the issue:

Creating a symbolic link from clang 19 to clang 18:

bash
sudo ln -s /opt/homebrew/opt/llvm/lib/clang/19 /opt/homebrew/opt/llvm/lib/clang/18
Creating a wrapper script (cling_wrapper.sh) with explicit environment variables:

bash
#!/bin/bash
export LLVM_PATH=/opt/homebrew/opt/llvm
export PATH="$LLVM_PATH/bin:$PATH"
export DYLD_LIBRARY_PATH="$LLVM_PATH/lib:$DYLD_LIBRARY_PATH"
export CLING_RESOURCE_DIR="$LLVM_PATH/lib/clang/19"
exec /opt/homebrew/bin/cling "$@"
and setting this wrapper script as the interpreter path in Execute Code plugin.

Despite these attempts, the error persists.

🚩 Expected Behavior
Execute Code plugin should correctly execute C++ code blocks through Cling without errors, respecting environment variables or wrapper scripts provided by users.

📌 Actual Behavior
Execute Code plugin runs Cling in a temporary directory (/tmp/...) and fails due to missing hardcoded resource paths (lib/clang/18), ignoring user-defined environment variables or symbolic links.

📎 Additional Context
This issue seems related to how Execute Code invokes external interpreters, possibly ignoring or overriding environment variables set by wrapper scripts.

🙏 Request:
Could you please investigate this issue and provide guidance on how users can configure Execute Code plugin properly with newer versions of Clang and Cling installed via Homebrew?

Thank you for your support!

@twibiral
Copy link
Owner

Hi, how did you install Obsidian? There is a known issue in unix systems, that executing code fails when Obsidian was installed via a package manager (like homebrew).

@render1ng
Copy link
Author

I got and installed the DMG from the official site of the obsidian.

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

No branches or pull requests

2 participants
0