Code Monkey home page Code Monkey logo

Comments (6)

kyz avatar kyz commented on May 24, 2024

This is exactly the same error message as #34

It's most likely your environment's sed command does not work as promised. This leads the configure script to fail, which you will see as:

checking command to parse /usr/bin/x86_64-pc-linux-gnu-nm -B output from gcc object... failed

And if you ignore that, it leads libtool to fail with the error about "syntax error near unexpected token '|'"

  1. What distro/version are you using to build?
  2. What are the commands and environment variables being used to build?
  3. What is the output of configure and config.log?

The issue you're facing likely has nothing to do with LTO support. Here is libmspack being built with -flto -O3 on Ubunutu 18.04.4:

$ ./cleanup.sh 
$ ./autogen.sh
libtoolize: putting auxiliary files in '.'.
libtoolize: copying file './ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: copying file 'm4/libtool.m4'
libtoolize: copying file 'm4/ltoptions.m4'
libtoolize: copying file 'm4/ltsugar.m4'
libtoolize: copying file 'm4/ltversion.m4'
libtoolize: copying file 'm4/lt~obsolete.m4'
configure.ac:23: installing './ar-lib'
configure.ac:21: installing './compile'
configure.ac:25: installing './config.guess'
configure.ac:25: installing './config.sub'
configure.ac:6: installing './install-sh'
configure.ac:6: installing './missing'
Makefile.am: installing './INSTALL'
Makefile.am: installing './depcomp'
parallel-tests: installing './test-driver'
you can now run ./configure
$ CFLAGS='-flto -O3' LDFLAGS='-flto=6 -Wl,-O1,-s' ./configure 
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking for ar... ar
checking the archiver (ar) interface... ar
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking how to print strings... printf
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for mt... mt
checking if mt is a manifest tool... no
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for inttypes.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking for inline... inline
checking whether byte ordering is bigendian... no
checking for mode_t... yes
checking for off_t... yes
checking for size_t... yes
checking size of off_t... 8
checking for mkdir... yes
checking for _mkdir... no
checking whether mkdir takes one argument... no
checking for towlower... yes
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking for _LARGEFILE_SOURCE value needed for large files... no
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating libmspack.pc
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands
$ make
make  all-am
make[1]: Entering directory '/home/kyz/devel/libmspack/libmspack'
  CC       mspack/system.lo
  CC       mspack/cabc.lo
  CC       mspack/cabd.lo
  CC       mspack/chmc.lo
  CC       mspack/chmd.lo
  CC       mspack/hlpc.lo
  CC       mspack/hlpd.lo
  CC       mspack/litc.lo
  CC       mspack/litd.lo
  CC       mspack/kwajc.lo
  CC       mspack/kwajd.lo
  CC       mspack/szddc.lo
  CC       mspack/szddd.lo
  CC       mspack/oabc.lo
  CC       mspack/oabd.lo
  CC       mspack/lzxc.lo
  CC       mspack/lzxd.lo
  CC       mspack/mszipc.lo
  CC       mspack/mszipd.lo
  CC       mspack/qtmd.lo
  CC       mspack/lzssd.lo
  CC       mspack/crc32.lo
  CCLD     libmspack.la
/usr/bin/nm: mspack/.libs/lzxc.o: no symbols
/usr/bin/nm: mspack/.libs/mszipc.o: no symbols
ar: `u' modifier ignored since `D' is the default (see `U')
  CCLD     libmscabd.la
ar: `u' modifier ignored since `D' is the default (see `U')
  CCLD     libmschmd.la
ar: `u' modifier ignored since `D' is the default (see `U')
  CC       examples/cabd_memory.o
  CCLD     examples/cabd_memory
  CC       examples/cabrip.o
  CCLD     examples/cabrip
  CC       examples/chmextract.o
  CCLD     examples/chmextract
  CC       examples/msexpand.o
  CCLD     examples/msexpand
  CC       examples/multifh.o
  CCLD     examples/multifh
  CC       examples/oabextract.o
  CCLD     examples/oabextract
  CC       test/cabd_md5.o
  CC       test/md5.o
  CCLD     test/cabd_md5
  CC       test/chmd_find.o
  CCLD     test/chmd_find
  CC       test/chmd_md5.o
  CCLD     test/chmd_md5
  CC       test/chmd_order.o
  CCLD     test/chmd_order
  CC       test/chminfo.o
  CCLD     test/chminfo
make[1]: Leaving directory '/home/kyz/devel/libmspack/libmspack'

from libmspack.

okias avatar okias commented on May 24, 2024

my guess it'll be combination of

/usr/bin/nm: mspack/.libs/lzxc.o: no symbols
/usr/bin/nm: mspack/.libs/mszipc.o: no symbols

caused most likely because it strips unneeded symboles (they have forced stay non-LTOed) and GNU gold linker ld.gold

from libmspack.

kyz avatar kyz commented on May 24, 2024

I'm not sure who's debugging who, but my example above is an example of a working build with -flto. The warnings you reference appear because my example LDFLAGS includes -Wl, they're correct because neither lzxc.c nor mszipc.c define any symbols (there is nothing to strip), and they're irrelevant as these warnings don't break the build.

Your problem is in the libtool script generated in your build environment by the configure script. libmspack simply invokes LT_INIT and the rest is handled by the autoconf and libtool installed on your system.

The libtool script in your build environment has a line like this:

# The commands to list exported symbols.
export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"

Note the blank space seen in your output aligns with global_symbol_pipe. Your libtool script will also have a line like this:

# Take the output of nm and produce a listing of raw symbols and C names.
global_symbol_pipe=""

... which is a problem, because it should look like this (as it does in Ubuntu with gcc and GNU nm):

# Take the output of nm and produce a listing of raw symbols and C names.
global_symbol_pipe="sed -n -e 's/^.*[    ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[       ][      ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p' | sed '/      __gnu_lto/d'"

This value is set by code in libtool.m4. You'll find lines like this in libtool.m4:

# Check for command to grab the raw symbol name followed by C symbol from nm.
AC_MSG_CHECKING([command to parse $NM output from $compiler object])
AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe],
[

Ultimately, you get your error because libtool cannot be configured correctly on your environment.

I'd like to help you debug this, but I need to know:

  1. What distro/version are you using to build?
  2. What are the commands and environment variables being used to build?
  3. What is the output of configure and config.log?

from libmspack.

thesamesam avatar thesamesam commented on May 24, 2024

@okias, I think this is a Gentoo bug: try a newer binutils?

from libmspack.

okias avatar okias commented on May 24, 2024

Well it does look like it, I'm going to re-test and I'll report. Sorry for late answer.

from libmspack.

okias avatar okias commented on May 24, 2024

Sorry for noise, most of LTO issues are caused by some minor issue with package buildsystem, so I too quickly suspected package itself instead of looking into my configuration. It was really binutils issue, which got recently fixed.

from libmspack.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.