From mboxrd@z Thu Jan 1 00:00:00 1970 From: Richard Stanton Subject: Re: Problems running C code in org-mode under Windows Date: Tue, 27 Mar 2012 10:25:42 -0700 Message-ID: <40C7B1BFC291ED4E9D10436D07736A334702B60B3A@EXMAIL7.haas.uc.berkeley.edu> References: <40C7B1BFC291ED4E9D10436D07736A334702B60A32@EXMAIL7.haas.uc.berkeley.edu> <87bonikeaw.fsf@gmx.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([208.118.235.92]:59439) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SCa9c-0000bb-VK for emacs-orgmode@gnu.org; Tue, 27 Mar 2012 13:26:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SCa9W-00083l-Bs for emacs-orgmode@gnu.org; Tue, 27 Mar 2012 13:25:56 -0400 Received: from gateway-b.haas.berkeley.edu ([128.32.222.40]:53828) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SCa9W-00082t-4g for emacs-orgmode@gnu.org; Tue, 27 Mar 2012 13:25:50 -0400 In-Reply-To: <87bonikeaw.fsf@gmx.com> Content-Language: en-US List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Eric Schulte Cc: "emacs-orgmode@gnu.org" I've been tracing through, and a problem occurs when the compilation gets r= un, which is at about line 155 in file ob-eval.el, inside function org-babe= l-shell-command-on-region, where call-process region is called. As far as I can see, at this point the command being called is C:/emacs/emacs-24.0.94/bin/cmdproxy -c "gcc -o \"c:/users/stanton[...]C-bin= -10700opx\" \"c:/users/Stanton[...]C-src-10700bfr.c\"" (where [...] just means I deleted some more path information, but it's all = valid). If I execute this exact command at the command line, the compilation works = fine, and creates an executable file C-bin-10700opx.exe (note that gcc on W= indows automatically adds the .exe extension if you omit it). However, afte= r running the call-process-region command in the .el file, no executable fi= le is produced, and error-file has the contents Access is denied Not sure why this should be, but the compilation is not happening. > -----Original Message----- > From: Eric Schulte [mailto:eric.schulte@gmx.com] > Sent: Monday, March 26, 2012 6:45 PM > To: Richard Stanton > Cc: emacs-orgmode@gnu.org > Subject: Re: [O] Problems running C code in org-mode under Windows >=20 > Richard Stanton writes: >=20 > > Here's a simple org file that's supposed to run some C code and print t= he > result: > > > > ---------------------- > > > > * Sample C code > > > > #+name: RHS.c > > #+begin_src C :noweb yes :tangle RHS.c > > #include > > <
> > > #+end_src > > > > #+name: main > > #+begin_src C > > int main(int argc, char *argv[]) { > > int lst[argc-1]; > > int i; > > for(i=3D1;i > lst[i-1] =3D atoi(argv[i]); > > for(i=3D1;i > printf("%d ", lst[i-1] + 1); > > printf("\n"); > > } > > #+end_src > > > > #+call: RHS.c[:cmdline 8 7 6]() > > > > ------------------------- > > > > It works fine on my Mac, producing the result: > > > > #+RESULTS: RHS.c[:cmdline 8 7 6]() > > : 9 8 7 > > > > On my PC, however, running Windows Vista, the output is blank and > > there's a *Org-babel-error-output* buffer containing the message > > > > Access is denied. > > 'c:/Users/stanton/AppData/Local/Temp/babel-11948MQP/C-bin-11948Nln' > is > > not recognized as an internal or external command, operable program or > > batch file. > > > > There is a file called C-bin-11948Nln in that directory, but it has > > length 0, suggesting that something is going wrong in the compilation > > process. However, I can also see potential problems with the fact that > > the file name does not end in .exe, so the Windows shell is not easily > > going to recognize it as an executable anyway. > > > > Does anyone have this running OK under Windows? Alternatively, how can > > I track down what's going wrong in more detail? > > > > Thanks. > > > > Richard Stanton > > >=20 > I don't have access to a windows machine so I can't debug this myself, bu= t I > would suggest stepping through the execution of the `org-babel-C-execute' > function using edebug. This is done by first placing the cursor inside t= he `org- > babel-C-execute' function, evaluating the function with C-u C-M-x, then > executing a C code block. This should give you some idea of what is goin= g > wrong where. >=20 > Best, >=20 > -- > Eric Schulte > http://cs.unm.edu/~eschulte/