Configure script does not allow make to generate a shared library

This applies to compiling libjpeg v6b, if relevant.

I ran. / configure --prefix = / c / tmp / jpeg-6b-build --enable-shared --enable-static, like the installation file, but libtool does not have 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 .exe generates work, but I need to use the source for something else. v6b for some reason does not generate .DLL, but v9 does.

Full output for the team. / configure:

 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 questions: Need help compiling jpegtran.c code from libjpeg

+4
source share
2 answers

I ran into the same problem and I believe that this is because jpeg-6b is built with a very old version of autotools (the jpeg-6b version dates back to 1998 if the sourceforge page is correct).

In particular, the problem is how it checks to see 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 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)

  ^ 

Note that gcc returns a warning; it probably returns exit code 1, which is why the check fails. And position-independent code is needed for shared libraries, so this makes him think that he cannot make them, and then outputs:

  checking whether to build shared libraries ... no 

Compare this with libjpeg9, which I assume uses a more modern 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 ended up compiling libjpeg9, but I think libjpeg6 can also be compiled if you can recreate. / configure script using the newer version of autotools.

+2
source

You should probably try running

 ./configure --help 

and see all the available configure flags, maybe you have sealed some or you need --enable-dynamic or something else.

To display the configuration, you can also refer to config.log , which is located in the project directory (in your case, libjpeg), next to the configure file.

+1
source

All Articles