Search code examples
makefilelibtool

libtool error during linkage


I am compiling courier-authlib-0.66.1 which utilizes libtool for compilation. I modified all Makefiles to remove CFLAGS and CXXFLAGS in --mode=link lines because I use some specially compiler flags for clang that will confuse the linker.

During compilation, I got the following error:

libtool: link: /usr/bin/nm -B .libs/authsasl.o .libs/authsaslcram.o .libs/authsasllogin.o .libs/authsaslplain.o .libs/authsaslfrombase64.o .libs/authsasltobase64.o | | /bin/sed 's/.* //' | sort | uniq > .libs/libcourierauthsasl.exp

./libtool: eval: line 1085: syntax error near unexpected token `|'

Apparently there are two bars in the command and I should remove one of them. However, when I opened the libtool file and jumped to line 1085, I only find the following code

eval "$my_cmd"

Could you please tell me how to find the root cause of this error and address it? Or which documents might help me? Thank you!


Solution

  • The problem is solved. I asked a question in Courier's mail list and got a very good answer: http://sourceforge.net/p/courier/mailman/message/32327466/

    I just copied the key part here.

    $ fgrep 'sort | uniq' libtool
    export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe |  
    \$SED 's/.* //' | sort | uniq > \$export_symbols"
    

    Actually, the \$global_symbol_pipe variable is somehow missing, so I just removed it. Of course, it is just a dirty solution...