Wireshark-dev: [Wireshark-dev] idl2wrs: "multiple definition" linker errors when building multi
From: Alfonso Acosta Gómez <aacosta@xxxxxxx>
Date: Thu, 16 Jul 2009 11:22:30 +0200
Hi,

I am writing a script to create custom night-builds of wireshark 1.2.0 including dissectors for a set of idls.

My script follows wireshark's idl2wrs guide  [1]  and works flawlessly for a single IDL. However, building multiple idl-dissectors leads to "multiple definition" errors fro symbols `version', `plugin_register' and `plugin_reg_handoff'. (See the end of the e--mail for an error-sample)

It seems that the symbol clash is cause because idl2wrs is generating code sections like the following for _each_ dissector:

#ifndef ENABLE_STATIC
G_MODULE_EXPORT const gchar version[] = "0.0.1";
#endif

#ifndef ENABLE_STATIC

G_MODULE_EXPORT void
plugin_register(void)
{
....
}

G_MODULE_EXPORT void
plugin_reg_handoff(void){
...
}
#endif


Is idl2wrs to blame or am I doing something wrong?  In case it is, can anyone suggest a workaround?


Thanks in advance,

Alfonso Acosta


[1] http://www.wireshark.org/docs/wsug_html_chunked/AppToolsidl2wrs.html

Error example. 

When generating and building the following dissectors:

packet-tkcomcorbaapplication-idl.c  packet-tkcomcorbaguiinstallation-idl.c  packet-tkcomcorbaguiloginterest-idl.c
packet-tkcomcorbagui-idl.c          packet-tkcomcorbaguiinterest-idl.c      packet-tkcomcorbaprocesslist-idl.c

I get the following building errors:

make[3]: Entering directory `/tmp/wireshark-1.2.0/epan'
/bin/sh ../libtool --tag=CC --mode=link gcc  -DINET6 -D_U_="__attribute__((unused))" -g -O2 -Wall -W -Wdeclaration-after-statement -Wendif-labels -Wpointer-arith -Wno-pointer-sign -Wcast-align -Wformat-security -I/usr/local/include -pthread -I/usr/include/cairo -I/usr/include/freetype2 -I/usr/X11R6/include -I/usr/include/libpng12 -I/opt/gnome/include/gtk-2.0 -I/opt/gnome/lib/gtk-2.0/include -I/opt/gnome/include/atk-1.0 -I/opt/gnome/include/pango-1.0 -I/opt/gnome/include/glib-2.0 -I/opt/gnome/lib/glib-2.0/include    -L/usr/local/lib -L/usr/local/lib -L/usr/local/lib -L/usr/local/lib -L/usr/local/lib -o libwireshark.la -rpath /usr/local/lib -version-info 0:1:0  libwireshark_la-addr_and_mask.lo libwireshark_la-addr_resolv.lo libwireshark_la-adler32.lo libwireshark_la-afn.lo libwireshark_la-asn1.lo libwireshark_la-atalk-utils.lo libwireshark_la-base64.lo libwireshark_la-bitswap.lo libwireshark_la-camel-persistentdata.lo libwireshark_la-charsets.lo libwireshark_la-circuit.lo libwireshark_la-codecs.lo libwireshark_la-column.lo libwireshark_la-column-utils.lo libwireshark_la-conversation.lo libwireshark_la-crc10.lo libwireshark_la-crc16.lo libwireshark_la-crc32.lo libwireshark_la-crc6.lo libwireshark_la-crcdrm.lo libwireshark_la-dissector_filters.lo libwireshark_la-emem.lo libwireshark_la-epan.lo libwireshark_la-ex-opt.lo libwireshark_la-except.lo libwireshark_la-expert.lo libwireshark_la-filesystem.lo libwireshark_la-follow.lo libwireshark_la-frame_data.lo libwireshark_la-frequency-utils.lo libwireshark_la-funnel.lo libwireshark_la-gcp.lo libwireshark_la-geoip_db.lo libwireshark_la-golay.lo libwireshark_la-guid-utils.lo libwireshark_la-h225-persistentdata.lo libwireshark_la-in_cksum.lo libwireshark_la-ipproto.lo libwireshark_la-ipv4.lo libwireshark_la-next_tvb.lo libwireshark_la-nstime.lo libwireshark_la-oids.lo libwireshark_la-osi-utils.lo libwireshark_la-packet.lo libwireshark_la-plugins.lo libwireshark_la-prefs.lo libwireshark_la-proto.lo libwireshark_la-range.lo libwireshark_la-reassemble.lo libwireshark_la-reedsolomon.lo libwireshark_la-report_err.lo libwireshark_la-req_resp_hdrs.lo libwireshark_la-sigcomp_state_hdlr.lo libwireshark_la-sigcomp-udvm.lo libwireshark_la-sminmpec.lo libwireshark_la-sna-utils.lo libwireshark_la-stat_cmd_args.lo libwireshark_la-stats_tree.lo libwireshark_la-strutil.lo libwireshark_la-stream.lo libwireshark_la-t35.lo libwireshark_la-tap.lo libwireshark_la-tcap-persistentdata.lo libwireshark_la-timestamp.lo libwireshark_la-tfs.lo libwireshark_la-to_str.lo libwireshark_la-tvbparse.lo libwireshark_la-tvbuff.lo libwireshark_la-uat.lo libwireshark_la-value_string.lo libwireshark_la-xdlc.lo  libwireshark_generated.la libwireshark_asmopt.la crc/libcrc.la crypt/libairpdcap.la ftypes/libftypes.la dfilter/libdfilter.la dissectors/libdissectors.la dissectors/libdirtydissectors.la  -lgcrypt -lgpg-error ../wsutil/libwsutil.la -lm -lz 
gcc -shared  .libs/libwireshark_la-addr_and_mask.o .libs/libwireshark_la-addr_resolv.o .libs/libwireshark_la-adler32.o .libs/libwireshark_la-afn.o .libs/libwireshark_la-asn1.o .libs/libwireshark_la-atalk-utils.o .libs/libwireshark_la-base64.o .libs/libwireshark_la-bitswap.o .libs/libwireshark_la-camel-persistentdata.o .libs/libwireshark_la-charsets.o .libs/libwireshark_la-circuit.o .libs/libwireshark_la-codecs.o .libs/libwireshark_la-column.o .libs/libwireshark_la-column-utils.o .libs/libwireshark_la-conversation.o .libs/libwireshark_la-crc10.o .libs/libwireshark_la-crc16.o .libs/libwireshark_la-crc32.o .libs/libwireshark_la-crc6.o .libs/libwireshark_la-crcdrm.o .libs/libwireshark_la-dissector_filters.o .libs/libwireshark_la-emem.o .libs/libwireshark_la-epan.o .libs/libwireshark_la-ex-opt.o .libs/libwireshark_la-except.o .libs/libwireshark_la-expert.o .libs/libwireshark_la-filesystem.o .libs/libwireshark_la-follow.o .libs/libwireshark_la-frame_data.o .libs/libwireshark_la-frequency-utils.o .libs/libwireshark_la-funnel.o .libs/libwireshark_la-gcp.o .libs/libwireshark_la-geoip_db.o .libs/libwireshark_la-golay.o .libs/libwireshark_la-guid-utils.o .libs/libwireshark_la-h225-persistentdata.o .libs/libwireshark_la-in_cksum.o .libs/libwireshark_la-ipproto.o .libs/libwireshark_la-ipv4.o .libs/libwireshark_la-next_tvb.o .libs/libwireshark_la-nstime.o .libs/libwireshark_la-oids.o .libs/libwireshark_la-osi-utils.o .libs/libwireshark_la-packet.o .libs/libwireshark_la-plugins.o .libs/libwireshark_la-prefs.o .libs/libwireshark_la-proto.o .libs/libwireshark_la-range.o .libs/libwireshark_la-reassemble.o .libs/libwireshark_la-reedsolomon.o .libs/libwireshark_la-report_err.o .libs/libwireshark_la-req_resp_hdrs.o .libs/libwireshark_la-sigcomp_state_hdlr.o .libs/libwireshark_la-sigcomp-udvm.o .libs/libwireshark_la-sminmpec.o .libs/libwireshark_la-sna-utils.o .libs/libwireshark_la-stat_cmd_args.o .libs/libwireshark_la-stats_tree.o .libs/libwireshark_la-strutil.o .libs/libwireshark_la-stream.o .libs/libwireshark_la-t35.o .libs/libwireshark_la-tap.o .libs/libwireshark_la-tcap-persistentdata.o .libs/libwireshark_la-timestamp.o .libs/libwireshark_la-tfs.o .libs/libwireshark_la-to_str.o .libs/libwireshark_la-tvbparse.o .libs/libwireshark_la-tvbuff.o .libs/libwireshark_la-uat.o .libs/libwireshark_la-value_string.o .libs/libwireshark_la-xdlc.o -Wl,--whole-archive ./.libs/libwireshark_generated.a ./.libs/libwireshark_asmopt.a crc/.libs/libcrc.a crypt/.libs/libairpdcap.a ftypes/.libs/libftypes.a dfilter/.libs/libdfilter.a dissectors/.libs/libdissectors.a dissectors/.libs/libdirtydissectors.a -Wl,--no-whole-archive  -Wl,--rpath -Wl,/tmp/wireshark-1.2.0/wsutil/.libs -L/usr/local/lib -L/opt/gnome/lib /opt/gnome/lib/libgmodule-2.0.so -ldl /opt/gnome/lib/libglib-2.0.so /usr/lib/libpcre.so /usr/lib/libgcrypt.so -L/usr/lib /usr/lib/libgpg-error.so ../wsutil/.libs/libwsutil.so -lm -lz  -pthread -Wl,-soname -Wl,libwireshark.so.0 -o .libs/libwireshark.so.0.0.1
dissectors/.libs/libdissectors.a(libdissectors_la-packet-tkcomcorbaapplication-idl.o): In function `plugin_reg_handoff':
/tmp/wireshark-1.2.0/epan/dissectors/packet-tkcomcorbaapplication-idl.c:512: multiple definition of `plugin_reg_handoff'
dissectors/.libs/libdissectors.a(libdissectors_la-packet-tkcomcorbaguiinstallation-idl.o):/tmp/wireshark-1.2.0/epan/dissectors/packet-tkcomcorbaguiinstallation-idl.c:565: first defined here
dissectors/.libs/libdissectors.a(libdissectors_la-packet-tkcomcorbaapplication-idl.o): In function `plugin_register':
/tmp/wireshark-1.2.0/epan/dissectors/packet-tkcomcorbaapplication-idl.c:505: multiple definition of `plugin_register'
dissectors/.libs/libdissectors.a(libdissectors_la-packet-tkcomcorbaguiinstallation-idl.o):/tmp/wireshark-1.2.0/epan/dissectors/packet-tkcomcorbaguiinstallation-idl.c:558: first defined here
dissectors/.libs/libdissectors.a(libdissectors_la-packet-tkcomcorbaapplication-idl.o): In function `proto_register_handoff_giop_tkcomcorbaapplication':
/tmp/wireshark-1.2.0/epan/dissectors/packet-tkcomcorbaapplication-idl.c:484: multiple definition of `version'
dissectors/.libs/libdissectors.a(libdissectors_la-packet-tkcomcorbaguiinstallation-idl.o):/tmp/wireshark-1.2.0/epan/dissectors/packet-tkcomcorbaguiinstallation-idl.c:537: first defined here
dissectors/.libs/libdissectors.a(libdissectors_la-packet-tkcomcorbaguiloginterest-idl.o): In function `plugin_reg_handoff':
/tmp/wireshark-1.2.0/epan/dissectors/packet-tkcomcorbaguiloginterest-idl.c:434: multiple definition of `plugin_reg_handoff'
dissectors/.libs/libdissectors.a(libdissectors_la-packet-tkcomcorbaguiinstallation-idl.o):/tmp/wireshark-1.2.0/epan/dissectors/packet-tkcomcorbaguiinstallation-idl.c:565: first defined here
dissectors/.libs/libdissectors.a(libdissectors_la-packet-tkcomcorbaguiloginterest-idl.o): In function `plugin_register':
/tmp/wireshark-1.2.0/epan/dissectors/packet-tkcomcorbaguiloginterest-idl.c:427: multiple definition of `plugin_register'
dissectors/.libs/libdissectors.a(libdissectors_la-packet-tkcomcorbaguiinstallation-idl.o):/tmp/wireshark-1.2.0/epan/dissectors/packet-tkcomcorbaguiinstallation-idl.c:558: first defined here
dissectors/.libs/libdissectors.a(libdissectors_la-packet-tkcomcorbaguiloginterest-idl.o): In function `proto_register_handoff_giop_tkcomcorbaguiloginterest': /tmp/wireshark-1.2.0/epan/dissectors/packet-tkcomcorbaguiloginterest-idl.c:406: multiple definition of `version'
dissectors/.libs/libdissectors.a(libdissectors_la-packet-tkcomcorbaguiinstallation-idl.o):/tmp/wireshark-1.2.0/epan/dissectors/packet-tkcomcorbaguiinstallation-idl.c:537: first defined here
dissectors/.libs/libdissectors.a(libdissectors_la-packet-tkcomcorbaprocesslist-idl.o): In function `plugin_reg_handoff':
/tmp/wireshark-1.2.0/epan/dissectors/packet-tkcomcorbaprocesslist-idl.c:3516: multiple definition of `plugin_reg_handoff'
dissectors/.libs/libdissectors.a(libdissectors_la-packet-tkcomcorbaguiinstallation-idl.o):/tmp/wireshark-1.2.0/epan/dissectors/packet-tkcomcorbaguiinstallation-idl.c:565: first defined here
dissectors/.libs/libdissectors.a(libdissectors_la-packet-tkcomcorbaprocesslist-idl.o): In function `plugin_register':
/tmp/wireshark-1.2.0/epan/dissectors/packet-tkcomcorbaprocesslist-idl.c:3509: multiple definition of `plugin_register'
dissectors/.libs/libdissectors.a(libdissectors_la-packet-tkcomcorbaguiinstallation-idl.o):/tmp/wireshark-1.2.0/epan/dissectors/packet-tkcomcorbaguiinstallation-idl.c:558: first defined here
dissectors/.libs/libdissectors.a(libdissectors_la-packet-tkcomcorbaprocesslist-idl.o): In function `proto_register_handoff_giop_tkcomcorbaprocesslist':
/tmp/wireshark-1.2.0/epan/dissectors/packet-tkcomcorbaprocesslist-idl.c:3468: multiple definition of `version'
dissectors/.libs/libdissectors.a(libdissectors_la-packet-tkcomcorbaguiinstallation-idl.o):/tmp/wireshark-1.2.0/epan/dissectors/packet-tkcomcorbaguiinstallation-idl.c:537: first defined here
dissectors/.libs/libdissectors.a(libdissectors_la-packet-tkcomcorbagui-idl.o): In function `plugin_reg_handoff':
/tmp/wireshark-1.2.0/epan/dissectors/packet-tkcomcorbagui-idl.c:434: multiple definition of `plugin_reg_handoff'
dissectors/.libs/libdissectors.a(libdissectors_la-packet-tkcomcorbaguiinstallation-idl.o):/tmp/wireshark-1.2.0/epan/dissectors/packet-tkcomcorbaguiinstallation-idl.c:565: first defined here
dissectors/.libs/libdissectors.a(libdissectors_la-packet-tkcomcorbagui-idl.o): In function `plugin_register':
/tmp/wireshark-1.2.0/epan/dissectors/packet-tkcomcorbagui-idl.c:427: multiple definition of `plugin_register'
dissectors/.libs/libdissectors.a(libdissectors_la-packet-tkcomcorbaguiinstallation-idl.o):/tmp/wireshark-1.2.0/epan/dissectors/packet-tkcomcorbaguiinstallation-idl.c:558: first defined here
dissectors/.libs/libdissectors.a(libdissectors_la-packet-tkcomcorbagui-idl.o): In function `proto_register_handoff_giop_tkcomcorbagui':
/tmp/wireshark-1.2.0/epan/dissectors/packet-tkcomcorbagui-idl.c:406: multiple definition of `version'
dissectors/.libs/libdissectors.a(libdissectors_la-packet-tkcomcorbaguiinstallation-idl.o):/tmp/wireshark-1.2.0/epan/dissectors/packet-tkcomcorbaguiinstallation-idl.c:537: first defined here
dissectors/.libs/libdissectors.a(libdissectors_la-packet-tkcomcorbaguiinterest-idl.o): In function `plugin_reg_handoff':
/tmp/wireshark-1.2.0/epan/dissectors/packet-tkcomcorbaguiinterest-idl.c:815: multiple definition of `plugin_reg_handoff'
dissectors/.libs/libdissectors.a(libdissectors_la-packet-tkcomcorbaguiinstallation-idl.o):/tmp/wireshark-1.2.0/epan/dissectors/packet-tkcomcorbaguiinstallation-idl.c:565: first defined here
dissectors/.libs/libdissectors.a(libdissectors_la-packet-tkcomcorbaguiinterest-idl.o): In function `plugin_register':
/tmp/wireshark-1.2.0/epan/dissectors/packet-tkcomcorbaguiinterest-idl.c:808: multiple definition of `plugin_register'
dissectors/.libs/libdissectors.a(libdissectors_la-packet-tkcomcorbaguiinstallation-idl.o):/tmp/wireshark-1.2.0/epan/dissectors/packet-tkcomcorbaguiinstallation-idl.c:558: first defined here
dissectors/.libs/libdissectors.a(libdissectors_la-packet-tkcomcorbaguiinterest-idl.o): In function `proto_register_handoff_giop_tkcomcorbaguiinterest':
/tmp/wireshark-1.2.0/epan/dissectors/packet-tkcomcorbaguiinterest-idl.c:787: multiple definition of `version'
dissectors/.libs/libdissectors.a(libdissectors_la-packet-tkcomcorbaguiinstallation-idl.o):/tmp/wireshark-1.2.0/epan/dissectors/packet-tkcomcorbaguiinstallation-idl.c:537: first defined here
collect2: ld returned 1 exit status
make[3]: *** [libwireshark.la] Error 1
make[3]: Leaving directory `/tmp/wireshark-1.2.0/epan'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/tmp/wireshark-1.2.0/epan'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/tmp/wireshark-1.2.0'
make: *** [all] Error 2
______________________
Este mensaje, y en su caso, cualquier fichero anexo al mismo,
 puede contener informacion clasificada por su emisor como confidencial
 en el marco de su Sistema de Gestion de Seguridad de la 
Informacion siendo para uso exclusivo del destinatario, quedando 
prohibida su divulgacion copia o distribucion a terceros sin la 
autorizacion expresa del remitente. Si Vd. ha recibido este mensaje 
 erroneamente, se ruega lo notifique al remitente y proceda a su borrado. 
Gracias por su colaboracion.
______________________
This message including any attachments may contain confidential 
information, according to our Information Security Management System,
 and intended solely for a specific individual to whom they are addressed.
 Any unauthorised copy, disclosure or distribution of this message
 is strictly forbidden. If you have received this transmission in error,
 please notify the sender immediately and delete it.
______________________