Stuart Henderson [2011-07-04, 11:38:51]: > On 2011-07-01, Jan Stary <h...@stare.cz> wrote: > > On Jul 01 18:09:53, Stuart Henderson wrote: > >> On 2011-07-01, Jan Stary <h...@stare.cz> wrote: > >> >> It builds fine with USE_LIBTOOL=gnu. > >> > > >> > Yes it does. Thank you. > >> > > >> > I didn't know I could use USE_LIBTOOL=gnu. > >> > >> I forgot to comment on this earlier; it's available in cases where > >> something doesn't package with ports libtool and a fix can't be > >> found, but it's really a last resort. > > > > Well, does anyone know how to fix the USE_LIBTOOL issue > > described in the original post? It seems it puts '-x c' > > in front of *.o files, but I don't know libtool enough > > to spot and fix the exact bug. > > cc'ing steven as the person who probably knows ports libtool the best ;) > quick summary: new port opencore-amr is having problems with our libtool. > port isn't committed yet, see http://junkpile.org/opencore-amr.tgz > > it's setting "-x c" in flags to libtool for both compiler and linker. > > /usr/ports/infrastructure/bin/libtool --tag=CXX --mode=link c++ -I<blah > blah, bunch of include paths> -x c -std=c99 -O2 -pipe -version-info 0:2:0 > -o libopencore-amrwb.la -rpath /usr/local/lib wrapper.lo <blah blah, bunch of > .lo's> -lm > > libtool passes this to the linker and this breaks the build. > > For --mode=link, GNU libtool only include the specific flags relevant > to the linker, and strips out anything else. I think this behaviour > makes sense, diff below seems to work for opencore-amr but hasn't > been thoroughly tested and I don't really understand libtool well > enough to know if it will cause other problems. > > So this needs more testing (a full bulk build would be good), and > review by somebody who knows how libtool is supposed to work. > > Index: LibTool/Parser.pm > =================================================================== > RCS file: /cvs/ports/infrastructure/lib/LibTool/Parser.pm,v > retrieving revision 1.1 > diff -u -p -r1.1 Parser.pm > --- LibTool/Parser.pm 5 Dec 2010 16:37:50 -0000 1.1 > +++ LibTool/Parser.pm 4 Jul 2011 10:24:07 -0000 > @@ -295,7 +295,7 @@ sub parse_linkargs2 > push(@$result, "-Wl,$f"); > } > } else { > - push(@$result, $a); > + Trace::debug {"ignoring $a\n"}; > } > } > Trace::debug {"end parse_linkargs2\n"};
what we do now is: getopt strips out valid libtool options, some arguments are transformed into arguments for the linker, and the remaining ones are assumed to be valid linker options/arguments. your diff will ignore the latter. we would have to insert valid linker options as well. i am not sure how gnu does this exactly.