Execute Code plugin fails to run C++ code using Cling installed via Homebrew (macOS) · Issue #410 · twibiral/obsidian-execute-code · GitHub
More Web Proxy on the site http://driver.im/
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
📌 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.
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>intmain() {
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!
The text was updated successfully, but these errors were encountered:
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).
📌 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
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!
The text was updated successfully, but these errors were encountered: