Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: Re: [Wireshark-dev] CMake -fPIC flag

From: Jose Pedro Oliveira <jpo@xxxxxxxxxxxx>
Date: Sat, 15 May 2010 21:12:27 +0100
Joerg,

On 2010-05-15 17:47, Joerg Mayer wrote:
> On Fri, May 14, 2010 at 09:37:22PM +0100, Bruno Matos wrote:
>> The -fPIC flag is missing in WIRESHARK_EXTRA_C_FLAGS variable.
>>
>> I didn't make the patch because it's too small, but I can do it if you  
>> want.
> 
> Interesting, it gets added automagically on my system:
> 
> cd /home/jmayer/work/wireshark/svn/build/wsutil && /usr/bin/gcc  -Dwsutil_EXPORTS -DHAVE_CONFIG_H -DPACKAGE=\"wireshark\" -DNEW_PACKET_LIST -D"_U_=__attribute__((unused))" -fPIC -I/home/jmayer/work/wireshark/svn/build -I/home/jmayer/work/wireshark/svn/trunk -I/home/jmayer/work/wireshark/svn/trunk/epan -I/home/jmayer/work/wireshark/svn/trunk/tools/lemon -I/home/jmayer/work/wireshark/svn/trunk/wiretap -I/usr/include/python2.6 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/glib-2.0/glib   -O2 -Wall -W -Wextra -Wdeclaration-after-statement -Wendif-labels -Wpointer-arith -Wno-pointer-sign -Warray-bounds -Wcast-align -Wformat-security -pedantic -Woverflow -Wlogical-op -Wno-overlength-strings -fstrict-overflow -Wstrict-overflow=4 -Wunreachable-code -Wunsafe-loop-optimizations -Wno-long-long -Wbad-function-cast -Wcast-qual -Waddress -Warray-boun
ds
>   -Wattributes -Wdiv-by-zero -Wformat-security -Wignored-qualifiers -Wpragmas -Wredundant-decls -Wvla -Wc++-compat -Wwrite-strings -Wstrict-prototypes -Wmissing-declarations -Wshadow -o CMakeFiles/wsutil.dir/privileges.c.o   -c /home/jmayer/work/wireshark/svn/trunk/wsutil/privileges.c
> /usr/bin/cmake -E cmake_progress_report /home/jmayer/work/wireshark/svn/build/CMakeFiles
> 
> Anything I'm missing here? Can you please provide a few more details on your
> system and your cmake options?

I believe Bruno was mentioning this problem that appears in
Fedora 12 x86_64 systems:

  System   : Fedora 12 x86_64 with updates
  Wireshark: svn revision 32819 (1.3.6 tobe)
  Building steps:
     mkdir Build; cd Build
     cmake ../                # all requirements expect YAPP
     make
----------
...
/usr/bin/ld: ../lib/libwslua.a(init_wslua.c.o): relocation R_X86_64_32
against `.rodata.str1.1' can not be used when making a shared object;
recompile with -fPIC
../lib/libwslua.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[2]: *** [lib/libwireshark.so] Error 1
make[2]: Leaving directory
`/home/fedora/rpms/BUILD/wireshark-1.3.6-SVN-32819/Build'
...
-----------


Regards,
jpo
-- 
Jos� Pedro Oliveira
* mailto:jpo@xxxxxxxxxxxx *