title: 0711-317 ERROR: Undefined symbol
body: <p>I am installing a C package named expat-2.1.0 in AIX 6.1 machine. While performing a gmake it popping the below output.</p>
  
  <pre><code>/bin/sh ./libtool --silent --mode=compile gcc -std=gnu99 -I./lib -I. -g -O2 -Wal
  l -Wmissing-prototypes -Wstrict-prototypes -fexceptions  -DHAVE_EXPAT_CONFIG_H -
  o lib/xmlparse.lo -c lib/xmlparse.c
  /bin/sh ./libtool --silent --mode=compile gcc -std=gnu99 -I./lib -I. -g -O2 -Wal
  l -Wmissing-prototypes -Wstrict-prototypes -fexceptions  -DHAVE_EXPAT_CONFIG_H -
  o lib/xmltok.lo -c lib/xmltok.c
  /bin/sh ./libtool --silent --mode=compile gcc -std=gnu99 -I./lib -I. -g -O2 -Wal
  l -Wmissing-prototypes -Wstrict-prototypes -fexceptions  -DHAVE_EXPAT_CONFIG_H -
  o lib/xmlrole.lo -c lib/xmlrole.c
  /bin/sh ./libtool --silent --mode=link gcc -std=gnu99 -I./lib -I. -g -O2 -Wall -
  Wmissing-prototypes -Wstrict-prototypes -fexceptions  -DHAVE_EXPAT_CONFIG_H -no-
  undefined -version-info 7:0:6 -rpath /usr/local/lib  -o libexpat.la lib/xmlparse
  .lo lib/xmltok.lo lib/xmlrole.lo
  ld: 0711-317 ERROR: Undefined symbol: .__register_frame_info_table
  ld: 0711-317 ERROR: Undefined symbol: .__deregister_frame_info
  ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
  collect2: ld returned 8 exit status
  gmake: *** [libexpat.la] Error 1
  </code></pre>
  
  <p>This same package I had installed in Linux machine where it did not gave any error.
  while executing the below command in the script the error is coming up because of the option <code>-no-undefined</code> since the header is included it should not throw the error, I suppose the command is not able to link to the header and hence the error is coming.</p>
  
  <pre><code>bash-3.2# /bin/sh ./libtool --mode=link gcc -std=gnu99 -I./lib -I. -g -O2 -Wall
  -Wmissing-prototypes -Wstrict-prototypes -fexceptions  -DHAVE_EXPAT_CONFIG_H -no
  -undefined -version-info 7:0:6 -rpath /usr/local/lib -o libexpat.la lib/xmlparse
  .lo lib/xmltok.lo lib/xmlrole.lo
  libtool: link: rm -fr  .libs/libexpat.exp
  libtool: link: //bin/nm -B -BCpg  lib/.libs/xmlparse.o lib/.libs/xmltok.o lib/.l
  ibs/xmlrole.o   | awk '{ if ((($ 2 == "T") || ($ 2 == "D") || ($ 2 == "B")) &amp;&amp; (
  substr($ 3,1,1) != ".")) { print $ 3 } }' | sort -u &gt; .libs/libexpat.exp
  libtool: link: gcc -shared -o .libs/libexpat.so.1  lib/.libs/xmlparse.o lib/.lib
  s/xmltok.o lib/.libs/xmlrole.o   -lc -Wl,-bnoentry  -O2   -Wl,-bE:.libs/libexpat
  .exp -Wl,-bernotok
  ld: 0711-317 ERROR: Undefined symbol: .__register_frame_info_table
  ld: 0711-317 ERROR: Undefined symbol: .__deregister_frame_info
  ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
  collect2: ld returned 8 exit status
  </code></pre>
  
  <p>If I remove the <code>-no-undefined</code> the command is working fine. Can anybody help me out to find how to run this command using <code>-no-undefined</code> option.</p>
  
  <p>I then executed the below command separately with --verbose and -bloadmap option.</p>
  
  <pre><code>bash-3.2# gcc -shared --verbose -o .libs/libexpat.so.1  lib/.libs/xmlparse.o lib
  /.libs/xmltok.o lib/.libs/xmlrole.o   -lc -Wl,-bnoentry  -O2  -W1,-bloadmap  -Wl
  ,-bE:.libs/libexpat.exp -Wl,-bernotok
  Using built-in specs.
  Target: powerpc-ibm-aix6.1.0.0
  Configured with: ../configure --with-as=/usr/bin/as --with-ld=/usr/bin/ld --enab
  le-languages=c,c++,java --prefix=/opt/freeware --enable-threads --enable-version
  -specific-runtime-libs --host=powerpc-ibm-aix6.1.0.0 --target=powerpc-ibm-aix6.1
  .0.0 --build=powerpc-ibm-aix6.1.0.0 --disable-libjava-multilib
  Thread model: aix
  gcc version 4.2.0
   /opt/freeware/libexec/gcc/powerpc-ibm-aix6.1.0.0/4.2.0/collect2 -bpT:0x10000000
   -bpD:0x20000000 -btextro -bnodelcsect -bM:SRE -bnoentry -o .libs/libexpat.so.1
  -L/opt/freeware/lib/gcc/powerpc-ibm-aix6.1.0.0/4.2.0 -L/usr/lib/gcc/powerpc-ibm-
  aix6.1.0.0/4.2.0 -L/opt/freeware/lib/gcc/powerpc-ibm-aix6.1.0.0/4.2.0/../../.. l
  ib/.libs/xmlparse.o lib/.libs/xmltok.o lib/.libs/xmlrole.o -lc -bnoentry -bE:.li
  bs/libexpat.exp -bernotok -lgcc_s -lc -lgcc_s
  ld: 0711-317 ERROR: Undefined symbol: .__register_frame_info_table
  ld: 0711-317 ERROR: Undefined symbol: .__deregister_frame_info
  ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
  collect2: ld returned 8 exit status
  </code></pre>
  
  <p>It seems like gcc is linking to shared libgcc library so I added option <code>-static-libgcc</code> to the above command the result was it got executed without any error.</p>
  
  <p>But can somebody tell me how I can use the same option with my first command i.e </p>
  
  <pre><code>    /bin/sh ./libtool --silent --mode=compile gcc -std=gnu99 -I./lib -I. -g -O2 -Wal
      l -Wmissing-prototypes -Wstrict-prototypes -fexceptions  -DHAVE_EXPAT_CONFIG_H -
      o lib/xmlparse.lo -c lib/xmlparse.c
  </code></pre>