1

Need to compile some add'l libs on Ubuntu w/ same switches as gcc.

Q: How can I determine on Ubuntu what siwtches were used with libc?

One earlier suggestion was using "apt-src", but nothing in the man pages for apt-src seems to show what switches were used with a binary package. "apt show" has some information, but not the actual compiler switches.

This matters because I'm trying to compile other packages that need consistent library switches between mutiple lib's.

1
  • To answer your title, see gcc --help and man gcc to answer your actual question see the called duplicate.
    – Elder Geek
    Apr 13, 2018 at 19:33

1 Answer 1

1

This will take a little work, but it's doable. Ubuntu has a very specific policy on compiler flags which is summarized in this wiki entry. In short, the standard runtime compiler flag set is CFLAGS="-O2 -g". However, package builders do have to change the default flag set for any number of detailed reasons (e.g. compiler issue workarounds). So to be sure, you will need to download the source for the package of interest, libc in this case, and look for the BUILD_CFLAGS in the debian/rules file.

For example, in artful, you can find the package page for libc6 here: http://packages.ubuntu.com/artful/libc6-amd64. From the side bar on the right-hand side, you can download the source files. In particular, the control files live in glibc_2.26-0ubuntu2.1.debian.tar.xz. Grabbing that, unpacking and looking in debian/rules, I see that BUILD_CFLAGS=-O2 -g.

1
  • Thanks, my bad. It is BUILD_CFLAGS of course.
    – Martin W
    Apr 13, 2018 at 15:16

Not the answer you're looking for? Browse other questions tagged .