Re: [HACKERS] Configuring Postgres to Add A New Source File

2012-01-30 Thread Robert Haas
On Fri, Jan 27, 2012 at 6:37 PM, Tareq Aljabban
tareq.aljab...@gmail.com wrote:
 Indeed, I'm a beginner in Make, but I read few tutorials and was able to
 do what I wanted outside of PG using a simple make file.
 Now, when moving to PG, I found the Make structure much more complicated and
 didn't know where to add my configuration.
 I'm looking only for this file to run in PG (the required functionality is
 done already). My code will be a part of the backend, so I want to keep it
 there.

Uh, no it won't.  The compile command you showed had it creating a
standalone executable, hdfs_test.

You're likely to find that linking a JVM into the backend
significantly decreases the overall robustness of the system.  For
example, ^C isn't going to be able to abort out of processing a query
that's off doing something inside the JVM.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Configuring Postgres to Add A New Source File

2012-01-27 Thread Tareq Aljabban
Indeed, I'm a beginner in Make, but I read few tutorials and was able to
do what I wanted outside of PG using a simple make file.
Now, when moving to PG, I found the Make structure much more complicated
and didn't know where to add my configuration.
I'm looking only for this file to run in PG (the required functionality is
done already). My code will be a part of the backend, so I want to keep it
there.
You're saying it's going to be a bit tricky to do what I want with make (as
I'm novice in it).. so can you please point out some references I can start
from?!
Do you think reposting this in the novice mailing list will be a good
idea?
Thanks


On Thu, Jan 26, 2012 at 12:54 PM, Robert Haas robertmh...@gmail.com wrote:

 On Wed, Jan 25, 2012 at 7:06 AM, Tareq Aljabban
 tareq.aljab...@gmail.com wrote:
  Hi,
  I'm doing some development on the storage manager module of Postgres.
 
  I have added few source files already to the smgr folder, and I was able
 to
  have the Make system includes them by adding their names to the OBJS
 list in
  the Makefile inside the smgr folder. (i.e. When I add A.c, I would add
 A.o
  to the OBJS list).
 
  That was working fine. Now I'm trying to add a new file hdfs_test.c to
 the
  project. The problem with this file is that it requires some extra
  directives in its compilation command (-I and -L directives).
 
  Using gcc the file is compiled with the command:
 
  gcc hdfs_test.c -I/HDFS_HOME/hdfs/src/c++/libhdfs
  -I/usr/lib/jvm/default-java/include -L/HDFS_HOME/hdfs/src/c++/libhdfs
  -L/HDFS_HOME/build/c++/Linux-i386-32/lib
  -L/usr/lib/jvm/default-java/jre/lib/i386/server -ljvm -lhdfs -o hdfs_test
 
  I was told that in order to add the extra directives, I need to modify
  $LDFLAGS in configure.in and $LIBS in MakeFile.
 
  I read about autoconf and checked configure.in of Postgres but still
 wasn't
  able to know exactly what I should be doing.

 This is really a general question about make that has nothing to do
 with PostgreSQL specifically; you might want to get a book on make.

 Makefiles in subdirectories of src/backend are only intended to be
 able to build the backend itself, so there's probably no particularly
 easy way to do what you want there.  You likely want to put this code
 someplace like src/test/hdfs_test and copy one of the other Makefiles
 into the new directory, perhaps src/test/isolation/Makefile.

 But even if you do that for starters, you're going to need to make
 some modifications, which may be a bit tricky if you have no
 experience at all using make.

 --
 Robert Haas
 EnterpriseDB: http://www.enterprisedb.com
 The Enterprise PostgreSQL Company



Re: [HACKERS] Configuring Postgres to Add A New Source File

2012-01-26 Thread Robert Haas
On Wed, Jan 25, 2012 at 7:06 AM, Tareq Aljabban
tareq.aljab...@gmail.com wrote:
 Hi,
 I'm doing some development on the storage manager module of Postgres.

 I have added few source files already to the smgr folder, and I was able to
 have the Make system includes them by adding their names to the OBJS list in
 the Makefile inside the smgr folder. (i.e. When I add A.c, I would add A.o
 to the OBJS list).

 That was working fine. Now I'm trying to add a new file hdfs_test.c to the
 project. The problem with this file is that it requires some extra
 directives in its compilation command (-I and -L directives).

 Using gcc the file is compiled with the command:

 gcc hdfs_test.c -I/HDFS_HOME/hdfs/src/c++/libhdfs
 -I/usr/lib/jvm/default-java/include -L/HDFS_HOME/hdfs/src/c++/libhdfs
 -L/HDFS_HOME/build/c++/Linux-i386-32/lib
 -L/usr/lib/jvm/default-java/jre/lib/i386/server -ljvm -lhdfs -o hdfs_test

 I was told that in order to add the extra directives, I need to modify
 $LDFLAGS in configure.in and $LIBS in MakeFile.

 I read about autoconf and checked configure.in of Postgres but still wasn't
 able to know exactly what I should be doing.

This is really a general question about make that has nothing to do
with PostgreSQL specifically; you might want to get a book on make.

Makefiles in subdirectories of src/backend are only intended to be
able to build the backend itself, so there's probably no particularly
easy way to do what you want there.  You likely want to put this code
someplace like src/test/hdfs_test and copy one of the other Makefiles
into the new directory, perhaps src/test/isolation/Makefile.

But even if you do that for starters, you're going to need to make
some modifications, which may be a bit tricky if you have no
experience at all using make.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


[HACKERS] Configuring Postgres to Add A New Source File

2012-01-25 Thread Tareq Aljabban
Hi,
I'm doing some development on the storage manager module of Postgres.

I have added few source files already to the smgr folder, and I was able to
have the Make system includes them by adding their names to the OBJS list
in the Makefile inside the smgr folder. (i.e. When I add A.c, I would add
A.o to the OBJS list).

That was working fine. Now I'm trying to add a new file hdfs_test.c to the
project. The problem with this file is that it requires some extra
directives in its compilation command (-I and -L directives).


Using gcc the file is compiled with the command:

gcc hdfs_test.c -I/HDFS_HOME/hdfs/src/c++/libhdfs
-I/usr/lib/jvm/default-java/include -L/HDFS_HOME/hdfs/src/c++/libhdfs
-L/HDFS_HOME/build/c++/Linux-i386-32/lib
-L/usr/lib/jvm/default-java/jre/lib/i386/server -ljvm -lhdfs -o
hdfs_test

 I was told that in order to add the extra directives, I need to modify
$LDFLAGS in configure.in and $LIBS in MakeFile.

I read about autoconf and checked configure.in of Postgres but still wasn't
able to know exactly what I should be doing.

Thanks