Opened 20 years ago

Closed 13 years ago

#499 closed defect (fixed)

AIX libtool - no .o files.

Reported by: warmerdam Owned by: alexamici@…
Priority: high Milestone:
Component: default Version: unspecified
Severity: normal Keywords:
Cc:

Description (last modified by Even Rouault)

I am building on AIX 4 with libtool enabled, but it seems like make keeps
regenerating the same files over and over again.

For instance if I cd into gdal/port, and type make the build runs fine.
But only the .lo and .libs/*.lo files are created.  There is no .o file. 

If I type make again, all the same files are re-compiled. 

Should our dependency rules depend on .lo files instead of .o files when 
libtool is being used?   I see on Linux .o files are created as well, 
presumably because there is a difference between pic and non-pic code 
that does not exist on AIX. 

Any thoughts?

I don't know if I can easily provide access to the machine in question

Attachments (1)

ttt.txt (37.5 KB ) - added by Daniel Morissette 20 years ago.
Warnings/errors at end of build after applying the GDALmake.opt.in patch

Download all attachments as: .zip

Change History (13)

comment:1 by warmerdam, 20 years ago

I would add that and the end of the build, I get the following behaviour
and failure.  It would appear that because regular .o files aren't being
created, the logic about frmts/*.o gets all confused. 

make ./libgdal.la
make[1]: Entering directory `/home/warmerda/gdal-1.2.0a2'
GNUmakefile:43: warning: overriding commands for target `libgdal.la'
GNUmakefile:39: warning: ignoring old commands for target `libgdal.la'
make[1]: *** No rule to make target `frmts/o/*.o', needed by `libgdal.la'.  Stop.
make[1]: Leaving directory `/home/warmerda/gdal-1.2.0a2'
make: *** [check-lib] Error 2

I think this turns it from being very invconveient into a real release stopper.


comment:2 by warmerdam, 20 years ago

Frank,

On Friday 20 February 2004 00:35, Frank Warmerdam wrote:

>> I have also created a bug report (listed in the wiki) on which bugs that
>> are "1.2.0 release blockers" can mark as blocked by themselves.  I have
>> marked a bunch of bugs as blocking the release and intend to go through
>> them soon.


i could reproduce #499 (aix specific) on i686-pc-linux-gnu with:
$ ./configure --disable-static

it is a libtool bug instroduced somewhere before version 1.5.0a that is in 
gdal now. it is not fixed in current libtool 1.5.2.

there are various way to work around it, i'm trying to find a better fix than 
the *ugly* patch attached (that fixes the compile error on linux, but not the 
spurios recompiles).

can you test the patch and apply it if it fixes the aix bug?

cheers,
alessandro



--- GDALmake.opt.in.orig	2004-02-23 08:24:16.000000000 +0100
+++ GDALmake.opt.in	2004-02-23 08:24:40.000000000 +0100
@@ -254,9 +254,11 @@
 
 ../o/%.o:	%.c
 	$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
+	touch $@
 
 ../o/%.o:	%.cpp
 	$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $<
+	touch $@
 
 #
 # default rules for handling subdirectories

comment:3 by warmerdam, 20 years ago

It seems if we were to override the default .o.c rules with a similar approach
we could correct the repeating compilations as well.  

comment:4 by warmerdam, 20 years ago

I get the following:

make[1]: Leaving directory `/home/warmerda/gdal-1.2.0a2/ogr'
make ./libgdal.la
make[1]: Entering directory `/home/warmerda/gdal-1.2.0a2'
GNUmakefile:43: warning: overriding commands for target `libgdal.la'
GNUmakefile:39: warning: ignoring old commands for target `libgdal.la'
make[1]: *** No rule to make target `gcore/*.o', needed by `libgdal.la'.  Stop.
make[1]: Leaving directory `/home/warmerda/gdal-1.2.0a2'
make: *** [check-lib] Error 2

I presume this means we would need some sort of similar fix for the gcore
directory object file building?


comment:5 by Daniel Morissette, 20 years ago

I applied the GDALmake.opt.in patch proposed above, made a few hacks to tiff.h
for #498, and at the end of my build I get a bunch of warnings while creating
libgdal.so, followed by an error when trying to link ogrinfo.

I'll attach the output to this bug,

by Daniel Morissette, 20 years ago

Attachment: ttt.txt added

Warnings/errors at end of build after applying the GDALmake.opt.in patch

comment:6 by Daniel Morissette, 20 years ago

If I change the ogrinfo link command from:
  /bin/sh ../libtool --mode=link  g++  ogrinfo.o ../libgdal.la -o ogrinfo
to:
  /bin/sh ../libtool --mode=link  g++  .libs/ogrinfo.o ../libgdal.la -o ogrinfo

...and run it from gdal-1.2.0a/ogr then it does appear to link... I mean I get a
'ogrinfo' binary in .libs

However this binary won't run.  If I do:
 $ export LD_LIBRARY_PATH=/home/src/gdal-1.2.0a/.libs
 $ .libs/ogrinfo

... then I get:
----------------------
exec(): 0509-036 Cannot load program .libs/ogrinfo because of the following errors:
        0509-150   Dependent module libgdal.a(libgdal.so.1) could not be loaded.
        0509-022 Cannot load module libgdal.a(libgdal.so.1).
        0509-026 System error: A file or directory in the path name does not exist.
----------------------

libgdal.so.1 is in /home/src/gdal-1.2.0a/.libs so I would expect the above to work.

comment:7 by alexamici@…, 20 years ago

 
i fixed the linux variant of this bug in cvs. 
 
the fix is conceptually correct, but i had to mess with ltmain.sh, so we have 
to remember to put the fix back on the next libtool updates (or push the 
problem upstream) 
 
Frank, can you check whether it works for you? 

comment:8 by warmerdam, 20 years ago

I have prepared an alpha-4 snapshot and am starting a test build on the DMSG
AIX system. 

comment:9 by warmerdam, 20 years ago

Working from the currently alpha-4 snapshot I get errors like this while
building the shared library.  As far as I can tell, this error is resulting in
an empty symbol list to export from the shared library.

/usr/bin/nm -B -BCpg .libs/libgdal.la-2.o | awk '{ if ((( == T) || ( == D) || (
== B)) && (substr(,1,1) != .)) { print  } }' | sort -u > .libs/libgdal.exp
 syntax error The source line is 1.
 The error context is
                { if ((( >>>  == <<< 
 awk: The statement cannot be correctly parsed.
 The source line is 1.
 syntax error The source line is 1
g++ -shared -o .libs/libgdal.so.1 .libs/libgdal.la-2.o 
-Wl,-blibpath:/usr/local/lib/.:/usr/local/lib/gcc-lib/powerpc-ibm-aix4.3.2.0/3.3.2:/usr/local/lib/gcc-lib/powerpc-ibm-aix4.3.2.0/3.3.2/../../..:/usr/lib:/lib
-L/usr/local/lib/gcc-lib/powerpc-ibm-aix4.3.2.0/../..
-L/usr/src/local/Working_on/gcc-3.3.2.obj/gcc
-L/usr/src/local/Working_on/gcc-3.3.2.obj/powerpc-ibm-aix4.3.2.0/libstdc++-v3/src/.libs
-L/usr/src/local/Working_on/gcc-3.3.2.obj/powerpc-ibm-aix4.3.2.0/libstdc++-v3/src
-ldl -L/usr/local/lib/gcc-lib/powerpc-ibm-aix4.3.2.0/3.3.2
-L/usr/local/lib/gcc-lib/powerpc-ibm-aix4.3.2.0/3.3.2/../../..
-L/usr/local/lib/. -lstdc++ -lm -lc -lgcc_s  -Wl,-bE:.libs/libgdal.exp
-Wl,-bnoentry ${wl}-bernotok
ar cru .libs/libgdal.a .libs/libgdal.so.1
rm -f .libs/libgdal.la-1.o .libs/libgdal.la-2.o
creating libgdal.la
(cd .libs && rm -f libgdal.la && ln -s ../libgdal.la libgdal.la)
make[1]: Leaving directory `/home/warmerda/gdal-1.2.0a4'
(cd ogr; make apps)
make[1]: Entering directory `/home/warmerda/gdal-1.2.0a4/ogr'
/bin/sh ../libtool --mode=link  g++  ogrinfo.o ../libgdal.la -o ogrinfo
g++ ogrinfo.o -o .libs/ogrinfo  -L../.libs -lgdal -ldl -L/usr/local/lib/.
-lstdc++
-L/usr/src/local/Working_on/gcc-3.3.2.obj/powerpc-ibm-aix4.3.2.0/libstdc++-v3/src
-L/usr/src/local/Working_on/gcc-3.3.2.obj/powerpc-ibm-aix4.3.2.0/libstdc++-v3/src/.libs
-L/usr/src/local/Working_on/gcc-3.3.2.obj/gcc
-L/usr/local/lib/gcc-lib/powerpc-ibm-aix4.3.2.0/../..
-Wl,-blibpath:/home/warmerda/lusr/lib:/usr/local/lib/.:/usr/local/lib/gcc-lib/powerpc-ibm-aix4.3.2.0/3.3.2:/usr/local/lib/gcc-lib/powerpc-ibm-aix4.3.2.0/3.3.2/../../..:/usr/lib:/lib

ld: 0711-317 ERROR: Undefined symbol: .OGRRegisterAll
ld: 0711-317 ERROR: Undefined symbol: .OGRSFDriverRegistrar::Open(char const*,
int, OGRSFDriver**)
ld: 0711-317 ERROR: Undefined symbol: .CSLCount
ld: 0711-317 ERROR: Undefined symbol: .OGRGeometryTypeToName
ld: 0711-317 ERROR: Undefined symbol: .CSLFindString
ld: 0711-317 ERROR: Undefined symbol: .CSLDestroy
ld: 0711-317 ERROR: Undefined symbol: .OGRSFDriverRegistrar::GetRegistrar()
ld: 0711-317 ERROR: Undefined symbol: .CPLFinderClean
ld: 0711-317 ERROR: Undefined symbol:
.OGRSFDriverRegistrar::~OGRSFDriverRegistrar [in-charge]()
ld: 0711-317 ERROR: Undefined symbol: .OGRSFDriverRegistrar::GetDriverCount()
ld: 0711-317 ERROR: Undefined symbol: .OGRSFDriverRegistrar::GetDriver(int)
ld: 0711-317 ERROR: Undefined symbol: .CSLAddString
ld: 0711-317 ERROR: Undefined symbol: .OGRLinearRing::OGRLinearRing[in-charge]()
ld: 0711-317 ERROR: Undefined symbol: .OGRLineString::addPoint(double, double,
double)
ld: 0711-317 ERROR: Undefined symbol: .OGRPolygon::OGRPolygon[in-charge]()
ld: 0711-317 ERROR: Undefined symbol: .OGRPolygon::addRing(OGRLinearRing*)
ld: 0711-317 ERROR: Undefined symbol: .OGRLinearRing::~OGRLinearRing [in-charge]()
ld: 0711-317 ERROR: Undefined symbol: .OGRFeature::DumpReadable(FILE*)
ld: 0711-317 ERROR: Undefined symbol: .CPLStrdup
ld: 0711-317 ERROR: Undefined symbol: .VSIFree
ld: 0711-317 ERROR: Undefined symbol: .OGRFeatureDefn::GetFieldDefn(int)
ld: 0711-317 ERROR: Undefined symbol: .OGRFieldDefn::GetFieldTypeName(OGRFieldType)
ld: 0711-317 ERROR: Undefined symbol:
.OGRSpatialReference::exportToPrettyWkt(char**, int) const
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
collect2: ld returned 8 exit status
make[1]: *** [ogrinfo] Error 1
make[1]: Leaving directory `/home/warmerda/gdal-1.2.0a4/ogr'
make: *** [ogr-apps] Error 2

I have tried a few things to look into why the nm |awk command isn't working
properly.  I entered it by hand at the commandline and it worked just fine
(as found in libtool with lots of backslashes removed).  I tried switching
libtool to use /bin/bash instead of /bin/sh and that didn't help.  I also 
tried adding one more escaping backslash level but that just messed things
up. 

I am at a bit of a loss as to why the libtool build is so screwed up on AIX. 

I did succeed in a static non-libtool build of GDAL.  I found I had to make
a few fixes since alpha-2 since I had botched the non-libtool install rules
for non-shared builds. 

Daniel, is a .so build important to you on AIX?  I am inclined to give up on the
AIX 4 libtool build for now. 

comment:10 by Daniel Morissette, 20 years ago

It doesn't have to be a .so, I can live with a static lib, as long as there is a
way to build and link with it.  I'll try using --without-libtool.

comment:11 by Daniel Morissette, 20 years ago

For the record, a static build (--without-libtool) worked fine with gdal-1.2.0a5
on AIX 4.3.3 w/ GCC 3.3 after patching tiff.h for #498.

comment:12 by Even Rouault, 13 years ago

Description: modified (diff)
Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.