Skip to content

symbols are not included when building with optimization #109

Closed

Description

@moham96

Hi,
I am trying to build this perl module which uses fribidi Text-Bidi under Archlinux, unfortunately it fails to build due to missing symbols of the library that is shipped with archlinux.
undefined symbol: fribidi_unicode_version
after some digging it turns out that there are some problems with the package that is shipped with Archlinux(by looking at the PKGBUILD):

  • because the Archlinux build system (ABS) automatically strips the symtab table from the elf binary some symbols that are in this table are removed so I instructed ABS to not run the elf binaries through strip by disabling the strip option

options=(!strip)

  • because the package is built with some optimization options (default on archlinux and derivatives) specifically these :

CPPFLAGS="-D_FORTIFY_SOURCE=2"
CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt"
CXXFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt"
LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now"

this causes the resulting .so file to lack symbols including fribidi_unicode_version
disabling these flags result in an elf binary that has these symbols but the build system complains about disabling optimizations, I get a lot of these:

# warning _FORTIFY_SOURCE requires compiling with optimization (-O)

so a couple of questions i have:

  • is this package supposed to be built with optimizations or not?
  • is removing the fribidi_unicode_version symbol from the optimized version intentional ? or a bug?

I have opened similar bug reports on the relevant projects here:

Activity

  1. dov commented on May 24, 2019

    @dov
    Contributor

    is this package supposed to be built with optimizations or not?

    Of course! Why wouldn'it be. The faster the better.

    is removing the fribidi_unicode_version symbol from the optimized version intentional ? or a bug?

    The debug and the optimized versions are supposed to support the same API. If they do not, it's a bug.

    Feel free to submit a pull request or just point out where the problem is.

  2. moham96 commented on May 24, 2019

    @moham96
    Author

    Feel free to submit a pull request or just point out where the problem is.

    I don't know much about meson build system so I couldn't really track down the problem, that's why i opened the issue hoping someone with more experience can have a look.
    keep in mind that if i build using the usual ./autogen.sh and make then i get no problem, so the issue is in the meson route of building

  3. khaledhosny commented on May 24, 2019

    @khaledhosny
    Contributor

    CC @tp-m, @nirbheek, @CoffeeFlux who contributed/worked on the meson build before.

  4. CoffeeFlux commented on May 24, 2019

    @CoffeeFlux
    Contributor

    I'm on OSX at the moment and so I can't actually test the autotools system to compare, but at a glance meson's behavior seems correct. It sets -fvisibility=hidden by default (which ensures *nix builds are consistent with MSVC ones) and then will export any symbols marked with FRIBIDI_ENTRY, which does not include fribidi_unicode_version. That seems like it was intended to be public, so I'll make a PR adding it to fribidi.h.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions