Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

configure script not enabling make to generate shared library

This is in regards to compiling libjpeg v6b if that is relevant.

I run ./configure --prefix=/c/tmp/jpeg-6b-build --enable-shared --enable-static like the install doc says but libtool isn't having it.

checking dynamic linker characteristics... no
checking if libtool supports shared libraries... no
checking whether to build shared libraries... no
checking whether to build static libraries... yes

I think I need this shared library to be able to compile some functions. libjpeg itself compiles fine and the .exe's it generates work but I need to use the source for something else. v6b doesn't generate a .DLL for some reason while v9 does.

Full output for ./configure command:

ild
checking for gcc... gcc
checking whether the C compiler (gcc  ) works... yes
checking whether the C compiler (gcc  ) is a cross-compiler... no
checking whether we are using GNU C... yes
checking how to run the C preprocessor... gcc -E
checking for function prototypes... yes
checking for stddef.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for size_t... yes
checking for type unsigned char... yes
checking for type unsigned short... yes
checking for type void... yes
checking for working const... yes
checking for inline... __inline__
checking for broken incomplete types... ok
checking for short external names... ok
checking to see if char is signed... yes
checking to see if right shift is signed... yes
checking to see if fopen accepts b spec... yes
checking for a BSD compatible install... /bin/install -c
checking for ranlib... ranlib
checking host system type... i386-pc-mingw32
checking for ranlib... ranlib
checking for gcc... gcc
checking whether we are using GNU C... yes
checking for gcc option to produce PIC... -fPIC
checking if gcc PIC flag -fPIC works... no
checking if gcc static flag -static works... -static
checking whether ln -s works... no
checking for ld used by GCC... ./c:/mingw/bin/../lib/gcc/mingw32/4.7.2/../../../
../mingw32/bin/ld.exe
checking if the linker (./c:/mingw/bin/../lib/gcc/mingw32/4.7.2/../../../../ming
w32/bin/ld.exe) is GNU ld... yes
checking whether the linker (./c:/mingw/bin/../lib/gcc/mingw32/4.7.2/../../../..
/mingw32/bin/ld.exe) supports shared libraries... yes
checking for BSD-compatible nm... /mingw/bin/nm
checking command to parse /mingw/bin/nm output... no
checking how to hardcode library paths into programs... immediate
checking for ./c:/mingw/bin/../lib/gcc/mingw32/4.7.2/../../../../mingw32/bin/ld.
exe option to reload object files... -r
checking dynamic linker characteristics... no
checking if libtool supports shared libraries... no
checking whether to build shared libraries... no
checking whether to build static libraries... yes
checking for objdir... .libs
creating libtool
checking libjpeg version number... 62
creating ./config.status
creating Makefile
creating jconfig.h
jconfig.h is unchanged

Related question: Need help compiling jpegtran.c code from libjpeg

like image 209
Enigma Avatar asked Jan 31 '13 21:01

Enigma


2 Answers

I encountered the same problem, and I believe it is because jpeg-6b is built with a very old version of autotools (the jpeg-6b version dates back 1998 if the sourceforge page is correct).

In particular, the problem is the way it checks if gcc supports the -fPIC flag:

checking for gcc option to produce PIC... -fPIC
checking if gcc PIC flag -fPIC works... no

And this is how they perform the check from config.log:

ltconfig:547: checking if gcc PIC flag -fPIC works
ltconfig:548: gcc -c  -fPIC -DPIC -I/local/include conftest.c 1>&5
conftest.c:1:0: warning: -fPIC ignored for target (all code is position independent)

 ^

Notice how gcc returns a warning, it probably returns exit code 1 which makes the check fail. And position-independent code is necessary for shared libraries, so this makes it think it can't make them, and it later outputs:

checking whether to build shared libraries... no

Compare that with libjpeg9, which I assume uses a more up-to-date version of autotools:

checking for gcc -std=gnu99 option to produce PIC... -DDLL_EXPORT -DPIC
checking if gcc -std=gnu99 PIC flag -DDLL_EXPORT -DPIC works... yes

And from config.log:

configure:10108: checking for gcc -std=gnu99 option to produce PIC
configure:10115: result: -DDLL_EXPORT -DPIC
configure:10123: checking if gcc -std=gnu99 PIC flag -DDLL_EXPORT -DPIC works
configure:10141: gcc -std=gnu99 -c -g -O2 -I/local/include -DDLL_EXPORT -DPIC -DPIC conftest.c >&5
configure:10145: $? = 0
configure:10158: result: yes

I eventually compiled libjpeg9 instead, but I think libjpeg6 might also be compilable if you can recreate the ./configure script using a newer version of autotools.

like image 130
sashoalm Avatar answered Nov 10 '22 04:11

sashoalm


You should probably try to run

./configure --help

and see all available configure flags, maybe you misspelled some or you need --enable-dynamic or something different.

For configure output you could also refer to config.log, that is in the project's (in your case -- libjpeg's) directory, just next to the configure file.

like image 3
Asalle Avatar answered Nov 10 '22 04:11

Asalle