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

glibc glibc@2.13: fix local time zone setting (again) #138629

Merged
merged 2 commits into from
Aug 10, 2023

Conversation

ZhongRuoyu
Copy link
Member

@ZhongRuoyu ZhongRuoyu commented Aug 5, 2023

  • Have you followed the guidelines for contributing?
  • Have you ensured that your commits follow the commit style guide?
  • Have you checked that there aren't other open pull requests for the same formula update/change?
  • Have you built your formula locally with HOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source <formula>, where <formula> is the name of the formula you're submitting?
  • Is your test running fine brew test <formula>, where <formula> is the name of the formula you're submitting?
  • Does your build pass brew audit --strict <formula> (after doing HOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source <formula>)? If this is a new formula, does it pass brew audit --new <formula>?

#138622 didn't work as intended, unfortunately. This should do it.

Tested on Ubuntu 20.04, before:

$ sudo ln -sf /usr/share/zoneinfo/Asia/Singapore /etc/localtime
$ `brew --prefix python3`/bin/python3 -c "import time; print(time.localtime().tm_zone)"
UTC
$ ls -al `brew --prefix`/etc/localtime
ls: cannot access '/home/linuxbrew/.linuxbrew/etc/localtime': No such file or directory
$ ls -al `brew --prefix glibc`/etc/localtime
lrwxrwxrwx 1 linuxbrew linuxbrew 34 Aug  5 17:39 /home/linuxbrew/.linuxbrew/opt/glibc/etc/localtime -> ../../../../../../../etc/localtime

After:

$ sudo ln -sf /usr/share/zoneinfo/Asia/Singapore /etc/localtime
$ `brew --prefix python3`/bin/python3 -c "import time; print(time.localtime().tm_zone)"
+08
$ ls -al `brew --prefix`/etc/localtime
lrwxrwxrwx 1 linuxbrew linuxbrew 25 Aug  5 17:29 /home/linuxbrew/.linuxbrew/etc/localtime -> ../../../../etc/localtime

Also, apply the same to glibc@2.13.

@github-actions github-actions bot added the linux-only Formula depends on Linux label Aug 5, 2023
@ZhongRuoyu ZhongRuoyu changed the title glibc: fix local time zone setting (again) glibc glibc@2.13: fix local time zone setting (again) Aug 5, 2023
@ZhongRuoyu ZhongRuoyu added the CI-no-bottles Merge without publishing bottles label Aug 5, 2023
@ZhongRuoyu
Copy link
Member Author

checking for gcc... gcc-11
checking version of gcc-11... 11.4.0, bad
checking for gnumake... gnumake
checking version of gnumake... 4.3, ok
checking for gnumsgfmt... no
checking for gmsgfmt... no
checking for msgfmt... no
checking for makeinfo... no
checking for sed... sed
checking version of sed... v. ?.??, bad
checking for autoconf... no
configure: error: 
*** These critical programs are missing or too old: gcc
*** Check the INSTALL file for required versions.

@github-actions github-actions bot added the autosquash Automatically squash pull request commits according to Homebrew style. label Aug 5, 2023
@ZhongRuoyu
Copy link
Member Author

Error should be unrelated.

@github-actions github-actions bot removed the autosquash Automatically squash pull request commits according to Homebrew style. label Aug 5, 2023
@iMichka
Copy link
Member

iMichka commented Aug 5, 2023

/usr/bin/ld: /tmp/glibcA2.13-20230805-9979-pciuvo/glibc-2.13/build/csu/crt1.o: relocation R_X86_64_32S against symbol `__libc_csu_fini' can not be used when making a PIE object; recompile with -fPIE

Not so sure .. it did not build a bottle. I don't remember, are we supposed to build glibc@2.13 with gcc-11?

@ZhongRuoyu
Copy link
Member Author

ZhongRuoyu commented Aug 6, 2023

I don't remember, are we supposed to build glibc@2.13 with gcc-11?

I don't think so. (I don't think this is even used by users since we migrated CI to Ubuntu 22.04, actually; install count is low.) It was last built in #105136, when we still ran CI on Ubuntu 16.04.

@Bo98
Copy link
Member

Bo98 commented Aug 6, 2023

-no-pie will probably fix it

@ZhongRuoyu ZhongRuoyu force-pushed the glibc-localtime branch 3 times, most recently from bf1f9b8 to 6d5b50d Compare August 7, 2023 02:00
@ZhongRuoyu
Copy link
Member Author

  Unwanted system libraries:
    /lib/x86_64-linux-gnu/libnsl.so.1

Deprecated in Homebrew/brew#13741.

@iMichka
Copy link
Member

iMichka commented Aug 7, 2023

Maybe try depends_on "libnsl". That version is a newer 2.0.0 version, which might be usable instead.

@ZhongRuoyu
Copy link
Member Author

ZhongRuoyu commented Aug 7, 2023

That would pull in the following dependencies, though:

$ brew deps --tree libnsl
libnsl
└── libtirpc
    └── krb5
        └── openssl@3
            └── ca-certificates

Is that a concern?

@Bo98
Copy link
Member

Bo98 commented Aug 7, 2023

There should be absolutely no dependencies.

This formula has a very specific scope. It's not designed to be installed by end users and is only designed to be a build dependencies for our Portable Ruby. The only reason it is still in homebrew-cores is mainly because we want to build bottles so we don't build glibc every time in Portable Ruby CI when it should never change (glibc is not shipped with Portable Ruby).

Really the linkage error is sort of misleading given the special case of glibc. Logically the linkage checker is correct for what it was designed for, but with glibc you typically have a custom ldconfig pointing to glibc, so glibc itself isn't configured with RPATHs to find the library correctly. libnsl is shipped with glibc itself for this old version.

With that said, we could just rm things like libnss_compat, libnss_nis and bin/nscd etc that link to libnsl given we probably don't need them.

Tested on Ubuntu 20.04, before:

    $ sudo ln -sf /usr/share/zoneinfo/Asia/Singapore /etc/localtime
    $ `brew --prefix python3`/bin/python3 -c "import time; print(time.localtime().tm_zone)"
    UTC

After:

    $ sudo ln -sf /usr/share/zoneinfo/Asia/Singapore /etc/localtime
    $ `brew --prefix python3`/bin/python3 -c "import time; print(time.localtime().tm_zone)"
    +08
Also:
- add a mirror;
- make it build with `gcc-11`;
- remove executables/dylibs that link with system libnsl.
@BrewTestBot BrewTestBot added this pull request to the merge queue Aug 10, 2023
Merged via the queue into Homebrew:master with commit 04a7637 Aug 10, 2023
14 checks passed
@ZhongRuoyu ZhongRuoyu deleted the glibc-localtime branch August 10, 2023 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI-no-bottles Merge without publishing bottles linux-only Formula depends on Linux
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants