[Emacs-ada-mode] $ADA_INCLUDE_PATH problems

Schafer, J. x00363 F3 Joseph.Schafer at usma.edu
Thu Jan 15 20:19:39 PST 2009



> Note that this compiles _two_ files (hw2.adb and testing.adb), not a
> "single file" as you stated above.

My mistake.

> It appears that ADA_INCLUDE_PATH is not inherited by the Emacs
> process. To test this, start a bash shell under Emacs (M-x shell),
> and see what the value of ADA_INCLUDE_PATH is there. Or execute
> (getenv "ADA_INCLUDE_PATH") in the scratch buffer.

> Most likely you are not starting Emacs from the process where
> ADA_INCLUDE_PATH is set. Environment variables are not "global";
> they are inherited from the parent (not sibling) process.

Oh, I did not realize that the environmental variables were inherited.
Running emacs from bash and from the desktop verifies this difference.

> ada-search-directories is only used by Emacs, not by the gnat
> compiler.

Right, but I thought that adding the directory containing testing.adb
would solve my problem.

> I always to do everything from within Emacs, and set the required
> environment variables in .emacs, or in a Makefile. That way I don't
> have to worry about .bash_profile vs .bashrc etc.

Sounds like a good way to go.  I fixed my issue with a quick call to
setenv and everything is working like I want it.

> It's also better to set search paths in GNAT project files; that way
> they will be the same for both GNAT and Emacs. But you can learn how
> to do that later.

That's what I'd normally do, but it seemed overkill for what I'm doing
right now.  I'm just making files with one or two functions for my
algorithms class.


-----Original Message-----
From: emacs-ada-mode-request at stephe-leake.org
Reply-to: <emacs-ada-mode at stephe-leake.org>
To: emacs-ada-mode at stephe-leake.org
Subject: Emacs-ada-mode Digest, Vol 18, Issue 1
Date: Tue, 13 Jan 2009 12:00:02 -0800

Send Emacs-ada-mode mailing list submissions to
        emacs-ada-mode at stephe-leake.org

To subscribe or unsubscribe via the World Wide Web, visit
        http://stephe-leake.org/mailman/listinfo/emacs-ada-mode_stephe-leake.org

or, via email, send a message with subject or body 'help' to
        emacs-ada-mode-request at stephe-leake.org

You can reach the person managing the list at
        emacs-ada-mode-owner at stephe-leake.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Emacs-ada-mode digest..."


Today's Topics:

   1. $ADA_INCLUDE_PATH problems (Joe Schafer)
   2. Re: $ADA_INCLUDE_PATH problems (Stephen Leake)


----------------------------------------------------------------------

Message: 1
Date: Mon, 12 Jan 2009 21:04:39 -0500
From: Joe Schafer <joseph.schafer at usma.edu>
Subject: [Emacs-ada-mode] $ADA_INCLUDE_PATH problems
To: <emacs-ada-mode at stephe-leake.org>
Message-ID: <1231812279.10024.14.camel at joe-ubuntu>
Content-Type: text/plain

Hey all,

I'm trying to compile a single file.  I have a couple of packages in a
separate folder that I put in $ADA_INCLUDE_PATH.  The Gnat users guide
says it automatically searches these directories.  The problem is that I
get different results compiling in bash and compiling from within emacs
ada mode.  I have the same problem when starting with "emacs -Q" so it's
not any of my customizations.

$ echo $ADA_INCLUDE_PATH 
/usr/local/lib/ada:.

--compiling from bash
$ gnatmake hw2
gcc-4.3 -c hw2.adb
gcc-4.3 -c -I./ -I- /usr/local/lib/ada/testing.adb
gnatbind -x hw2.ali
gnatlink hw2.ali


--compiling from ada-mode
gnatmake -o hw2 hw2 -g -cargs -gnatq -gnatQ -bargs  -largs 
gcc-4.3 -c -g -gnatq -gnatQ hw2.adb
hw2.adb:5:40: file "testing.ads" not found

I tried adding $ADA_INCLUDE_PATH to ada-search-directories, but that
didn't seem to have any effect.

Thanks for the help.
Joe



------------------------------

Message: 2
Date: Tue, 13 Jan 2009 06:49:14 -0500
From: Stephen Leake <stephen_leake at stephe-leake.org>
Subject: Re: [Emacs-ada-mode] $ADA_INCLUDE_PATH problems
To: emacs-ada-mode at stephe-leake.org
Message-ID: <86k58ze891.fsf at stephe-leake.org>
Content-Type: text/plain; charset=us-ascii

Joe Schafer <joseph.schafer at usma.edu> writes:

> I'm trying to compile a single file.  I have a couple of packages in a
> separate folder that I put in $ADA_INCLUDE_PATH.  The Gnat users guide
> says it automatically searches these directories.  The problem is that I
> get different results compiling in bash and compiling from within emacs
> ada mode.  I have the same problem when starting with "emacs -Q" so it's
> not any of my customizations.
>
> $ echo $ADA_INCLUDE_PATH 
> /usr/local/lib/ada:.
>
> --compiling from bash
> $ gnatmake hw2
> gcc-4.3 -c hw2.adb
> gcc-4.3 -c -I./ -I- /usr/local/lib/ada/testing.adb
> gnatbind -x hw2.ali
> gnatlink hw2.ali

Note that this compiles _two_ files (hw2.adb and testing.adb), not a
"single file" as you stated above. 

> --compiling from ada-mode
> gnatmake -o hw2 hw2 -g -cargs -gnatq -gnatQ -bargs  -largs 
> gcc-4.3 -c -g -gnatq -gnatQ hw2.adb
> hw2.adb:5:40: file "testing.ads" not found

It appears that ADA_INCLUDE_PATH is not inherited by the Emacs
process. To test this, start a bash shell under Emacs (M-x shell), and
see what the value of ADA_INCLUDE_PATH is there. Or execute (getenv
"ADA_INCLUDE_PATH") in the scratch buffer.

Most likely you are not starting Emacs from the process where
ADA_INCLUDE_PATH is set. Environment variables are not "global"; they
are inherited from the parent (not sibling) process.

> I tried adding $ADA_INCLUDE_PATH to ada-search-directories, but that
> didn't seem to have any effect.

ada-search-directories is only used by Emacs, not by the gnat compiler.


I always to do everything from within Emacs, and set the required
environment variables in .emacs, or in a Makefile. That way I don't
have to worry about .bash_profile vs .bashrc etc.

It's also better to set search paths in GNAT project files; that way
they will be the same for both GNAT and Emacs. But you can learn how
to do that later.

-- 
-- Stephe



------------------------------

_______________________________________________
Emacs-ada-mode mailing list
Emacs-ada-mode at stephe-leake.org
http://stephe-leake.org/mailman/listinfo/emacs-ada-mode_stephe-leake.org


End of Emacs-ada-mode Digest, Vol 18, Issue 1
*********************************************



More information about the Emacs-ada-mode mailing list