Masahiko:

Great work.  Any chance you could apply your changes to the Makefile
and commit them?

[apologies if you're already familiar with this and I'm just being pedantic]
IMHO, The best way would be to include the MacOS specific flags in a
MacOS ifeq line, so something like
http://www.gnu.org/s/hello/manual/make/Conditional-Example.html

but conditioning off of:

ARCH=$(shell uname -s)
ifeq ($ARCH, Darwin)
 CFLAGS=....
else
 CFLAGS=...
end

If you could get this committed back into the mainline repository, I
think it could help many people.

Thanks,

- Rob
.



On Thu, Jul 28, 2011 at 10:59 PM, Masahiko Takahashi
<[email protected]> wrote:
> Hi Nick,
>
>> Unfortunately it seems like the makefile doesn't know how to link on
>> MacOS X.  You could volunteer to fix it.. :-)
>
> I found a way, so I volunteer.
>
> Background: Binary format of MacOSX is Mach-O whereas Linux's
> is ELF. I'm not sure MacOSX can handle ELF format, but a way
> I succeed was to compile the plug-in on MacOSX (in that case,
> compiler/gcc, pkg-config, glib2, gmodule, and so on are needed).
> Options for gcc/linker are also different. Here is a diff of
> Makefile. (I compile old OF plug-in source code in openflow.git
> and check with wireshark 1.6.1 for MacOSX)
>
> Hope this helps.
>
> ---
> Masahiko.
>
>
> $ diff Makefile{~,}
> 50c50
> < CFLAGS = $(INC_DIRS) -DHAVE_CONFIG_H -I$(WIRESHARK_SRC_DIR)
> -I/usr/local/include -I/usr/local/include -DINET6
> -D_U_=__attribute__\(\(unused\)\) -Wall -Wpointer-arith -g
> -I/usr/local/include -DXTHREADS -D_REENTRANT -DXUSE_MTSAFE_API -pthread
> -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/X11R6/include
> -I/usr/include/atk-1.0 -I/usr/include/pango-1.0 -I/usr/include/freetype2
> -I/usr/include/freetype2/config -I/usr/local/include/glib-2.0
> -I/usr/lib/glib-2.0/include -fPIC -DPIC $(ENDIAN) $(DISSECT_PORT)
> ---
>> CFLAGS = $(INC_DIRS) -DHAVE_CONFIG_H -I$(WIRESHARK_SRC_DIR)
>> -I/usr/local/include -I/usr/local/include -DINET6
>> -D_U_=__attribute__\(\(unused\)\) -Wall -Wpointer-arith -g
>> -I/usr/local/include -DXTHREADS -D_REENTRANT -DXUSE_MTSAFE_API -pthread
>> -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/X11R6/include
>> -I/usr/include/atk-1.0 -I/usr/include/pango-1.0 -I/usr/include/freetype2
>> -I/usr/include/freetype2/config -I/usr/local/include/glib-2.0
>> -I/usr/lib/glib-2.0/include -fPIC -DPIC $(ENDIAN) $(DISSECT_PORT)
>> -fno-common
> 52c52
> < LDFLAGS = -Wl,--rpath -Wl,/usr/local/lib -Wl,--rpath -Wl,/usr/local/lib
> -L/usr/local/lib -L$(WIRESHARK_SRC_DIR)/epan -L. -lgmodule-2.0 -ldl
> -lglib-2.0  -pthread -Wl,--export-dynamic -Wl,-soname -Wl,$(PLUGIN_NAME).so
> ---
>> LDFLAGS = -flat_namespace -undefined suppress -L/usr/local/lib
>> -L$(WIRESHARK_SRC_DIR)/epan -L. -lgmodule-2.0 -ldl -lglib-2.0 -pthread
> 57c57
> <       $(CC) -shared $(OBJS) $(LDFLAGS) -o $@
> ---
>>       $(CC) -bundle $(OBJS) $(LDFLAGS) -o $@
>
>
> On 7/27/11 1:40 PM, Nicholas Bastin wrote:
>>
>> On Wed, Jul 27, 2011 at 10:06, Alex Reimers<[email protected]>
>>  wrote:
>>>
>>> I was wondering if anyone has managed to get the Wireshark dissector
>>> working
>>> for OS X. I tried compiling it under Linux and then copying it to OS X
>>> but
>>> unfortunately I get this error:
>>> Couldn't load module
>>>
>>> /Applications/Wireshark.app/Contents/Resources/lib/wireshark/plugins/packet-openflow.so:
>>>
>>> dlopen(/Applications/Wireshark.app/Contents/Resources/lib/wireshark/plugins/packet-openflow.so,
>>> 10): no suitable image found.  Did find:
>>>
>>> /Applications/Wireshark.app/Contents/Resources/lib/wireshark/plugins/packet-openflow.so:
>>> unknown file type, first eight bytes: 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01
>>> 0x00
>>
>> Unfortunately it seems like the makefile doesn't know how to link on
>> MacOS X.  You could volunteer to fix it.. :-)
>>
>> --
>> Nick
>> _______________________________________________
>> openflow-discuss mailing list
>> [email protected]
>> https://mailman.stanford.edu/mailman/listinfo/openflow-discuss
>
> _______________________________________________
> openflow-discuss mailing list
> [email protected]
> https://mailman.stanford.edu/mailman/listinfo/openflow-discuss
>
_______________________________________________
openflow-discuss mailing list
[email protected]
https://mailman.stanford.edu/mailman/listinfo/openflow-discuss

Reply via email to