You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@age.apache.org by "kenwoon (via GitHub)" <gi...@apache.org> on 2023/04/26 19:11:10 UTC
[GitHub] [age] kenwoon opened a new issue, #859: How are include statements being referenced in files like "age.c"?
kenwoon opened a new issue, #859:
URL: https://github.com/apache/age/issues/859
How are the `#include "postgres.h"` and `#include "fmgr.h"` inside "age.c" being referenced? Both the files are not present in the same directory as "age.c" but are in the "src" directory in Postgresql. I would like to know how this is done in order to reduce moving files around too much as I am working in the backend.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@age.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [age] kenwoon closed issue #859: How are include statements being referenced in files like "age.c"?
Posted by "kenwoon (via GitHub)" <gi...@apache.org>.
kenwoon closed issue #859: How are include statements being referenced in files like "age.c"?
URL: https://github.com/apache/age/issues/859
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@age.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [age] M4rcxs commented on issue #859: How are include statements being referenced in files like "age.c"?
Posted by "M4rcxs (via GitHub)" <gi...@apache.org>.
M4rcxs commented on issue #859:
URL: https://github.com/apache/age/issues/859#issuecomment-1524018771
To reference the header files in the source code, the directory path must be added to the include path in the [Makefile](https://github.com/apache/age/blob/master/Makefile).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@age.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [age] carlasanches commented on issue #859: How are include statements being referenced in files like "age.c"?
Posted by "carlasanches (via GitHub)" <gi...@apache.org>.
carlasanches commented on issue #859:
URL: https://github.com/apache/age/issues/859#issuecomment-1524101541
The reference occurs in lines 116, 117, and 118 of the [Makefile](https://github.com/apache/age/blob/master/Makefile) @M4rcxs mentioned. When installing the extension, `PG_CONFIG = pg_config` receives the path to the `pg_config` executable, which contains information about the installation, includes, and libraries directories path of PostgreSQL.
Then, the variable `PGXS` receives the path to the `pgxs` directory, which contains rules for building PostgreSQL extensions using the command `$(PG_CONFIG) --pgxs`.
Finally, `include $(PGXS)` will include the makefile that contain rules for compiling and installing the extension, as include `"postgres.h"` and other headers.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@age.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [age] humzakt commented on issue #859: How are include statements being referenced in files like "age.c"?
Posted by "humzakt (via GitHub)" <gi...@apache.org>.
humzakt commented on issue #859:
URL: https://github.com/apache/age/issues/859#issuecomment-1527102686
When you see #include statements like #include "postgres.h" and #include "fmgr.h" in the age.c file, it means that the source code relies on the header files postgres.h and fmgr.h provided by the PostgreSQL source code.
The PostgreSQL build system uses the Makefile to specify the necessary include paths, libraries, and compilation flags. When compiling the Apache AGE extension, the PostgreSQL build system will automatically include the required header files from the PostgreSQL source code.
The Makefile or Makefile.in (if using autoconf) in the Apache AGE extension should have a line similar to the following:
`PG_CPPFLAGS = -I$(libpq_srcdir)`
This line specifies that the PostgreSQL header files should be included from the libpq_srcdir directory, which is defined in the pg_config output. This allows the build system to find the required PostgreSQL header files without having to move them around manually.
To build the extension, you should use the make command along with the appropriate PostgreSQL build environment. The pg_config tool provides information about the installed PostgreSQL instance, including the include paths and library paths.
To ensure the correct paths are used when building the extension, you should use the pgxs build infrastructure. In the extension's Makefile, you'll typically find a line like:
`PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)`
This sets up the necessary build environment for your extension, including the proper include paths for the PostgreSQL header files.
In summary, you don't need to move the header files around as long as your build environment is set up correctly with the appropriate PostgreSQL paths. The Makefile and pg_config tool handle locating the required header files during the build process.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@age.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org