View this PageEdit this PageUploads to this PageVersions of this PageHomeRecent ChangesSearchHelp Guide

Compilar contra librerias antiguas que dan el error de undefined reference __ctype_b

La solución la dan aquí:

You need to compile your source with the gcc option:


   -Wl,--wrap,__ctype_b


then compile an object (.o) from the following source


   #include <ctype.h>


   extern "C" {
   __const unsigned short int **__wrap___ctype_b (void) {
     return __ctype_b_loc();
   }
   }


and link it in.



Al final lo que he hecho ha sido lo siguiente:

metro@imrahil:~/PruebasMirasierra/Fuentes$ cat ctype.c 
#include <ctype.h>
   __const unsigned short int **__wrap___ctype_b (void) {
     return __ctype_b_loc();
   }

   __const __int32_t **__wrap___ctype_tolower (void) {
     return __ctype_tolower_loc();
   }
metro@imrahil:~/PruebasMirasierra/Fuentes$ cat link.sh 
#!/bin/sh
EXTRAS=ctype.o
OTRAS_OPCIONES=-Wl,--wrap,__ctype_b,--wrap,__ctype_tolower
gcc -Wl,--wrap,__ctype_b,--wrap,__ctype_tolower -c ctype.c
/usr/bin/gcc $OTRAS_OPCIONES -g -Wall -o ui_presurizacion ui_presurizacion.o comun.o mensajes.o mensajes_xdr.o control_cif.o control_clnt.o router_cif.o router_clnt.o LibreriaTextos.o ParseTextos.o LibreriaIconos.o ParseIconos.o LibreriaContextosEmergencia.o ParseContextosEmergencia.o UI_Presurizacion.o ui_presurizacion_svc.o ui_presurizacion_sif.o  rpc_ui_presurizacion.o FicherosUI_Presurizacion.o FuncionesUI_Presurizacion.o drv_ui_presurizacion.o proceso.o drv_comun.o lista_procesos.o Str2TiposCapt.o salida_texto.o win_display1.o gcm.o strtoklinux.o $EXTRAS -L/usr/X11R6/lib -L/usr/lib/X11 -L/usr/ccs/lib -L/opt4/lib -L/usr/lib -L/usr/lib/X11R6 -L/usr/X11R6/lib -L/usr/lib/Motif1.2 -L./libux   -lux -lXpm -lMrm -lXm -lXp -lXext -lXt -lX11 -lc   -lxview -lolgx -lX11 -lm  ./libz.a
metro@imrahil:~/PruebasMirasierra/Fuentes$