-
Notifications
You must be signed in to change notification settings - Fork 231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compiling postgres with unquoted CONFIGURE_ARGS #442
Comments
I think I have a workaround. I redefined CONFIGURE_ARGS in the
|
Unfortunately, that override removes all configure flags which didn't work for my use case that requires building postgres with OpenSSL. The following worked for me and preserved the flags I needed to send to
Likely after this PR is merged, this issue will disappear: |
Nice! I just ran into the need to have SSL support for Postgres. Would you mind sharing the |
# OpenSSL build rules
# https://github.com/bazelbuild/rules_foreign_cc/issues/337#issuecomment-657004174
CONFIGURE_OPTIONS = [
"no-weak-ssl-ciphers",
"no-idea",
"no-comp",
]
configure_make(
name = "openssl",
configure_command = "config",
configure_env_vars = select({
"@platforms//os:macos": {
"AR": "",
},
"//conditions:default": {},
}),
configure_options = select({
"@platforms//os:macos": [
"shared",
"no-afalgeng",
"ARFLAGS=r",
] + CONFIGURE_OPTIONS,i
"//conditions:default": [
] + CONFIGURE_OPTIONS,
}),
lib_source = "@openssl//:all",
shared_libraries = select({
"@platforms//os:macos": [
"libssl.dylib",
"libcrypto.dylib",
],
"//conditions:default": [
"libssl.so",
"libcrypto.so",
],
}),
)
configure_make(
name = "postgres-all",
lib_source = "@postgres//:all",
configure_env_vars = select({
"@platforms//os:macos": {"AR": ""},
"//conditions:default": {},
}),
configure_options = [
"--with-openssl",
"--with-libraries=$EXT_BUILD_DEPS/openssl/lib",
"--with-includes=$EXT_BUILD_DEPS/openssl/include",
# See: https://github.com/bazelbuild/rules_foreign_cc/pull/362
"CFLAGS='-Dredacted=\\\"redacted\\\"'",
],
binaries = [
"pg_ctl",
"createdb",
"initdb",
"psql",
"pg_config",
"postgres",
],
deps = [
":openssl",
],
) WORKSPACE http_archive(
name = "openssl",
build_file_content = all_content,
strip_prefix = "openssl-OpenSSL_1_1_1j",
url = "https://github.com/openssl/openssl/archive/OpenSSL_1_1_1j.tar.gz",
sha256 = "22d6588e4a7c5ad48fcac2fbf1d035bd43258c22a49457dad0539ded0651b4d2"
)
http_archive(
name = "postgres",
build_file_content = all_content,
strip_prefix = "postgresql-13.2",
url = "https://ftp.postgresql.org/pub/source/v13.2/postgresql-13.2.tar.gz",
sha256 = "3386a40736332aceb055c7c9012ecc665188536d874d967fcc5a33e7992f8080",
) |
With the same justification as #537 (comment), can this be closed? |
Thank you for posting these postgres rules @jschaf and @rahulmutt, this is super useful!
|
@aapeliv Out of curiosity which mac os version and which clang version did you have? I've also been using those rules on Mac and didn't need the extra |
Would #567 fix this? |
This issue has been automatically marked as stale because it has not had any activity for 180 days. It will be closed if no further activity occurs in 30 days. Collaborators can add an assignee to keep this open indefinitely. Thanks for your contributions to rules_foreign_cc! |
This issue was automatically closed because it went 30 days without a reply since it was labeled "Can Close?" |
@aapeliv @rahulmutt Have either of you guys have been able to compile I keep getting
|
I'm having trouble compiling Postgres, specifically with configure strings and C macros.
Stack trace
The root of the problem seems to be the lack of string escaping in CONFIGURE_ARGS:
CONFIGURE_ARGS is created in the configure script with:
I've tried the recommendation from #239 but it also errors.
The resulting macro definition is:
The text was updated successfully, but these errors were encountered: