How to compile libusb as shared library? - gcc

I am trying to build libusb as shared library as follows.
Following are two steps. 1. Configure 2. Make.
I pass "--enable-shared" to configure script assuming it will generate the shared .so file
Configure
./configure CC=/mnt/store/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/bin/arm-linux-gnueabihf-gcc --host=arm-linux --enable-udev=no --enable-shared
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for arm-linux-strip... no
checking for strip... strip
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 to enable maintainer-specific portions of Makefiles... no
checking whether make supports nested variables... (cached) yes
checking for arm-linux-gcc... /mnt/store/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/bin/arm-linux-gnueabihf-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... yes
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether /mnt/store/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/bin/arm-linux-gnueabihf-gcc accepts -g... yes
checking for /mnt/store/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/bin/arm-linux-gnueabihf-gcc option to accept ISO C89... none needed
checking whether /mnt/store/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/bin/arm-linux-gnueabihf-gcc understands -c and -o together... yes
checking for style of include used by make... GNU
checking dependency style of /mnt/store/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/bin/arm-linux-gnueabihf-gcc... gcc3
checking build system type... x86_64-unknown-linux-gnu
checking host system type... arm-unknown-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 /mnt/store/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/bin/arm-linux-gnueabihf-gcc... /mnt/store/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/bin/ld
checking if the linker (/mnt/store/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... no
checking for arm-linux-dumpbin... no
checking for arm-linux-link... no
checking for dumpbin... no
checking for link... link -dump
configure: WARNING: using cross tools not prefixed with host triplet
checking the name lister (nm) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert x86_64-unknown-linux-gnu file names to arm-unknown-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /mnt/store/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/bin/ld option to reload object files... -r
checking for arm-linux-objdump... no
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for arm-linux-dlltool... no
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for arm-linux-ar... no
checking for ar... ar
checking for archiver #FILE support... #
checking for arm-linux-strip... strip
checking for arm-linux-ranlib... no
checking for ranlib... ranlib
checking command to parse nm output from /mnt/store/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/bin/arm-linux-gnueabihf-gcc object... ok
checking for sysroot... no
checking for arm-linux-mt... no
checking for mt... mt
checking if mt is a manifest tool... no
checking how to run the C preprocessor... /mnt/store/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/bin/arm-linux-gnueabihf-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 /mnt/store/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/bin/arm-linux-gnueabihf-gcc supports -fno-rtti -fno-exceptions... no
checking for /mnt/store/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/bin/arm-linux-gnueabihf-gcc option to produce PIC... -fPIC -DPIC
checking if /mnt/store/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/bin/arm-linux-gnueabihf-gcc PIC flag -fPIC -DPIC works... yes
checking if /mnt/store/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/bin/arm-linux-gnueabihf-gcc static flag -static works... yes
checking if /mnt/store/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/bin/arm-linux-gnueabihf-gcc supports -c -o file.o... yes
checking if /mnt/store/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/bin/arm-linux-gnueabihf-gcc supports -c -o file.o... (cached) yes
checking whether the /mnt/store/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/bin/arm-linux-gnueabihf-gcc linker (/mnt/store/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/arm-linux-gnueabihf/bin/ld) 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 arm-linux-windres... no
checking for windres... no
checking for inline... inline
checking operating system... Linux
checking for library containing clock_gettime... none required
checking asm/types.h usability... yes
checking asm/types.h presence... yes
checking for asm/types.h... yes
checking sys/socket.h usability... yes
checking sys/socket.h presence... yes
checking for sys/socket.h... yes
checking for linux/netlink.h... yes
checking for linux/filter.h... yes
checking poll.h usability... yes
checking poll.h presence... yes
checking for poll.h... yes
checking sys/timerfd.h usability... yes
checking sys/timerfd.h presence... yes
checking for sys/timerfd.h... yes
checking whether TFD_NONBLOCK is declared... yes
checking whether to use timerfd for timing... yes
checking for struct timespec... yes
checking syslog.h usability... yes
checking syslog.h presence... yes
checking for syslog.h... yes
checking for syslog... yes
checking for sigaction... yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for gettimeofday... yes
checking signal.h usability... yes
checking signal.h presence... yes
checking for signal.h... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating libusb-1.0.pc
config.status: creating Makefile
config.status: creating libusb/Makefile
config.status: creating examples/Makefile
config.status: creating tests/Makefile
config.status: creating doc/Makefile
config.status: creating doc/doxygen.cfg
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
config.status: executing libtool commands
Make
make CC=/mnt/store/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/bin/arm-linux-gnueabihf-gcc
make all-recursive
make[1]: Entering directory `/mnt/store/build-without-sdk/libusb-1.0.19'
Making all in libusb
make[2]: Entering directory `/mnt/store/build-without-sdk/libusb-1.0.19/libusb'
CC libusb_1_0_la-core.lo
CC libusb_1_0_la-descriptor.lo
CC libusb_1_0_la-io.lo
CC libusb_1_0_la-strerror.lo
CC libusb_1_0_la-sync.lo
CC libusb_1_0_la-hotplug.lo
CC os/libusb_1_0_la-threads_posix.lo
CC os/libusb_1_0_la-linux_usbfs.lo
CC os/libusb_1_0_la-poll_posix.lo
CC os/libusb_1_0_la-linux_netlink.lo
CCLD libusb-1.0.la
make[2]: Leaving directory `/mnt/store/build-without- sdk/libusb-1.0.19/libusb'
Making all in doc
make[2]: Entering directory `/mnt/store/build-without-sdk/libusb-1.0.19/doc'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/mnt/store/build-without-sdk/libusb-1.0.19/doc'
make[2]: Entering directory `/mnt/store/build-without-sdk/libusb-1.0.19'
make[2]: Leaving directory `/mnt/storebuild-without-sdk/libusb-1.0.19'
make[1]: Leaving directory `/mnt/store/build-without-sdk/libusb-1.0.19'
But I cant find libusb-1.0.so

The .so file is built in libusb/.libs/
Its not very obvious by looking at the build logs though.

Related

Check if a library is successfully installed through make install

I tried to install a library (RNNoise) on Cygwin with ./autogen.s - ./configure - make - make install.
Below is the result I got:
User#LAPTOP-R9ABJF4O /cygdrive/c/Windows/System32/rnnoise
$ ./autogen.sh
Updating build configuration files for rnnoise, please wait....
libtoolize: putting auxiliary files in '.'.
libtoolize: linking file './ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: linking file 'm4/libtool.m4'
libtoolize: linking file 'm4/ltoptions.m4'
libtoolize: linking file 'm4/ltsugar.m4'
libtoolize: linking file 'm4/ltversion.m4'
libtoolize: linking file 'm4/lt~obsolete.m4'
configure.ac:19: installing './compile'
configure.ac:22: installing './missing'
Makefile.am: installing './depcomp'
User#LAPTOP-R9ABJF4O /cygdrive/c/Windows/System32/rnnoise
$ ./configure
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.exe
checking for suffix of executables... .exe
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 how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -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 minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... 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 a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports the include directive... yes (GNU style)
checking whether make supports nested variables... yes
checking dependency style of gcc... gcc3
checking whether to enable maintainer-specific portions of Makefiles... yes
checking for inline... inline
checking build system type... x86_64-pc-cygwin
checking host system type... x86_64-pc-cygwin
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/bin/sed
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... /usr/x86_64-pc-cygwin/bin/ld.exe
checking if the linker (/usr/x86_64-pc-cygwin/bin/ld.exe) 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... 8192
checking how to convert x86_64-pc-cygwin file names to x86_64-pc-cygwin format... func_convert_file_noop
checking how to convert x86_64-pc-cygwin file names to toolchain format... func_convert_file_noop
checking for /usr/x86_64-pc-cygwin/bin/ld.exe option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... file_magic ^x86 archive import|^x86 DLL
checking for dlltool... dlltool
checking how to associate runtime and link libraries... func_cygming_dll_for_implib
checking for ar... ar
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... /usr/bin/dd
checking how to truncate binary pipes... /usr/bin/dd bs=4096 count=1
checking for mt... no
checking if : is a manifest tool... no
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... -DDLL_EXPORT -DPIC
checking if gcc PIC flag -DDLL_EXPORT -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/x86_64-pc-cygwin/bin/ld.exe) supports shared libraries... yes
checking whether -lc should be explicitly linked in... yes
checking dynamic linker characteristics... Win32 ld.exe
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 whether make supports nested variables... (cached) yes
checking if gcc supports -pedantic flag... yes
checking if gcc supports -Wall flag... yes
checking if gcc supports -Wextra flag... yes
checking if gcc supports -Wno-sign-compare flag... yes
checking if gcc supports -Wno-parentheses flag... yes
checking if gcc supports -Wno-long-long flag... yes
checking for gcc way to treat warnings as errors... -Werror
checking if gcc supports __attribute__(( visibility("default") ))... yes
checking if gcc supports -fvisibility=hidden... yes
checking for doxygen... no
checking for dot... no
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating rnnoise.pc
config.status: creating rnnoise-uninstalled.pc
config.status: creating doc/Doxyfile
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
config.status: executing libtool commands
configure:
------------------------------------------------------------------------
rnnoise unknown: Automatic configuration OK.
Assertions ................... no
Hidden visibility ............ yes
API code examples ............ yes
API documentation ............ yes
------------------------------------------------------------------------
User#LAPTOP-R9ABJF4O /cygdrive/c/Windows/System32/rnnoise
$ make
make all-am
make[1]: Entering directory '/cygdrive/c/Windows/System32/rnnoise'
make[1]: Leaving directory '/cygdrive/c/Windows/System32/rnnoise'
User#LAPTOP-R9ABJF4O /cygdrive/c/Windows/System32/rnnoise
$ make install
make[1]: Entering directory '/cygdrive/c/Windows/System32/rnnoise'
/usr/bin/mkdir -p '/usr/local/lib'
/bin/sh ./libtool --mode=install /usr/bin/install -c librnnoise.la '/usr/local/lib'
libtool: install: /usr/bin/install -c .libs/librnnoise.dll.a /usr/local/lib/librnnoise.dll.a
libtool: install: base_file=`basename librnnoise.la`
libtool: install: dlpath=`/bin/sh 2>&1 -c '. .libs/'librnnoise.la'i; echo cygrnnoise-0.dll'`
libtool: install: dldir=/usr/local/lib/`dirname ../bin/cygrnnoise-0.dll`
libtool: install: test -d /usr/local/lib/../bin || mkdir -p /usr/local/lib/../bin
libtool: install: /usr/bin/install -c .libs/cygrnnoise-0.dll /usr/local/lib/../bin/cygrnnoise-0.dll
libtool: install: chmod a+x /usr/local/lib/../bin/cygrnnoise-0.dll
libtool: install: if test -n '' && test -n 'strip --strip-unneeded'; then eval 'strip --strip-unneeded /usr/local/lib/../bin/cygrnnoise-0.dll' || exit 0; fi
libtool: install: /usr/bin/install -c .libs/librnnoise.lai /usr/local/lib/librnnoise.la
libtool: install: /usr/bin/install -c .libs/librnnoise.a /usr/local/lib/librnnoise.a
libtool: install: chmod 644 /usr/local/lib/librnnoise.a
libtool: install: ranlib /usr/local/lib/librnnoise.a
/usr/bin/mkdir -p '/usr/local/share/doc/rnnoise'
/usr/bin/install -c -m 644 COPYING AUTHORS README '/usr/local/share/doc/rnnoise'
/usr/bin/mkdir -p '/usr/local/include'
/usr/bin/install -c -m 644 include/rnnoise.h '/usr/local/include'
/usr/bin/mkdir -p '/usr/local/lib/pkgconfig'
/usr/bin/install -c -m 644 rnnoise.pc '/usr/local/lib/pkgconfig'
make[1]: Leaving directory '/cygdrive/c/Windows/System32/rnnoise'
It seems that everything works well. However, I couldn't find the library (rnnoise). I searched through pip list and imp.find_module('rnnoise').
Is the library installed successfully? How do I know the name or path of the library?

Checking of dependencies is done twice when AC_CONFIG_MACRO_DIR is included in configure.ac

I have a configure.ac file for my project:
#AC_CONFIG_MACRO_DIR([m4])
AC_INIT(Makefile.am)
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(myproject, 11.3.8)
AC_CHECK_LIB(pthread, pthread_create, ,AC_MSG_ERROR(pthread_create not functioning))
AC_CHECK_LIB(nsl, main)
AC_CHECK_LIB(rt, main)
AC_CHECK_LIB(socket, socket)
AC_CHECK_LIB(m, matherr)
AC_PROG_CC
AC_PROG_CXX
AC_PROG_INSTALL
AC_PROG_RANLIB
AM_PROG_LIBTOOL
#AX_BOOST_BASE([1.48], [have_boost=yes], )
#AX_BOOST_UNIT_TEST_FRAMEWORK
AM_CONDITIONAL([HAVE_BOOST], test "$have_boost" = yes)
PKG_CHECK_MODULES(LIBCCEXT2, libccext2 >= 1.7.3)
PKG_CHECK_MODULES(LIBCCGNU2, libccgnu2 >= 1.7.3)
dnl AC_OUTPUT(Makefile src/Makefile, echo timestamp > stamp-h)
dnl Use -Wall if we have gcc.
changequote(,)dnl
if test "x$GCC" = "xyes"; then
case " $CFLAGS " in
*[\ \ ]-Wall[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -Wall" ;;
esac
fi
changequote([,])dnl
AC_CONFIG_FILES([ myproject.pc ])
AC_OUTPUT([
Makefile
include/Makefile
someapp2/Makefile
someapp8/Makefile
log/Makefile
someapp6/Makefile
someapp5/Makefile
extra/Makefile
app/Makefile
someapp4/Makefile
someapp7/Makefile
lib/Makefile
someapp1/Makefile
someapp9/Makefile
someapp3/Makefile
test/Makefile
])
When I run aclocal; autoheader; libtoolize -f -c; automake -a -c; automake; autoconf; ./configure --enable-somefeature --enable-myproject; make -j4, I get this output:
acinclude.m4:10: warning: underquoted definition of AM_PATH_MYSQLCLIENT
acinclude.m4:10: run info Automake 'Extending aclocal'
acinclude.m4:10: or see someapp4://www.gnu.org/software/automake/manual/automake.html#Extending-aclocal
libtoolize: putting auxiliary files in `.'.
libtoolize: copying file `./ltmain.sh'
libtoolize: Consider adding `AC_CONFIG_MACRO_DIR([m4])' to configure.ac and
libtoolize: rerunning libtoolize, to keep the correct libtool macros in-tree.
libtoolize: Consider adding `-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
libtoolize: `AC_PROG_RANLIB' is rendered obsolete by `LT_INIT'
configure.ac:6: warning: AM_INIT_AUTOMAKE: two- and three-arguments forms are deprecated. For more info, see:
configure.ac:6: someapp4://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_005fINIT_005fAUTOMAKE-invocation
app/Makefile.am:13: warning: compiling 'smsio.c' with per-target flags requires 'AM_PROG_CC_C_O' in 'configure.ac'
configure.ac:6: warning: AM_INIT_AUTOMAKE: two- and three-arguments forms are deprecated. For more info, see:
configure.ac:6: someapp4://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_005fINIT_005fAUTOMAKE-invocation
app/Makefile.am:13: warning: compiling 'smsio.c' with per-target flags requires 'AM_PROG_CC_C_O' in 'configure.ac'
configure: WARNING: unrecognized options: --enable-somefeature, --enable-myprojecttest
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for style of include used by make... GNU
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 dependency style of gcc... gcc3
checking for pthread_create in -lpthread... yes
checking for main in -lnsl... yes
checking for main in -lrt... yes
checking for socket in -lsocket... no
checking for matherr in -lm... yes
checking for gcc... (someapp9d) gcc
checking whether we are using the GNU C compiler... (someapp9d) yes
checking whether gcc accepts -g... (someapp9d) yes
checking for gcc option to accept ISO C89... (someapp9d) none needed
checking dependency style of gcc... (someapp9d) gcc3
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
...
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... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (someapp9d) 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 how to run the C++ preprocessor... g++ -E
checking for ld used by g++... /usr/bin/ld -m elf_x86_64
checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC -DPIC
checking if g++ PIC flag -fPIC -DPIC works... yes
checking if g++ static flag -static works... no
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (someapp9d) yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking dynamic linker characteristics... (someapp9d) GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for LIBCCEXT2... yes
checking for LIBCCGNU2... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating myproject.pc
config.status: creating Makefile
config.status: creating include/Makefile
config.status: creating someapp2/Makefile
config.status: creating someapp8/Makefile
config.status: creating log/Makefile
config.status: creating someapp6/Makefile
config.status: creating someapp5/Makefile
config.status: creating extra/Makefile
config.status: creating app/Makefile
config.status: creating someapp4/Makefile
config.status: creating someapp7/Makefile
config.status: creating lib/Makefile
config.status: creating someapp1/Makefile
config.status: creating someapp9/Makefile
config.status: creating someapp3/Makefile
config.status: creating test/Makefile
config.status: creating config.h
config.status: executing depfiles someapp8ands
config.status: executing libtool someapp8ands
configure: WARNING: unrecognized options: --enable-somefeature, --enable-myprojecttest
make all-recursive
make[1]: Entering directory `/home/someengineer/github/myproject'
...
make[2]: Leaving directory `/home/someengineer/github/myproject/test'
make[2]: Entering directory `/home/someengineer/github/myproject'
make[2]: Leaving directory `/home/someengineer/github/myproject'
make[1]: Leaving directory `/home/someengineer/github/myproject'
If I uncomment the commented lines in the configure.ac file, and move my acinclude.m4 to a directory named m4, the output becomes like this:
m4/acinclude.m4:10: warning: underquoted definition of AM_PATH_MYSQLCLIENT
m4/acinclude.m4:10: run info Automake 'Extending aclocal'
m4/acinclude.m4:10: or see someapp4://www.gnu.org/software/automake/manual/automake.html#Extending-aclocal
libtoolize: putting auxiliary files in `.'.
libtoolize: copying file `./ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `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'
libtoolize: Consider adding `-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
libtoolize: `AC_PROG_RANLIB' is rendered obsolete by `LT_INIT'
configure.ac:6: warning: AM_INIT_AUTOMAKE: two- and three-arguments forms are deprecated. For more info, see:
configure.ac:6: someapp4://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_005fINIT_005fAUTOMAKE-invocation
app/Makefile.am:13: warning: compiling 'smsio.c' with per-target flags requires 'AM_PROG_CC_C_O' in 'configure.ac'
configure.ac:6: warning: AM_INIT_AUTOMAKE: two- and three-arguments forms are deprecated. For more info, see:
configure.ac:6: someapp4://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_005fINIT_005fAUTOMAKE-invocation
app/Makefile.am:13: warning: compiling 'smsio.c' with per-target flags requires 'AM_PROG_CC_C_O' in 'configure.ac'
configure: WARNING: unrecognized options: --enable-somefeature, --enable-myprojecttest
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for style of include used by make... GNU
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 dependency style of gcc... gcc3
checking for pthread_create in -lpthread... yes
checking for main in -lnsl... yes
checking for main in -lrt... yes
checking for socket in -lsocket... no
checking for matherr in -lm... yes
checking for gcc... (someapp9d) gcc
checking whether we are using the GNU C compiler... (someapp9d) yes
checking whether gcc accepts -g... (someapp9d) yes
checking for gcc option to accept ISO C89... (someapp9d) none needed
checking dependency style of gcc... (someapp9d) gcc3
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
...
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... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (someapp9d) 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 how to run the C++ preprocessor... g++ -E
checking for ld used by g++... /usr/bin/ld -m elf_x86_64
checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC -DPIC
checking if g++ PIC flag -fPIC -DPIC works... yes
checking if g++ static flag -static works... no
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (someapp9d) yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking dynamic linker characteristics... (someapp9d) GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking for boostlib >= 1.48 (104800)... yes
checking whether the Boost::Unit_Test_Framework library is available... yes
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for LIBCCEXT2... yes
checking for LIBCCGNU2... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating myproject.pc
config.status: creating Makefile
config.status: creating include/Makefile
config.status: creating someapp2/Makefile
config.status: creating someapp8/Makefile
config.status: creating log/Makefile
config.status: creating someapp6/Makefile
config.status: creating someapp5/Makefile
config.status: creating extra/Makefile
config.status: creating app/Makefile
config.status: creating someapp4/Makefile
config.status: creating someapp7/Makefile
config.status: creating lib/Makefile
config.status: creating someapp1/Makefile
config.status: creating someapp9/Makefile
config.status: creating someapp3/Makefile
config.status: creating test/Makefile
config.status: creating config.h
config.status: executing depfiles someapp8ands
config.status: executing libtool someapp8ands
configure: WARNING: unrecognized options: --enable-somefeature, --enable-myprojecttest
CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/sh /home/someengineer/github/myproject/missing aclocal-1.13
m4/acinclude.m4:10: warning: underquoted definition of AM_PATH_MYSQLCLIENT
m4/acinclude.m4:10: run info Automake 'Extending aclocal'
m4/acinclude.m4:10: or see someapp4://www.gnu.org/software/automake/manual/automake.html#Extending-aclocal
CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/sh /home/someengineer/github/myproject/missing autoconf
cd . && /bin/sh /home/someengineer/github/myproject/missing automake-1.13 --gnu
/bin/sh ./config.status --recheck
configure.ac:6: warning: AM_INIT_AUTOMAKE: two- and three-arguments forms are deprecated. For more info, see:
configure.ac:6: someapp4://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_005fINIT_005fAUTOMAKE-invocation
running CONFIG_SHELL=/bin/sh /bin/sh ./configure --enable-somefeature --enable-myprojecttest PKG_CONFIG_PATH=/usr/local/lib/pkgconfig --no-create --no-recursion
app/Makefile.am:13: warning: compiling 'smsio.c' with per-target flags requires 'AM_PROG_CC_C_O' in 'configure.ac'
configure: WARNING: unrecognized options: --enable-somefeature, --enable-myprojecttest
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for style of include used by make... GNU
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 dependency style of gcc... gcc3
checking for pthread_create in -lpthread... yes
checking for main in -lnsl... yes
checking for main in -lrt... yes
checking for socket in -lsocket... no
checking for matherr in -lm... yes
checking for gcc... (someapp9d) gcc
checking whether we are using the GNU C compiler... (someapp9d) yes
checking whether gcc accepts -g... (someapp9d) yes
checking for gcc option to accept ISO C89... (someapp9d) none needed
checking dependency style of gcc... (someapp9d) gcc3
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
...
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... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (someapp9d) 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 how to run the C++ preprocessor... g++ -E
checking for ld used by g++... /usr/bin/ld -m elf_x86_64
checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC -DPIC
checking if g++ PIC flag -fPIC -DPIC works... yes
checking if g++ static flag -static works... no
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (someapp9d) yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking dynamic linker characteristics... (someapp9d) GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking for boostlib >= 1.48 (104800)... yes
checking whether the Boost::Unit_Test_Framework library is available... yes
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for LIBCCEXT2... yes
checking for LIBCCGNU2... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
configure: WARNING: unrecognized options: --enable-somefeature, --enable-myprojecttest
/bin/sh ./config.status
config.status: creating myproject.pc
config.status: creating Makefile
config.status: creating include/Makefile
config.status: creating someapp2/Makefile
config.status: creating someapp8/Makefile
config.status: creating log/Makefile
config.status: creating someapp6/Makefile
config.status: creating someapp5/Makefile
config.status: creating extra/Makefile
config.status: creating app/Makefile
config.status: creating someapp4/Makefile
config.status: creating someapp7/Makefile
config.status: creating lib/Makefile
config.status: creating someapp1/Makefile
config.status: creating someapp9/Makefile
config.status: creating someapp3/Makefile
config.status: creating test/Makefile
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles someapp8ands
config.status: executing libtool someapp8ands
(CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/sh /home/someengineer/github/myproject/missing autoheader)
rm -f stamp-h1
touch config.h.in
cd . && /bin/sh ./config.status config.h
config.status: creating config.h
config.status: config.h is unchanged
make all-recursive
make[1]: Entering directory `/home/someengineer/github/myproject'
...
make[2]: Leaving directory `/home/someengineer/github/myproject/test'
make[2]: Entering directory `/home/someengineer/github/myproject'
make[2]: Leaving directory `/home/someengineer/github/myproject'
make[1]: Leaving directory `/home/someengineer/github/myproject'
The checking of dependencies seems to be done twice when AC_CONFIG_MACRO_DIR([m4]) is included in configure.ac. My m4 directory also contains m4_ax_boost_base.m4 and m4_ax_boost_unit_test_framework.m4 from the autoconf archive.
My acinclude.m4 in the m4 directory is as follows:
dnl Test for libmysqlclient and
dnl define MYSQLCLIENT_CFLAGS, MYSQLCLIENT_LDFLAGS and MYSQLCLIENT_LIBS
dnl usage:
dnl AM_PATH_MYSQLCLIENT(
dnl [MINIMUM-VERSION,
dnl [ACTION-IF-FOUND [,
dnl ACTION-IF-NOT-FOUND ]]])
dnl
AC_DEFUN(AM_PATH_MYSQLCLIENT,
[
AC_ARG_WITH(mysqlclient-prefix,
[ --with-mysqlclient-prefix=PFX Prefix where mysqlclient is
installed],
mysqlclient_prefix="$withval",
mysqlclient_prefix="")
AC_ARG_WITH(mysqlclient-include, [ --with-mysqlclient-include=DIR Directory pointing
to mysqlclient include files],
mysqlclient_include="$withval",
mysqlclient_include="")
AC_ARG_WITH(mysqlclient-lib,
[ --with-mysqlclient-lib=LIB Directory pointing to mysqlclient library
(Note: -include and -lib do override
paths found with -prefix)
],
mysqlclient_lib="$withval",
mysqlclient_lib="")
AC_MSG_CHECKING([for mysqlclient ifelse([$1], , ,[>= v$1])])
MYSQLCLIENT_LDFLAGS=""
MYSQLCLIENT_CFLAGS=""
MYSQLCLIENT_LIBS="-lmysqlclient"
mysqlclient_fail=""
dnl test --with-mysqlclient-prefix
for tryprefix in /usr /usr/local /usr/mysql /usr/local/mysql /usr/pkg $msqlclient_prefix; do
#testloop
for hloc in lib/mysql lib ; do
if test -f "$tryprefix/$hloc/libmysqlclient.so"; then
MYSQLCLIENT_LDFLAGS="-L$tryprefix/$hloc"
fi
done
for iloc in include/mysql include; do
if test -f "$tryprefix/$iloc/mysql.h"; then
MYSQLCLIENT_CFLAGS="-I$tryprefix/$iloc"
fi
done
# testloop
done
dnl test --with-mysqlclient-include
if test "x$mysqlclient_include" != "x" ; then
echo "checking for mysql includes... "
if test -d "$mysqlclient_include/mysql" ; then
MYSQLCLIENT_CFLAGS="-I$mysqlclient_include"
echo " found $MYSQLCLIENT_CFLAGS"
elif test -d "$mysqlclient_include/include/mysql" ; then
MYSQLCLIENT_CFLAGS="-I$mysqlclient_include/include"
echo " found $MYSQLCLIENT_CFLAGS"
elif test -d "$mysqlclient_include" ; then
MYSQLCLIENT_CFLAGS="-I$mysqlclient_include"
echo "found $MYSQLCLIENT_CFLAGS"
else
echo "not found! no include dir found in $mysqlclient_include"
fi
fi
dnl test --with-mysqlclient-lib
if test "x$mysqlclient_lib" != "x" ; then
echo "checking for mysql libx... "
if test -d "$mysqlclient_lib/lib/mysql" ; then
MYSQLCLIENT_LDFLAGS="-L$mysqlclient_lib/lib/mysql"
echo "found $MYSQLCLIENT_LDFLAGS"
elif test -d "$mysqlclient_lib/lin" ; then
MYSQLCLIENT_LDFLAGS="-L$mysqlclient_lib/lib"
echo "found $MYSQLCLIENT_LDFLAGS"
else
MYSQLCLIENT_LDFLAGS="-L$mysqlclient_lib"
echo "defaultd to $MYSQLCLIENT_LDFLAGS"
fi
fi
ac_save_CFLAGS="$CFLAGS"
ac_save_LDFLAGS="$LDFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="-v $CFLAGS $MYSQLCLIENT_CFLAGS"
LDFLAGS="$LDFLAGS $MYSQLCLIENT_LDFLAGS"
LIBS="$LIBS $MYSQLCLIENT_LIBS"
dnl if no minimum version is given, just try to compile
dnl else try to compile AND run
AC_TRY_COMPILE([
#include <mysql.h>
#include <mysql_version.h>
],[
mysql_connect( 0, 0, 0, 0);
], [AC_MSG_RESULT(yes $MYSQLCLIENT_CFLAGS $MYSQLCLIENT_LDFLAGS)
CFLAGS="$ac_save_CFLAGS"
LDFLAGS="$ac_save_LDFLAGS"
LIBS="$ac_save_LIBS"
ifelse([$2], ,:,[$2])
],[
echo "no"
echo "can't compile a simple app with mysql_connnect in it. bad."
mysqlclient_fail="yes"
])
if test "x$mysqlclient_fail" != "x" ; then
dnl AC_MSG_RESULT(no)
echo
echo "***"
echo "*** mysqlclient test source had problems, check your config.log ."
echo "*** Also try one of the following switches :"
echo "*** --with-mysqlclient-prefix=PFX"
echo "*** --with-mysqlclient-include=DIR"
echo "*** --with-mysqlclient-lib=DIR"
echo "***"
CFLAGS="$ac_save_CFLAGS"
LDFLAGS="$ac_save_LDFLAGS"
LIBS="$ac_save_LIBS"
ifelse([$3], ,:,[$3])
fi
CFLAGS="$ac_save_CFLAGS"
LDFLAGS="$ac_save_LDFLAGS"
LIBS="$ac_save_LIBS"
AC_SUBST(MYSQLCLIENT_LDFLAGS)
AC_SUBST(MYSQLCLIENT_CFLAGS)
AC_SUBST(MYSQLCLIENT_LIBS)
])
How do I fix my configure.ac so that checking of dependencies is done only once?
The second invocation of configure has been made when doing make -j4 in Makefile by the following rule
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
It could be a case that the configure is change leading to the make trigger recheck. You need to check content of configure script before/after you issue the ./configure command
In the other hand, there should something defined in CONFIG_STATUS_DEPENDENCIES

Automake/libtool doesn't build shared library

Please consider the following project.
configure.ac:
AC_PREREQ([2.69])
AC_INIT([dummy-project], [0.0.1])
AM_INIT_AUTOMAKE([foreign])
LT_INIT([disable-static])
AC_PROG_CXX
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
Makefile.am:
noinst_LTLIBRARIES=something.la
something_la_SOURCES=source.cpp
something_la_LDFLAGS=-module
source.cpp is just an empty file.
When I run:
/tmp/scratch$ autoreconf -i
libtoolize: Consider adding 'AC_CONFIG_MACRO_DIRS([m4])' to configure.ac,
libtoolize: and rerunning libtoolize and aclocal.
libtoolize: Consider adding '-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
/tmp/scratch$ ./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 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 style of include used by make... GNU
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 dependency style of gcc... gcc3
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 ar... ar
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... no
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking how to run the C++ preprocessor... g++ -E
checking for ld used by g++... /usr/bin/ld -m elf_x86_64
checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC -DPIC
checking if g++ PIC flag -fPIC -DPIC works... yes
checking if g++ static flag -static works... yes
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (cached) yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking dynamic linker characteristics... (cached) GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: executing depfiles commands
config.status: executing libtool commands
/tmp/scratch$ make
/bin/bash ./libtool --tag=CXX --mode=compile g++ -DPACKAGE_NAME=\"dummy-camera\" -DPACKAGE_TARNAME=\"dummy-camera\" -DPACKAGE_VERSION=\"0.0.1\" -DPACKAGE_STRING=\"dummy-camera\ 0.0.1\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"dummy-camera\" -DVERSION=\"0.0.1\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -I. -g -O2 -MT source.lo -MD -MP -MF .deps/source.Tpo -c -o source.lo source.cpp
libtool: compile: g++ -DPACKAGE_NAME=\"dummy-camera\" -DPACKAGE_TARNAME=\"dummy-camera\" -DPACKAGE_VERSION=\"0.0.1\" "-DPACKAGE_STRING=\"dummy-camera 0.0.1\"" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"dummy-camera\" -DVERSION=\"0.0.1\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -I. -g -O2 -MT source.lo -MD -MP -MF .deps/source.Tpo -c source.cpp -fPIC -DPIC -o .libs/source.o
mv -f .deps/source.Tpo .deps/source.Plo
/bin/bash ./libtool --tag=CXX --mode=link g++ -g -O2 -module -o something.la source.lo
libtool: link: ar cru .libs/something.a .libs/source.o
ar: `u' modifier ignored since `D' is the default (see `U')
libtool: link: ranlib .libs/something.a
libtool: link: ( cd ".libs" && rm -f "something.la" && ln -s "../something.la" "something.la" )
For some reason, it creates .libs/something.a (pic compiled for static linking to another so), but not something.so like I need it to.
I'm doing something wrong here, but I don't know what.
There are two parts to the answer. One is on the automake level, and the other is on the libtool level.
On the automake level, the moment a library is defined under the noinst_LTLIBRARIES rule, it is assumed to be a "convenience" library. Such a library is used internally by your build system, not intended to be installed at runtime.
On the libtool level, since a convenience library will not be installed, there is no need to build a shared object version of it. The build for shared object libtool does is to compile a .o file (static linked) with -fpic so that it can be statically linked into another shared object.
The mechanism by which libtool knows this is a convenience library is by seeing whether an rpath was provided. If no rpath was provided, the output is assumed to be a convenience library, and no shared object is generated.

"configure" script of Autotools always consume all my 4GB RAM immediately and hang my computer

Whenever I run the configure script of GNU-Autotools by running the ./configure command. It consume all my RAM(4GB) very fast immediately during 5 second then hang my computer. I use Linux system and I test this problem with different GNU source packages and the result is same. You can see an example of running configure below:
I break the process by CTRL+C when the process reach to "checking for BSD- or MS-compatible name lister (nm)...".
My config.log: http://ashavahishta.persiangig.com/document/Text/config.log
$ ./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 UID '1000' is supported by ustar format... yes
checking whether GID '1000' is supported by ustar format... yes
checking how to create a ustar tar archive... gnutar
checking whether to enable maintainer-specific portions of Makefiles... 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 whether make sets $(MAKE)... (cached) 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 pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for gcc... gcc
checking whether we are using the GNU Objective C compiler... yes
checking whether gcc accepts -g... yes
checking dependency style of gcc... gcc3
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-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)...
After all checking, Here Memory Finished and I break the Process by CTRL+C to Rescue My Computer.
First I reinstalled the binutils to solve the problem with nm but nothing didn't changed then I removed binutils and it's dependencies and I install it again and now everything works perfect.
I didn't find what was happened about nm but I just found that was the problem during configure process.
I hope this answer help other people too.

Problem compiling freetype2 with MinGW/MSYS

There seems to be a problem compiling freetype2 with MinGW and MSYS
My attempts on a clean copy of the freetype source, and an unadulterated MinGW and MSYS give:
Andrew#MCARDLE-PC ~/documents/code
$ cd freetype-2.3.11
Andrew#MCARDLE-PC ~/documents/code/freetype-2.3.11
$ ./configure
FreeType build system -- automatic system detection
The following settings are used:
platform unix
compiler cc
configuration directory ./builds/unix
configuration rules ./builds/unix/unix.mk
If this does not correspond to your system or settings please remove the file
`config.mk' from this directory then read the INSTALL file for help.
Otherwise, simply type `c:/code/mingw/bin/make' again to build the library,
or `c:/code/mingw/bin/make refdoc' to build the API reference (the latter needs
python).
Generating modules list in ./objs/ftmodule.h...
* module: truetype (Windows/Mac font files with extension *.ttf or *.ttc)
* module: type1 (Postscript font files with extension *.pfa or *.pfb)
* module: cff (OpenType fonts with extension *.otf)
* module: cid (Postscript CID-keyed fonts, no known extension)
* module: pfr (PFR/TrueDoc font files with extension *.pfr)
* module: type42 (Type 42 font files with no known extension)
* module: winfnt (Windows bitmap fonts with extension *.fnt or *.fon)
* module: pcf (pcf bitmap fonts)
* module: bdf (bdf bitmap fonts)
* module: sfnt (helper module for TrueType & OpenType formats)
* module: autofit (automatic hinting module)
* module: pshinter (Postscript hinter module)
* module: raster (monochrome bitmap renderer)
* module: smooth (anti-aliased bitmap renderer)
* module: smooth (anti-aliased bitmap renderer for LCDs)
* module: smooth (anti-aliased bitmap renderer for vertical LCDs)
* module: psaux (Postscript Type 1 & Type 2 helper module)
* module: psnames (Postscript & Unicode Glyph name handling)
done.
cd builds/unix; ./configure
checking build system type... i686-pc-mingw32
checking host system type... i686-pc-mingw32
checking for gcc... gcc
checking for C compiler default output file name... a.exe
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... .exe
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 how to run the C preprocessor... gcc -E
checking for rm... rm -f
checking for rmdir... rmdir
checking for a BSD-compatible install... /bin/install -c
checking for grep that handles long lines and -e... /c/code/mingw/bin/grep
checking for egrep... /c/code/mingw/bin/grep -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 fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking for unistd.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking size of int... 4
checking size of long... 4
checking cpp computation of bit length in ftconfig.in works... yes
checking for stdlib.h... (cached) yes
checking for unistd.h... (cached) yes
checking for getpagesize... yes
checking for working mmap... no
checking for memcpy... yes
checking for memmove... yes
checking for gzsetparams in -lz... yes
checking zlib.h usability... yes
checking zlib.h presence... yes
checking for zlib.h... yes
checking whether CFLAGS includes -isysroot option... no
checking for a sed that does not truncate output... /c/code/mingw/bin/sed
checking for fgrep... /c/code/mingw/bin/grep -F
checking for ld used by gcc... /c/code/mingw/bin/ld
checking if the linker (/c/code/mingw/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /c/code/mingw/bin/nm
checking the name lister (/c/code/mingw/bin/nm) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 8192
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking for /c/code/mingw/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... file_magic ^x86 archive import|
^x86 DLL
checking for ar... ar
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /c/code/mingw/bin/nm output from gcc object... ok
checking for dlfcn.h... no
checking for as... as
checking for dlltool... dlltool
checking for objdump... (cached) objdump
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... c:\code\mingw\bin\sed.exe:
-e expression #2, char 1: unknown command: `C'
no
checking for gcc option to produce PIC... -DDLL_EXPORT -DPIC
checking if gcc PIC flag -DDLL_EXPORT -DPIC works... c:\code\mingw\bin\sed.exe:
-e expression #2, char 1: unknown command: `C'
yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... c:\code\mingw\bin\sed.exe: -e expressio
n #2, char 1: unknown command: `C'
yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/c/code/mingw/bin/ld) supports shared libraries
... yes
checking whether -lc should be explicitly linked in... yes
checking dynamic linker characteristics... Win32 ld.exe
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
c:\code\mingw\bin\sed.exe: -e expression #1, char 1: unknown command: `C'
configure: creating ./config.status
c:\code\mingw\bin\sed.exe: -e expression #1, char 1: unknown command: `C'
config.status: creating unix-cc.mk
c:\code\mingw\bin\sed.exe: -e expression #1, char 1: unknown command: `C'
config.status: creating unix-def.mk
config.status: creating freetype-config
c:\code\mingw\bin\sed.exe: -e expression #1, char 1: unknown command: `C'
config.status: creating freetype2.pc
c:\code\mingw\bin\sed.exe: -e expression #1, char 1: unknown command: `C'
config.status: creating ftconfig.h
config.status: executing libtool commands
c:\code\mingw\bin\sed.exe: -e expression #1, char 1: unknown command: `C'
c:\code\mingw\bin\sed.exe: -e expression #1, char 1: unknown command: `C'
mv: cannot stat `libtoolT': No such file or directory
cp: cannot stat `libtoolT': No such file or directory
chmod: cannot access `libtool': No such file or directory
c:\code\mingw\bin\sed.exe: -e expression #1, char 1: unknown command: `C'
make: Nothing to be done for `unix'.
Andrew#MCARDLE-PC ~/documents/code/freetype-2.3.11
$ make
./builds/unix/libtool --mode=compile gcc -pedantic -ansi -Ic:/Users/Andrew/docu
ments/code/freetype-2.3.11/objs -I./builds/unix -Ic:/Users/Andrew/documents/code
/freetype-2.3.11/include -c -Wall -g -O2 -DFT_CONFIG_OPTION_SYSTEM_ZLIB -DFT_CON
FIG_CONFIG_H="<ftconfig.h>" -DFT2_BUILD_LIBRARY -DFT_CONFIG_MODULES_H="<ftmodule
.h>" -o c:/Users/Andrew/documents/code/freetype-2.3.11/objs/ftsystem.lo c:/User
s/Andrew/documents/code/freetype-2.3.11/src/base/ftsystem.c
/bin/sh: ./builds/unix/libtool: No such file or directory
make: *** [c:/Users/Andrew/documents/code/freetype-2.3.11/objs/ftsystem.lo] Erro
r 127
Andrew#MCARDLE-PC ~/documents/code/freetype-2.3.11
$
To my mind the two problems appear to be sed not recognising 'C', and libtool not being found.
The solution is to delete C:\mingw\bin\sed.exe so the MSYS sed will get used instead.
In your msys Environment, path/to/msys/installation/bin is mounted to /bin and MinGW is usually mounted to /mingw.
The problem is due to sed.exe coming from either /mingw/bin (or GnuWin32's bin or Git's bin, etc... if you have those installed), and not from /bin, as /bin is being included after all these in your msys Environment path.
The solution is to start your msys environment with the argument MSYS so that /bin comes before /mingw/bin (and possibly the rest as mentioned above) in your msys Environment's PATH, and hence sed.exe from /bin be used.
From your command prompt, assuming your Windows path contains /path/to/msys/installation/, use
$> msys.bat MSYS
instead of
$> msys.bat
to launch msys.
To test if everything is in order, echo $PATH under msys to see the Environment's PATH is correct.

Resources