Skip to content
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

openssl build fails when converting to bzlmod #1208

Closed
andrewkatson opened this issue Jun 7, 2024 · 9 comments
Closed

openssl build fails when converting to bzlmod #1208

andrewkatson opened this issue Jun 7, 2024 · 9 comments

Comments

@andrewkatson
Copy link
Contributor

I am trying to make an openssl that works with bzlmod so I can get boost.asio working with bzlmod too. So I copied and modified the examples/third_party/openssl folder but run into some errors when compiling.

andrewkatson@Andrews-MacBook-Air openssl %  bazel build :all
INFO: Analyzed 8 targets (0 packages loaded, 0 targets configured).
ERROR: /Users/andrewkatson/openssl/BUILD.bazel:63:10: //:all_srcs: missing input file '//:bazel-out/_tmp/actions/stderr-2'
ERROR: /Users/andrewkatson/openssl/BUILD.bazel:63:10: //:all_srcs: missing input file '//:bazel-out/_tmp/actions/stderr-3'
ERROR: /Users/andrewkatson/openssl/BUILD.bazel:63:10: //:all_srcs: missing input file '//:bazel-out/_tmp/actions/stdout-2'
ERROR: /Users/andrewkatson/openssl/BUILD.bazel:63:10: //:all_srcs: missing input file '//:bazel-out/_tmp/actions/stdout-3'
ERROR: /Users/andrewkatson/openssl/BUILD.bazel:63:10: 4 input file(s) do not exist
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 0.450s, Critical Path: 0.03s
INFO: 3 processes: 3 internal.
ERROR: Build did NOT complete successfully

or

gatomic.c:392:10: error: incompatible integer to pointer conversion passing 'gssize' (aka 'long') to parameter of type 'gpointer' (aka 'void *') [-Wint-conversion]
  return g_atomic_pointer_add ((volatile gpointer *) atomic, val);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./gatomic.h:170:46: note: expanded from macro 'g_atomic_pointer_add'
    (gssize) __sync_fetch_and_add ((atomic), (val));                         \
                                             ^~~~~
gatomic.c:416:10: error: incompatible integer to pointer conversion passing 'gsize' (aka 'unsigned long') to parameter of type 'gpointer' (aka 'void *') [-Wint-conversion]
  return g_atomic_pointer_and ((volatile gpointer *) atomic, val);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./gatomic.h:177:45: note: expanded from macro 'g_atomic_pointer_and'
    (gsize) __sync_fetch_and_and ((atomic), (val));                          \
                                            ^~~~~
gatomic.c:440:10: error: incompatible integer to pointer conversion passing 'gsize' (aka 'unsigned long') to parameter of type 'gpointer' (aka 'void *') [-Wint-conversion]
  return g_atomic_pointer_or ((volatile gpointer *) atomic, val);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./gatomic.h:184:44: note: expanded from macro 'g_atomic_pointer_or'
    (gsize) __sync_fetch_and_or ((atomic), (val));                           \
                                           ^~~~~
gatomic.c:464:10: error: incompatible integer to pointer conversion passing 'gsize' (aka 'unsigned long') to parameter of type 'gpointer' (aka 'void *') [-Wint-conversion]
  return g_atomic_pointer_xor ((volatile gpointer *) atomic, val);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./gatomic.h:191:45: note: expanded from macro 'g_atomic_pointer_xor'
    (gsize) __sync_fetch_and_xor ((atomic), (val));                          \
                                            ^~~~~
4 errors generated.
make[6]: *** [Makefile:1317: libglib_2_0_la-gatomic.lo] Error 1
make[6]: Leaving directory '/private/var/tmp/_bazel_andrewkatson/4e54a0e36f2fab506a36c4eeb929d5f5/sandbox/darwin-sandbox/18/execroot/_main/bazel-out/darwin_arm64-opt-exec-ST-13d3ddad9198/bin/external/rules_foreign_cc~/toolchains/pkgconfig.build_tmpdir/glib/glib'
make[5]: *** [Makefile:1934: all-recursive] Error 1
make[5]: Leaving directory '/private/var/tmp/_bazel_andrewkatson/4e54a0e36f2fab506a36c4eeb929d5f5/sandbox/darwin-sandbox/18/execroot/_main/bazel-out/darwin_arm64-opt-exec-ST-13d3ddad9198/bin/external/rules_foreign_cc~/toolchains/pkgconfig.build_tmpdir/glib/glib'
make[4]: *** [Makefile:953: all] Error 2
make[4]: Leaving directory '/private/var/tmp/_bazel_andrewkatson/4e54a0e36f2fab506a36c4eeb929d5f5/sandbox/darwin-sandbox/18/execroot/_main/bazel-out/darwin_arm64-opt-exec-ST-13d3ddad9198/bin/external/rules_foreign_cc~/toolchains/pkgconfig.build_tmpdir/glib/glib'
make[3]: *** [Makefile:1046: all-recursive] Error 1
make[3]: Leaving directory '/private/var/tmp/_bazel_andrewkatson/4e54a0e36f2fab506a36c4eeb929d5f5/sandbox/darwin-sandbox/18/execroot/_main/bazel-out/darwin_arm64-opt-exec-ST-13d3ddad9198/bin/external/rules_foreign_cc~/toolchains/pkgconfig.build_tmpdir/glib'
make[2]: *** [Makefile:770: all] Error 2
make[2]: Leaving directory '/private/var/tmp/_bazel_andrewkatson/4e54a0e36f2fab506a36c4eeb929d5f5/sandbox/darwin-sandbox/18/execroot/_main/bazel-out/darwin_arm64-opt-exec-ST-13d3ddad9198/bin/external/rules_foreign_cc~/toolchains/pkgconfig.build_tmpdir/glib'
make[1]: *** [Makefile:707: all-recursive] Error 1
make[1]: Leaving directory '/private/var/tmp/_bazel_andrewkatson/4e54a0e36f2fab506a36c4eeb929d5f5/sandbox/darwin-sandbox/18/execroot/_main/bazel-out/darwin_arm64-opt-exec-ST-13d3ddad9198/bin/external/rules_foreign_cc~/toolchains/pkgconfig.build_tmpdir'
make: *** [Makefile:463: all] Error 2
_____ END BUILD LOGS _____
rules_foreign_cc: Build wrapper script location: bazel-out/darwin_arm64-opt-exec-ST-13d3ddad9198/bin/external/rules_foreign_cc~/toolchains/pkgconfig_tool_default_foreign_cc/wrapper_build_script.sh
rules_foreign_cc: Build script location: bazel-out/darwin_arm64-opt-exec-ST-13d3ddad9198/bin/external/rules_foreign_cc~/toolchains/pkgconfig_tool_default_foreign_cc/build_script.sh
rules_foreign_cc: Build log location: bazel-out/darwin_arm64-opt-exec-ST-13d3ddad9198/bin/external/rules_foreign_cc~/toolchains/pkgconfig_tool_default_foreign_cc/BootstrapPkgConfig.log

Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 44.838s, Critical Path: 44.18s
INFO: 3 processes: 3 internal.
ERROR: Build did NOT complete successfully

I am wondering if you have any insight into these issues?

https://github.com/andrewkatson/openssl

@andrewkatson andrewkatson changed the title openssl build fails openssl build fails when converting to bzlmod Jun 7, 2024
@jsharpe
Copy link
Member

jsharpe commented Jun 7, 2024

The first issue is fixed by adding an exclude to your source glob as detailed in this issue: #1034 (comment)

The second is due to the following issue: #1200

@andrewkatson
Copy link
Contributor Author

Oh I see my exclude glob was wrong. On the second issue is it just a wait and see sort of thing then?

@jsharpe
Copy link
Member

jsharpe commented Jun 10, 2024

@andrewkatson its wait for someone to apply the patch linked into that issue to the pkg-config build; note that this is specific to the latest versions of macOS due to the version of clang, on older compiler this will work fine as is.
FYI its probably no harder than building openssl to contribute the patch to fix this, so don't be afraid of having a go..

@andrewkatson
Copy link
Contributor Author

I could try but what is the bar to contribute this? I saw the message the author of the other issue sent already is there more to be done?

@jsharpe
Copy link
Member

jsharpe commented Jun 10, 2024

The build of pkg-config needs updating to use a separate build of glib which has the patch that the author has created (or a version of glib that has this already applied - not sure if upstream have accepted the patch - I haven't checked).

@andrewkatson
Copy link
Contributor Author

Okay I commented on their official gitlab page about it. There was already an open issue so I just +1 it. Ill figure out if there is already an effort underway or what the steps would be.

@jsharpe
Copy link
Member

jsharpe commented Jun 11, 2024

The fix in this repo is to use the patch_commands option for http_repository to bring in a custom version of glib where the patch is applied locally so it can be fixed here ahead of it landing upstream; AFAIK pkg-config is under maintained which means it may take some time before any fixes land in a release from upstream.

@andrewkatson
Copy link
Contributor Author

Oh I see what you are saying. Ill try that.

@andrewkatson
Copy link
Contributor Author

It is fixed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants