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

recompile with -fPIC with krb5.nix #1

Open
573 opened this issue May 31, 2021 · 9 comments
Open

recompile with -fPIC with krb5.nix #1

573 opened this issue May 31, 2021 · 9 comments

Comments

@573
Copy link

573 commented May 31, 2021

Description of issue

excerpt, full log here:

@nix { "action": "setPhase", "phase": "buildPhase" }
building
build flags: -j2 -l2 SHELL=/nix/store/i60xw7zwqyd3wwgkafadyizhp77y9hdf-bash-4.4-p23/bin/bash
Making all in lib
make[1]: Entering directory '/build/curl-7.76.1/lib'
make  all-am
make[2]: Entering directory '/build/curl-7.76.1/lib'
  CC       libcurl_la-altsvc.lo
  CC       libcurl_la-amigaos.lo
  CC       libcurl_la-asyn-ares.lo
  CC       libcurl_la-asyn-thread.lo
  CC       libcurl_la-base64.lo
  CC       libcurl_la-c-hyper.lo
  CC       libcurl_la-conncache.lo
  CC       libcurl_la-connect.lo
  CC       libcurl_la-content_encoding.lo
  CC       libcurl_la-cookie.lo
  CC       libcurl_la-curl_addrinfo.lo
  CC       libcurl_la-curl_ctype.lo
  CC       libcurl_la-curl_des.lo
  CC       libcurl_la-curl_endian.lo
  CC       libcurl_la-curl_fnmatch.lo
  CC       libcurl_la-curl_get_line.lo
  CC       libcurl_la-curl_gethostname.lo
  CC       libcurl_la-curl_gssapi.lo
  CC       libcurl_la-curl_memrchr.lo
  CC       libcurl_la-curl_multibyte.lo
  CC       libcurl_la-curl_ntlm_core.lo
  CC       libcurl_la-curl_ntlm_wb.lo
  CC       libcurl_la-curl_path.lo
  CC       libcurl_la-curl_range.lo
  CC       libcurl_la-curl_rtmp.lo
  CC       libcurl_la-curl_sasl.lo
  CC       libcurl_la-curl_sspi.lo
  CC       libcurl_la-curl_threads.lo
  CC       libcurl_la-dict.lo
  CC       libcurl_la-doh.lo
  CC       libcurl_la-dotdot.lo
  CC       libcurl_la-dynbuf.lo
  CC       libcurl_la-easy.lo
  CC       libcurl_la-easygetopt.lo
  CC       libcurl_la-easyoptions.lo
  CC       libcurl_la-escape.lo
  CC       libcurl_la-file.lo
  CC       libcurl_la-fileinfo.lo
  CC       libcurl_la-formdata.lo
  CC       libcurl_la-ftp.lo
  CC       libcurl_la-ftplistparser.lo
  CC       libcurl_la-getenv.lo
  CC       libcurl_la-getinfo.lo
  CC       libcurl_la-gopher.lo
  CC       libcurl_la-hash.lo
  CC       libcurl_la-hmac.lo
  CC       libcurl_la-hostasyn.lo
  CC       libcurl_la-hostcheck.lo
  CC       libcurl_la-hostip.lo
  CC       libcurl_la-hostip4.lo
  CC       libcurl_la-hostip6.lo
  CC       libcurl_la-hostsyn.lo
  CC       libcurl_la-hsts.lo
  CC       libcurl_la-http.lo
  CC       libcurl_la-http2.lo
  CC       libcurl_la-http_chunks.lo
  CC       libcurl_la-http_digest.lo
  CC       libcurl_la-http_negotiate.lo
  CC       libcurl_la-http_ntlm.lo
  CC       libcurl_la-http_proxy.lo
  CC       libcurl_la-http_aws_sigv4.lo
  CC       libcurl_la-idn_win32.lo
  CC       libcurl_la-if2ip.lo
  CC       libcurl_la-imap.lo
  CC       libcurl_la-inet_ntop.lo
  CC       libcurl_la-inet_pton.lo
  CC       libcurl_la-krb5.lo
  CC       libcurl_la-ldap.lo
  CC       libcurl_la-llist.lo
  CC       libcurl_la-md4.lo
  CC       libcurl_la-md5.lo
  CC       libcurl_la-memdebug.lo
  CC       libcurl_la-mime.lo
  CC       libcurl_la-mprintf.lo
  CC       libcurl_la-mqtt.lo
  CC       libcurl_la-multi.lo
  CC       libcurl_la-netrc.lo
  CC       libcurl_la-non-ascii.lo
  CC       libcurl_la-nonblock.lo
  CC       libcurl_la-openldap.lo
  CC       libcurl_la-parsedate.lo
  CC       libcurl_la-pingpong.lo
  CC       libcurl_la-pop3.lo
  CC       libcurl_la-progress.lo
  CC       libcurl_la-psl.lo
  CC       libcurl_la-rand.lo
  CC       libcurl_la-rename.lo
  CC       libcurl_la-rtsp.lo
  CC       libcurl_la-select.lo
  CC       libcurl_la-sendf.lo
  CC       libcurl_la-setopt.lo
  CC       libcurl_la-sha256.lo
  CC       libcurl_la-share.lo
  CC       libcurl_la-slist.lo
  CC       libcurl_la-smb.lo
  CC       libcurl_la-smtp.lo
  CC       libcurl_la-socketpair.lo
  CC       libcurl_la-socks.lo
  CC       libcurl_la-socks_gssapi.lo
  CC       libcurl_la-socks_sspi.lo
  CC       libcurl_la-speedcheck.lo
  CC       libcurl_la-splay.lo
  CC       libcurl_la-strcase.lo
  CC       libcurl_la-strdup.lo
  CC       libcurl_la-strerror.lo
  CC       libcurl_la-strtok.lo
  CC       libcurl_la-strtoofft.lo
  CC       libcurl_la-system_win32.lo
  CC       libcurl_la-telnet.lo
  CC       libcurl_la-tftp.lo
  CC       libcurl_la-timeval.lo
  CC       libcurl_la-transfer.lo
  CC       libcurl_la-url.lo
  CC       libcurl_la-urlapi.lo
  CC       libcurl_la-version.lo
  CC       libcurl_la-version_win32.lo
  CC       libcurl_la-warnless.lo
  CC       libcurl_la-wildcard.lo
  CC       libcurl_la-x509asn1.lo
  CC       vauth/libcurl_la-cleartext.lo
  CC       vauth/libcurl_la-cram.lo
  CC       vauth/libcurl_la-digest.lo
  CC       vauth/libcurl_la-digest_sspi.lo
  CC       vauth/libcurl_la-gsasl.lo
  CC       vauth/libcurl_la-krb5_gssapi.lo
  CC       vauth/libcurl_la-krb5_sspi.lo
  CC       vauth/libcurl_la-ntlm.lo
  CC       vauth/libcurl_la-ntlm_sspi.lo
  CC       vauth/libcurl_la-oauth2.lo
  CC       vauth/libcurl_la-spnego_gssapi.lo
  CC       vauth/libcurl_la-spnego_sspi.lo
  CC       vauth/libcurl_la-vauth.lo
  CC       vtls/libcurl_la-bearssl.lo
  CC       vtls/libcurl_la-gskit.lo
  CC       vtls/libcurl_la-gtls.lo
  CC       vtls/libcurl_la-keylog.lo
  CC       vtls/libcurl_la-mbedtls.lo
  CC       vtls/libcurl_la-mbedtls_threadlock.lo
  CC       vtls/libcurl_la-mesalink.lo
  CC       vtls/libcurl_la-nss.lo
  CC       vtls/libcurl_la-openssl.lo
  CC       vtls/libcurl_la-rustls.lo
  CC       vtls/libcurl_la-schannel.lo
  CC       vtls/libcurl_la-schannel_verify.lo
  CC       vtls/libcurl_la-sectransp.lo
  CC       vtls/libcurl_la-vtls.lo
  CC       vtls/libcurl_la-wolfssl.lo
  CC       vquic/libcurl_la-ngtcp2.lo
  CC       vquic/libcurl_la-quiche.lo
  CC       vquic/libcurl_la-vquic.lo
  CC       vssh/libcurl_la-libssh.lo
  CC       vssh/libcurl_la-libssh2.lo
  CC       vssh/libcurl_la-wolfssh.lo
  CCLD     libcurl.la
/nix/store/30kg865p8ixsvblqypmfwzvqx72fglws-binutils-2.35.1/bin/ld: /nix/store/h07dwl5mpvyv9c4h60r6gs1frd9s9c4c-libkrb5-1.18/lib/libkrb5.a(prompter.o): warning: relocation against `stdout' in read-only section `.text'
/nix/store/30kg865p8ixsvblqypmfwzvqx72fglws-binutils-2.35.1/bin/ld: /nix/store/h07dwl5mpvyv9c4h60r6gs1frd9s9c4c-libkrb5-1.18/lib/libgssapi_krb5.a(util_errmap.o): relocation R_X86_64_PC32 against symbol `stderr' can not be used when making a shared object; recompile with -fPIC
/nix/store/30kg865p8ixsvblqypmfwzvqx72fglws-binutils-2.35.1/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:1537: libcurl.la] Error 1
make[2]: Leaving directory '/build/curl-7.76.1/lib'
make[1]: *** [Makefile:1346: all] Error 2
make[1]: Leaving directory '/build/curl-7.76.1/lib'
make: *** [Makefile:1255: all-recursive] Error 1

(Steps to reproduce: Include a minimal SQL definition plus how you make the request to PostgREST and the response body)
Checkout upgrade branch (some patches disabled f.) and run nix-build -A postgrestStatic.

@573
Copy link
Author

573 commented May 31, 2021

Related to curl/curl#4564: patch selection needs more work than just disabling (failing patch):

building '/nix/store/n1bmsiw0y8ppljlzypjri7627qkq93pw-patched-nixpkgs.drv'...
Applying patch /nix/store/5x5kk7h2pwr8x1d8svgpph8xhsd905jz-nixpkgs-openssl-split-runtime-dependencies-of-static-builds.patch
patching file pkgs/development/libraries/openssl/default.nix
Hunk #1 succeeded at 50 (offset 16 lines).
Hunk PostgREST#2 FAILED at 85.
Hunk PostgREST#3 FAILED at 116.
Hunk PostgREST#4 FAILED at 130.
3 out of 4 hunks FAILED -- saving rejects to file pkgs/development/libraries/openssl/default.nix.rej
builder for '/nix/store/n1bmsiw0y8ppljlzypjri7627qkq93pw-patched-nixpkgs.drv' failed with exit code 1
error: build of '/nix/store/n1bmsiw0y8ppljlzypjri7627qkq93pw-patched-nixpkgs.drv' failed

@573
Copy link
Author

573 commented Jun 1, 2021

nixpkgs faf5bbb6bf1a9e86b22cd45aecec339d4ade49bc:
nixpkgs-openssl-split-runtime-dependencies-of-static-builds.patch updated.

@573 573 changed the title postgrestStatic build fails after nixpkgs / static-haskell-nix upgrade gdb-fix-libintl.patch outdated Jun 1, 2021
@573
Copy link
Author

573 commented Jun 1, 2021

Now with the patch inplace I get another patching error.

patching file pkgs/development/tools/misc/gdb/default.nix
Hunk #1 FAILED at 26.

@573
Copy link
Author

573 commented Jun 1, 2021

l. 112 syntax error in patched openssl/default.nix (illegal second +). Fixed by c06e5a1

@573
Copy link
Author

573 commented Jun 1, 2021

WIP:

CCLD libcurl.la
/nix/store/30kg865p8ixsvblqypmfwzvqx72fglws-binutils-2.35.1/bin/ld: /nix/store/58nhrq3awcjdm6dj287b3hrd2n1s7kjg-libkrb5-1.18/lib/libkrb5.a(prompter.o): warning: relocation against stdout' in read-only section .text'
/nix/store/30kg865p8ixsvblqypmfwzvqx72fglws-binutils-2.35.1/bin/ld: /nix/store/58nhrq3awcjdm6dj287b3hrd2n1s7kjg-libkrb5-1.18/lib/libgssapi_krb5.a(util_errmap.o): relocation R_X86_64_PC32 against symbol `stderr' can not be used when making a shared object; recompile with -fPIC
/nix/store/30kg865p8ixsvblqypmfwzvqx72fglws-binutils-2.35.1/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:1537: libcurl.la] Error 1
make[2]: Leaving directory '/build/curl-7.76.1/lib'
make[1]: *** [Makefile:1346: all] Error 2
make[1]: Leaving directory '/build/curl-7.76.1/lib'
make: *** [Makefile:1255: all-recursive] Error 1

@573
Copy link
Author

573 commented Jun 1, 2021

found possibly related issues

I. e.

NO_SHARED = !enableShared;
actually, it is also needed to prevent

/nix/store/394p75bacqaiv0xvyna0kazf2lg16sjs-x86_64-unknown-linux-musl-binutils-2.31.1/bin/x86_64-unknown-linux-musl-ld: /nix/store/cmrar1sgj5jpr9h1ypf3s6sbphaxp8zk-x86_64-unknown-linux-musl-stage-final-gfortran-debug-9.2.0/lib/gcc/x86_64-unknown-linux-musl/9.2.0/crtbeginT.o: relocation R_X86_64_32 against hidden symbol `__TMC_END__' can not be used when making a shared object
/nix/store/394p75bacqaiv0xvyna0kazf2lg16sjs-x86_64-unknown-linux-musl-binutils-2.31.1/bin/x86_64-unknown-linux-musl-ld: /nix/store/cmrar1sgj5jpr9h1ypf3s6sbphaxp8zk-x86_64-unknown-linux-musl-stage-final-gfortran-debug-9.2.0/lib/gcc/x86_64-unknown-linux-musl/9.2.0/crtend.o: relocation R_X86_64_32 against `.ctors' can not be used when making a shared object; recompile with -fPIC
/nix/store/394p75bacqaiv0xvyna0kazf2lg16sjs-x86_64-unknown-linux-musl-binutils-2.31.1/bin/x86_64-unknown-linux-musl-ld: final link failed: nonrepresentable section on output

Originally posted by @FRidh in NixOS/nixpkgs#76832 (comment)

DONT Try this patch:

diff --git a/pkgs/development/libraries/kerberos/krb5.nix b/pkgs/development/libraries/kerberos/krb5.nix
index ebec5936b54..9d430bfa047 100644
--- a/pkgs/development/libraries/kerberos/krb5.nix
+++ b/pkgs/development/libraries/kerberos/krb5.nix
@@ -42,6 +42,7 @@ stdenv.mkDerivation rec {
     # krb5's ./configure does not allow passing --enable-shared and --enable-static at the same time.
     # See https://bbs.archlinux.org/viewtopic.php?pid=1576737#p1576737
     ++ optional staticOnly [ "--enable-static" "--disable-shared" ]
+    ++ optional (!staticOnly) [ "--disable-static" "--enable-shared" ]
     ++ optional stdenv.isFreeBSD ''WARN_CFLAGS=""''
     ++ optionals (stdenv.buildPlatform != stdenv.hostPlatform)
        [ "krb5_cv_attr_constructor_destructor=yes,yes"

Does not fix it.

@573 573 changed the title gdb-fix-libintl.patch outdated recompile with -fPIC with krb5.nix Jun 1, 2021
@573
Copy link
Author

573 commented Jun 2, 2021

TODO Are the patches applied in any case ?
Maybe stdenv.hostPlatform.isMusl is too narrow ?

@573
Copy link
Author

573 commented Jun 2, 2021

Also see this

@573
Copy link
Author

573 commented Jun 3, 2021

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

1 participant