Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#10 closed defect (fixed)

Invalid command ld -shared if build using GCC 4.x

Reported by: mloskot Owned by: warmerdam
Priority: normal Milestone:
Component: libgeotiff Version: 1.2.5
Keywords: Cc: hobu

Description

There is a known bug in libgeotiff ./configure script which has been well documented in various places, two of them:

The problem is that geotiff's configure script will tell the Makefile to run "ld -shared" to build a shared library, and that's not correct with GCC versions 4 and up. This results in a shared library that does not properly include all the references to other shared libraries it's supposed to have. The correct way to build a shared library using gcc 4.x is to use "gcc -shared" instead.

I can confirm this problem occurs on Ubuntu 8.10.

Attachments (1)

autogen.sh (892 bytes ) - added by mloskot 15 years ago.
Fixed version of ./autogen.sh based on the script copied from libLAS project

Download all attachments as: .zip

Change History (5)

comment:1 by warmerdam, 15 years ago

Cc: hobu added

In SVN Howard has reworked things to use libtool. Would you like to check if this resolves this particular issue?

comment:2 by mloskot, 15 years ago

Frank,

I'm testing current SVN trunk (r1649) on my Ubuntu 9.04 and here is what I'm getting:

mloskot@dog:~/dev/libgeotiff/_svn/trunk$ ./autogen.sh 
Running automake
aclocal.m4:14: error: this file was generated for autoconf 2.61.
You have another version of autoconf.  If you want to use that,
you should regenerate the build system entirely.
aclocal.m4:14: the top level
autom4te: /usr/bin/m4 failed with exit status: 63
automake: autoconf failed with exit status: 63
Running autoconf
aclocal.m4:14: error: this file was generated for autoconf 2.61.
You have another version of autoconf.  If you want to use that,
you should regenerate the build system entirely.
aclocal.m4:14: the top level
autom4te: /usr/bin/m4 failed with exit status: 63

  Something went wrong, giving up!

mloskot@dog:~/dev/libgeotiff/_svn/trunk$ 

I've noticed that ./autogen.sh is somewhat incomplete, so I cleaned my copy of the source tree and copied autogen.sh from libLAS (also attached), removed -I m4 option and now everything works:

  • generate ./configure
    mloskot@dog:~/dev/libgeotiff/_svn/trunk$ ./autogen.sh
    Running aclocal
    Running libtoolize
    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.
    Running automake
    configure.ac:20: installing `./missing'
    bin/Makefile.am: installing `./depcomp'
    Running autoconf
    ======================================
    Now you are ready to run './configure'
    ======================================
    
  • run ./configure
    mloskot@dog:~/dev/libgeotiff/_svn/trunk$ ./configure
    checking build system type... x86_64-unknown-linux-gnu
    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 to enable maintainer-specific portions of Makefiles... no
    checking for gcc... gcc
    checking for C compiler default output file name... a.out
    checking whether the C compiler works... yes
    checking whether we are cross compiling... no
    checking for suffix of executables... 
    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 for style of include used by make... none
    checking dependency style of gcc... none
    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++... none
    checking how to run the C++ preprocessor... g++ -E
    checking for a BSD-compatible install... /usr/bin/install -c
    checking whether ln -s works... yes
    checking whether make sets $(MAKE)... (cached) yes
    checking host system type... x86_64-unknown-linux-gnu
    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 the maximum length of command line arguments... 1572864
    checking whether the shell understands some XSI constructs... yes
    checking whether the shell understands "+="... yes
    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 ar... ar
    checking for strip... strip
    checking for ranlib... ranlib
    checking command to parse /usr/bin/nm -B output from gcc object... ok
    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 whether we are using the GNU C++ compiler... (cached) yes
    checking whether g++ accepts -g... (cached) yes
    checking dependency style of g++... (cached) none
    checking how to run the C++ preprocessor... g++ -E
    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 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... GNU/Linux ld.so
    checking how to hardcode library paths into programs... immediate
    checking for string.h... (cached) yes
    checking stdio.h usability... yes
    checking stdio.h presence... yes
    checking for stdio.h... yes
    checking for stdlib.h... (cached) yes
    checking for debug enabled... no
    checking for exp in -lm... yes
    checking for zlib... no
    checking for jpeg... no
    checking for TIFFOpen in -ltiff... yes
    checking for TIFFMergeFieldInfo in -ltiff... yes
    checking for pj_init in -lproj... yes
    checking projects.h usability... yes
    checking projects.h presence... yes
    checking for projects.h... yes
    checking if EPSG tables will be read from .csv files... no
    configure: creating ./config.status
    config.status: creating Makefile
    config.status: creating libxtiff/Makefile
    config.status: creating bin/Makefile
    config.status: creating geo_config.h
    config.status: executing depfiles commands
    config.status: executing libtool commands
    
    libgeotiff configuration summary:
    
      Version..................: 1.3.0
      Installation directory...: /usr/local
      C compiler...............: gcc -g -O2 -O3 -DNDEBUG
      C++ compiler.............: g++ -g -O2 -O3 -DNDEBUG
      Debugging support........: 
    
      zlib support......: no
      jpeg support......: no
      TIFF support......: yes
        -INCLUDE .......: 
        -PREFIX ........: 
      PROJ support......: yes
        -INCLUDE .......: 
        -PREFIX ........: 
      Incode CSV support: no
      LIBS.....................: -lproj -lm   -ltiff
    
      libgeotiff - http://trac.osgeo.org/geotiff
    

by mloskot, 15 years ago

Attachment: autogen.sh added

Fixed version of ./autogen.sh based on the script copied from libLAS project

comment:3 by warmerdam, 15 years ago

Resolution: fixed
Status: newclosed

I have restored hobu's original autogen.sh with some extra logic to preserve geo_config.h.in which I do not want to be autogenerated (r1650).

comment:4 by mloskot, 15 years ago

I can confirm the r1650 works. Thanks!

Note: See TracTickets for help on using tickets.