News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

Console app run/debugging for MacOSX

Started by bnilsson, November 29, 2006, 09:45:44 PM

Previous topic - Next topic

bnilsson

How is the progress on run/debug a console apps from CB on MacOSX?
The xterm launch is not, as we all know, working here.
It would be very handy for number crunching programs that wants input without GUI.
Will it be difficult to fix?

I guess it needs to be interfaced to the regular Terminal program.
Or is there any other solution?


afb

#1
Quote from: bnilsson on November 29, 2006, 09:45:44 PM
Will it be difficult to fix?

It's done, just not fully tested/integrated yet.
http://developer.berlios.de/bugs/?func=detailbug&bug_id=8987&group_id=5358

Quote
I guess it needs to be interfaced to the regular Terminal program.

For a preview of it, here is the patch to apply:
http://developer.berlios.de/patch/?func=detailpatch&patch_id=1667&group_id=5358

And yes, it sends an AppleScript to Terminal.app

afb

Quote from: bnilsson on November 29, 2006, 09:45:44 PM
The xterm launch is not, as we all know, working here.

BTW: xterm launch should be working on Mac OS X, but it does assume you
have X11.app running and that /usr/X11R6/bin/xterm is in your PATH...

The code I did will use Terminal.app for wxMac and X11.app/xterm for wxGTK.

bnilsson

xterm is not working from CB for me.
Trying to "run" a console app called "dxfcnv" with X11 running and the path to xterm in my normal environment:

QuoteChecking for existence: /Users/bnilsson/Documents/Programming/Active/CB_projects/dxfcnv/dxfcnv
Executing: xterm -T 'dxfcnv' -e 'LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH "/Users/bnilsson/Documents/Programming/Active/CB_projects/dxfcnv/dxfcnv" ' (in /Users/bnilsson/Documents/Programming/Active/CB_projects/dxfcnv/.)
Process terminated with status 255 (0 minutes, 0 seconds)

I also tried adding "/usr/X11R6/bin" to Compiler and.. Settings -> Programs -> Additional Paths and there was a difference:
(I need to have "/opt/local/bin" there, otherwise wx-config don't run. Strange, but true.)
QuoteChecking for existence: /Users/bnilsson/Documents/Programming/Active/CB_projects/dxfcnv/dxfcnv
Executing: xterm -T 'dxfcnv' -e 'LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH "/Users/bnilsson/Documents/Programming/Active/CB_projects/dxfcnv/dxfcnv" ' (in /Users/bnilsson/Documents/Programming/Active/CB_projects/dxfcnv/.)
Process terminated with status 1 (0 minutes, 0 seconds)

I do not know the difference between 255 and 1 in this case. Anyway, no activity was seen in the running X11 application.

I will try the Terminal patch and see what's happens.

afb

You need to have three things:

  • /usr/X11R6/bin in your $PATH
  • :0.0 in your $DISPLAY
  • X11.app up and running


With that, you should be able to do:
xterm -e 'read'
and it should open an X11 xterm ?

Note: you might want to get xterm going by itself, before trying to use it from within Code::Blocks ? (i.e. the xterm commands that C::B is executing should be working if you run them in a Terminal)

afb

On second thought, it might not be possible to do that in the wxMac version of Code::Blocks - you might need to run the wxGTK version of it, or just apply/wait for the Terminal.app patch.

bnilsson

I guess what might be missing for me is that CB is not aware of any $DISPLAY.
Can I set this somewhere?
"Compiler..Settings -> Custom variables" is not doing the trick.

(And the patch did not do any difference, still xterm)
QuoteChecking for existence: /Users/bnilsson/Documents/Programming/Active/CB_projects/dxfcnv/dxfcnv
Executing: xterm -T 'dxfcnv' -e DYLD_LIBRARY_PATH=.:$DYLD_LIBRARY_PATH "&quote&"/Users/bnilsson/Documents/Programming/Active/CB_projects/dxfcnv/dxfcnv"&quote&"  (in /Users/bnilsson/Documents/Programming/Active/CB_projects/dxfcnv/.)
Process terminated with status 1 (0 minutes, 0 seconds)

afb

Quote from: bnilsson on November 30, 2006, 10:25:05 PM
I guess what might be missing for me is that CB is not aware of any $DISPLAY.
Can I set this somewhere?
"Compiler..Settings -> Custom variables" is not doing the trick.

I set it in /etc/profile.

Quote
(And the patch did not do any difference, still xterm)

It's a preference, so if you have an old setting of xterm
you probably want to change it to the new "osascript..."

bnilsson

Non comprendo:
QuoteIt's a preference, so if you have an old setting of xterm
you probably want to change it to the new "osascript..."
Please explain?

afb

In the C::B Settings > Environment dialog:
("Terminal to launch console programs in:")

For wxMac (patched), this should be:
osascript -e 'tell app "Terminal" to do script "$SCRIPT"'

For wxGTK (e.g. linux), it is instead:
xterm -T $TITLE -e

Worst case, wiping the preferences works.

afb

Also, I revised the wxMac code to not use AppleScript quotes ("&quote&") unless your command actually contains $SCRIPT.

bnilsson

As usual, I feel a bit stupid, but this is what I get using Terminal...
QuoteLast login: Fri Dec  1 15:27:09 on ttyp6
Welcome to Darwin!
You have mail.
$SCRIPT
executing /etc/profile...
executing /etc/bashrc...
executing .bash_login...
mc2-p039:~ bnilsson$ $SCRIPT
mc2-p039:~ bnilsson$

afb

the code snippets above was for Code::Blocks.
$TITLE then gets replaced with the projects title,
and $SCRIPT gets replaced with an AppleScript

Unless you have some complex settings, the
easiest is probably to move away the old folder
at ~/Library/Application\ Support/CodeBlocks ?

bnilsson

#13
Sorry if I was not clear.
The quote was from the Terminal output when I had introduced
Quoteosascript -e 'tell app "Terminal" to do script "$SCRIPT"'
in the Environment settings and done "run" of my console app from within Code::Blocks.

Removing ~/Library/Application \Support/codeblocks did not make any difference.

afb

You did install the patch, right ?

Anyway, leave it for now and make another try when it's in the trunk...