I have see the same problem on other thread and other web site .
When i launch terminal application from CB i have this message:
[…] zsh: no such file or directory […]
➜ ~ zsh --version
zsh 5.8 (x86_64-apple-darwin19.6.0)
I have try this solutions:
https://sourabhbajaj.com/mac-setup/iTerm/zsh.html
or
https://technobyte.org/install-code-blocks-on-mac-os-gcc-compiler/ (watch the comments)
```
sudo sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
chsh -s /bin/zsh
source ~/.zhrc
```
Here the other topics:
http://forums.codeblocks.org/index.php/topic,23357.msg159018.html#msg159018
http://forums.codeblocks.org/index.php/topic,18907.msg129527.html#msg129527
I continue my investigation. :p
With Codelite with a simple «Hello World» project work.
Here the terminal how is calling:
/Applications/codelite.app/Contents/MacOS/osx-terminal.sh "cd /Users/toto/folder/Test_CL_Mac/Debug && ./Test_Terminal\ "
The code of osx-terminal.sh file is:
#!/bin/sh
echo '
on run argv
if length of argv is equal to 0
set command to ""
else
set command to item 1 of argv
end if
if length of argv is greater than 1
set profile to item 2 of argv
runWithProfile(command, profile)
else
runSimple(command)
end if
end run
on runSimple(command)
tell application "Terminal"
activate
set newTab to do script(command)
end tell
return newTab
end runSimple
on runWithProfile(command, profile)
set newTab to runSimple(command)
tell application "Terminal" to set current settings of newTab to (first settings set whose name is profile)
end runWithProfile
' | osascript - "$@" > /dev/null
The command to call a terminal application with CB is here:
osascript -e 'tell app "Terminal"' -e 'activate' -e 'do script quoted form of "$SCRIPT"' -e 'end tell'
Example:
osascript -e 'tell app "Terminal"' -e 'activate' -e 'do script quoted form of "/Applications/CodeBlocks.app/Contents/MacOS/cb_console_runner DYLD_LIBRARY_PATH=:. /.../Test_App/bin/Debug/Test_App "' -e 'end tell' (in /.../Test_App/.)
On CB Linux the command with xterm is :
Example:
Checking for existence: /directory/APP/bin/Debug/APP
Set variable: LD_LIBRARY_PATH=.:/some/paths
Executing: xterm -T APP -e /path/CodeBlocks/bin/cb_console_runner LD_LIBRARY_PATH=:.:/some/paths /directory/APP/bin/Debug/APP -e "some arguments" (in /directory/APP/.)
Like that C::B launch the application (doesn't work very well in debug : I use /usr/local/Cellar/gdb/10.1/bin/gdb).
/Applications/codelite.app/Contents/MacOS/osx-terminal.sh "$SCRIPT"'
solution:
create osx-terminal.sh file where you want (YOUR_DIRECTORY).
put this code inside:
(The code come from https://codelite.org/)
#!/bin/sh
echo '
on run argv
if length of argv is equal to 0
set command to ""
else
set command to item 1 of argv
end if
if length of argv is greater than 1
set profile to item 2 of argv
runWithProfile(command, profile)
else
runSimple(command)
end if
end run
on runSimple(command)
tell application "Terminal"
activate
set newTab to do script(command)
end tell
return newTab
end runSimple
on runWithProfile(command, profile)
set newTab to runSimple(command)
tell application "Terminal" to set current settings of newTab to (first settings set whose name is profile)
end runWithProfile
' | osascript - "$@" > /dev/null
Save it.
Got to Codeblocks > Settings > Environment… > rescale the window on the bottom to see the field: Terminal to launch programs:
Replace the text by:
/YOUR_DIRECTORY/osx-terminal.sh "$SCRIPT"'
You have set up an environment in MacOS? And I no use MacOS - maybe need restart OS after set environment PATH where you install zsh. Replase in_this_folder_instaled_zsh into path to zsh
# Add commonly used folders to $PATH export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:in_this_folder_instaled_zsh"
The new version of Codelite use a new way and the debug works now:
They do that:
To launch a terminal without debuguing they call a temporary .sh file.
open -n -a Terminal /tmp/codelite-exec.sh
the terminal is calling with this arguments => /tmp/codelite-exec.sh ; exit;
#!/bin/bash
command="/[…]/Test_CL_Mac/Debug/Test_Terminal"
cd /[…]/Test_CL_Mac/Debug && ${command}
echo Hit any key to continue...
read
To launch a terminal with debuguing they call another temporary .sh file.
the terminal is calling with this arguments => /tmp/codelite-lldb-helper.sh ; exit;
#!/bin/bash
tty > /tmp/terminal.tty.11395
sleep 12345
------
With VSCode:
It's funny if you follow the tutorial of VSCode with Cland MacOS :
https://code.visualstudio.com/docs/cpp/config-clang-mac
They are a similar problem... MacOs Macos…
code .
zsh: command not found: code
------
I continue to investigate.
I use the brew gdb(s) and i work on Catalina too.
/usr/local/Cellar/gdb/8.0.1/bin/gdb
/usr/local/Cellar/gdb/10.1/bin/gdb
brew install gdb
I haven't try to use them directly in command line.
But the 8.0.1 and 10.1 works with Codelite.
With Codeblocks the gdb path seem to be correct, the only problem come from the terminal execution.
With XCode it's work but i don't know witch gdb is set.
I'm not motivate to test VCode because i have to create manually all the configuration file.
tasks.json (compiler build settings)
launch.json (debugger settings)
c_cpp_properties.json (compiler path and IntelliSense settings)
You can also try with the default llvm debugger:
/usr/bin/lldb
/usr/bin/lldb -v
lldb-1200.0.44.2
Apple Swift version 5.3.2 (swiftlang-1200.0.45 clang-1200.0.32.28)
Ooo now i understand the meaning of what you have say Codesigned
https://stackoverflow.com/questions/13913818/how-to-get-a-codesigned-gdb-on-osx
https://stackoverflow.com/questions/18423124/please-check-gdb-is-codesigned-see-taskgated8-how-to-get-gdb-installed-w
I have not anymore codesign problem with gdb:
codesign -fs gdb-cert /usr/local/bin/gdb
codesign -fs gdb-cert "/usr/local/Cellar/gdb/10.1/bin/gdb"
/dev/??: No such file or directory.
May be that can help:
codesign --entitlements gdb.xml -fs gdb-cert /usr/local/bin/gdb
Where content of gdb.xml is:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
<true/>
<key>com.apple.security.cs.disable-library-validation</key>
<true/>
<key>com.apple.security.cs.disable-executable-page-protection</key>
<true/>
<key>com.apple.security.cs.debugger</key>
<true/>
<key>com.apple.security.get-task-allow</key>
<true/>
</dict>
</plist>
But it's not enough to work with gdb : The errors are:
Termination notification request failed, mach_port_request_notification
Using sleep command’s PID as console PID 3088
[debug]> set confirm off
Debugger name and version: GNU gdb (GDB) 10.1
[debug]>>>>>>cb_gdb:
[debug]> set width 0
[debug]>>>>>>cb_gdb:
[debug]> set height 0
[debug]>>>>>>cb_gdb:
[debug]> set breakpoint pending on
[debug]>>>>>>cb_gdb:
[debug]> set print asm-demangle on
[debug]>>>>>>cb_gdb:
[debug]> set unwindonsignal on
[debug]>>>>>>cb_gdb:
[debug]> set print elements 200
[debug]>>>>>>cb_gdb:
[debug]> set filename-display absolute
[debug]>>>>>>cb_gdb:
[debug]> set disassembly-flavor intel
[debug]>>>>>>cb_gdb:
[debug]> catch throw
[debug]Catchpoint 1 (throw)
[debug]>>>>>>cb_gdb:
[debug]> directory /…/Test_App/
[debug]Source directories searched: /…/Test_App:$cdir:$cwd
[debug]>>>>>>cb_gdb:
[debug]> tty /dev/??
[debug]>>>>>>cb_gdb:
[debug]> run
[debug]/dev/??: No such file or directory.
[debug]Starting program: /…/Test_App/bin/Debug/Test_App
[debug]Termination notification request failed, mach_port_request_notification
[debug]returned: 4
[debug]>>>>>>cb_gdb:
i can't stop the gdb.
Trying to interrupt process with pid: 3084; child pid: 0 gdb pid: 3084
[debug]Quit
[debug]>>>>>>cb_gdb:
The pid of the gdb and the PID of the console is 3088.
I have say something wrong. Codelite do not use GDB. Codelite seem to use only lldb and not the custom paths to use GDB.
Lot's of people say to use lldb becouse lldb have no certifaciton/codesign problems.
Here the error with lldb and CB.
ctive debugger config: GDB/CDB debugger:Default
Building to ensure sources are up-to-date
Selecting target:
Debug
Adding source dir: /.../Test_App/
Adding source dir: /.../Test_App/
Adding file: /.../Test_App/bin/Debug/Test_App
Changing directory to: /.../Test_App/.
Set variable: DYLD_LIBRARY_PATH=.:
[debug]Command-line: /usr/bin/lldb -fullname -quiet -args /.../Test_App/bin/Debug/Test_App
[debug]Working dir : /.../Test_App
Starting debugger: /usr/bin/lldb -fullname -quiet -args /.../Test_App/bin/Debug/Test_App
Setting SHELL to ‘/bin/sh’
done
[debug](lldb) target create « /.../Test_App/bin/Debug/Test_App »
[debug]> set prompt >>>>>>cb_gdb:
Setting breakpoints
[debug]invalid command ‘settings prompt’.
[debug]Current executable set to ‘/.../Test_App/bin/Debug/Test_App’ (x86_64).
[debug](lldb) set prompt >>>>>>cb_gdb:
[debug]> show version
[debug]error: ‘show’ is not a valid command.
[debug](lldb) show version
[debug]Using terminal’s PID as console PID 3842, TTY /dev/??
[debug]Queued:[tty /dev/??]
I think we are no choice we have to modify the CB code to add the gestion of lldb?