Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Compiling ohNet on FreeBSD
06-01-2015, 07:44 AM
Post: #21
RE: Compiling ohNet on FreeBSD
(05-01-2015 11:57 PM)simonc Wrote:  An empty implementation is exactly what you showed above - an ifdef/endif with nothing in between.

I presume this would mean that applications such as MinimServer couldn't detect interface changes on FreeBSD. Would it be be possible to add code to implement this functionality for FreeBSD? Are there any other aspects of the proposed FreeBSD changes that would remove other functionality?
Find all posts by this user
06-01-2015, 08:43 AM
Post: #22
RE: Compiling ohNet on FreeBSD
(06-01-2015 07:44 AM)simoncn Wrote:  I presume this would mean that applications such as MinimServer couldn't detect interface changes on FreeBSD.
Yes, that's correct. This could be inconvenient on a laptop that roamed between networks but would have minimal impact on a desktop with a wired connection. Perhaps unreasonably, I'd assumed a FreeBSD machine would likely fall into this latter category.

(06-01-2015 07:44 AM)simoncn Wrote:  Would it be be possible to add code to implement this functionality for FreeBSD?
In theory, yes. The OP said that (s)he wasn't a programmer at the start of the thread so I thought this might be too complicated a change for me to suggest. I don't have a FreeBSD machine to try something like this on; I'd be very happy to accept any tested patch however.

(06-01-2015 07:44 AM)simoncn Wrote:  Are there any other aspects of the proposed FreeBSD changes that would remove other functionality?
No. All other ohNet functionality would be present as normal.
Find all posts by this user
06-01-2015, 06:25 PM
Post: #23
Star RE: Compiling ohNet on FreeBSD
Regarding the discussion about the reduced functionality of ohnet on FreeBSD (detecting interface changes), I can add that at least in my usecase this will not matter. I plan to implement Minimserver on FreeNAS running within a jail (a poor-man's virtualisation/sandboxing technique of FreeBSD). The host OS will provide a virtual interface to the jail, which will not change and stay always up. First I also planned to building a plugin to easily install Minimserver on FreeNAS-installations (for the community). But as I learned in the FreeNAS-forum, the plugin-system with jails will probably be heavily modified in the next main-release (real virtualization instead of jails), so I will postpone that until this is clear.

Regarding bringing ohNet to compile, I did implement the suggested changes. There was still the following error happening:

Code:
gcc -o Build/Obj/Posix/Release/Os.o -c -fexceptions -Wall  -pipe -D_GNU_SOURCE -D_REENTRANT -DDEFINE_LITTLE_ENDIAN -DDEFINE_TRACE -g -O2 -fvisibility=hidden  -fPIC -DPLATFORM_FREEBSD -Werror -IBuild/Include/  Os/Posix/Os.c
Os/Posix/Os.c:67:1: error: "MSG_NOSIGNAL" redefined
In file included from Os/Posix/Os.c:23:
/usr/include/sys/socket.h:461:1: error: this is the location of the previous definition
Common.mak:421: recipe for target 'Build/Obj/Posix/Release/Os.o' failed
gmake: *** [Build/Obj/Posix/Release/Os.o] Error 1

I could fix that by just completely removing the line 67:

Code:
# define MSG_NOSIGNAL 0

After that, compilation seems to suceed and run through! Smile There is a problem left which I'm researching right now:

Code:
python bundle_binaries.py --system FreeBSD --architecture x86 --configuration Release
Please specify --system from one of Android, Core, Linux, Mac, Qnap, Windows, iOs.
Makefile:572: recipe for target 'bundle-after-build' failed
gmake: *** [bundle-after-build] Error 1

I tried removing the "--system" parameter alltogether, or replacing it with "Core", but neither worked. These are the possibilities:

Code:
python bundle_binaries.py --system Core --architecture x86 --configuration Release
Unrecognized target combination. Valid combinations are:
    --system Android --architecture anycpu --configuration Debug
    --system Android --architecture anycpu --configuration Release
    --system Core --architecture armv5 --configuration Debug
    --system Core --architecture armv5 --configuration Release
    --system Core --architecture armv6 --configuration Debug
    --system Core --architecture armv6 --configuration Release
    --system Core --architecture ppc32 --configuration Debug
    --system Core --architecture ppc32 --configuration Release
    --system Linux --architecture armel --configuration Debug
    --system Linux --architecture armel --configuration Release
    --system Linux --architecture armhf --configuration Debug
    --system Linux --architecture armhf --configuration Release
    --system Linux --architecture ppc32 --configuration Debug
    --system Linux --architecture ppc32 --configuration Release
    --system Linux --architecture x64 --configuration Debug
    --system Linux --architecture x64 --configuration Release
    --system Linux --architecture x86 --configuration Debug
    --system Linux --architecture x86 --configuration Release
    --system Mac --architecture x64 --configuration Debug
    --system Mac --architecture x64 --configuration Release
    --system Mac --architecture x86 --configuration Debug
    --system Mac --architecture x86 --configuration Release
    --system Qnap --architecture armel --configuration Debug
    --system Qnap --architecture armel --configuration Release
    --system Qnap --architecture x86 --configuration Debug
    --system Qnap --architecture x86 --configuration Release
    --system Windows --architecture x64 --configuration Debug
    --system Windows --architecture x64 --configuration Release
    --system Windows --architecture x86 --configuration Debug
    --system Windows --architecture x86 --configuration Release
    --system iOs --architecture armv6 --configuration Debug
    --system iOs --architecture armv6 --configuration Release
    --system iOs --architecture armv7 --configuration Debug
    --system iOs --architecture armv7 --configuration Release
    --system iOs --architecture x86 --configuration Debug
    --system iOs --architecture x86 --configuration Release

FreeBSD is not in that list. Do you have an idea?
Find all posts by this user
06-01-2015, 08:10 PM
Post: #24
RE: Compiling ohNet on FreeBSD
(06-01-2015 06:25 PM)airflow Wrote:  Regarding bringing ohNet to compile, I did implement the suggested changes. There was still the following error happening:

Code:
gcc -o Build/Obj/Posix/Release/Os.o -c -fexceptions -Wall  -pipe -D_GNU_SOURCE -D_REENTRANT -DDEFINE_LITTLE_ENDIAN -DDEFINE_TRACE -g -O2 -fvisibility=hidden  -fPIC -DPLATFORM_FREEBSD -Werror -IBuild/Include/  Os/Posix/Os.c
Os/Posix/Os.c:67:1: error: "MSG_NOSIGNAL" redefined
In file included from Os/Posix/Os.c:23:
/usr/include/sys/socket.h:461:1: error: this is the location of the previous definition
Common.mak:421: recipe for target 'Build/Obj/Posix/Release/Os.o' failed
gmake: *** [Build/Obj/Posix/Release/Os.o] Error 1

I could fix that by just completely removing the line 67:

Code:
# define MSG_NOSIGNAL 0

After that, compilation seems to suceed and run through! Smile

That line is important for our Mac builds. Can you ifdef it out for FreeBSD only please?

(06-01-2015 06:25 PM)airflow Wrote:  There is a problem left which I'm researching right now:

Code:
python bundle_binaries.py --system FreeBSD --architecture x86 --configuration Release
Please specify --system from one of Android, Core, Linux, Mac, Qnap, Windows, iOs.
Makefile:572: recipe for target 'bundle-after-build' failed
gmake: *** [bundle-after-build] Error 1
FreeBSD is not in that list. Do you have an idea?

I think you could fix that by adding the lines
Code:
BuildTarget("FreeBSD",   "x86",    "Debug"):   BuildInfo(builddir="Build/Obj/Posix/Debug"),
BuildTarget("FreeBSD",   "x86",    "Release"): BuildInfo(builddir="Build/Obj/Posix/Release"),
to the ALL_TARGETS block in bundle_binaries.py

Creating a bundle of build artifacts is optional for you build so don't worry too much if this doesn't fix it.

If you get a build working, the next step would be to test it out. You can do this using the AllTests.py script:
Code:
python AllTests.py --incremental --full --native
This'll build all native (production + test) code then execute all the tests. The script will stop if it encounters any failures. Once it runs to completion, your ohNet port will be complete!

When things are complete, I'll be happy to accept a patch to save you having to maintain a fork. You can either post the output of git diff or, better, submit a pull request against the github repo.
Find all posts by this user
07-01-2015, 11:03 AM
Post: #25
RE: Compiling ohNet on FreeBSD
(06-01-2015 07:44 AM)simoncn Wrote:  I presume this would mean that applications such as MinimServer couldn't detect interface changes on FreeBSD. Would it be be possible to add code to implement this functionality for FreeBSD? Are there any other aspects of the proposed FreeBSD changes that would remove other functionality?

From a quick look through the code, it seems that using the Linux version of struct InterfaceChangedObserver together with the Linux versions of SetInterfaceChangedObserver and DestroyInterfaceChangedObserver might work, which would enable the full ohNet functionality to be supported on FreeBSD. The would require changing the ifdefs as follows:

In line 1132, retain the original line:
#ifdef PLATFORM_MACOSX_GNU

In line 1155, retain the original line:
#if defined(PLATFORM_MACOSX_GNU) && !defined(PLATFORM_IOS)

In line 1258, retain the original line:
#ifndef PLATFORM_MACOSX_GNU

In line 1368, retain the original line:
#ifdef PLATFORM_MACOSX_GNU

In line 1380, retain the original line:
#ifndef PLATFORM_MACOSX_GNU

@airflow, could you try this to see if it compiles OK on FreeBSD?
Find all posts by this user
07-01-2015, 12:30 PM
Post: #26
RE: Compiling ohNet on FreeBSD
(06-01-2015 08:10 PM)simonc Wrote:  Creating a bundle of build artifacts is optional for you build so don't worry too much if this doesn't fix it.

After the changes, creating the bundle of build artifacts works, too.

Quote:If you get a build working, the next step would be to test it out. You can do this using the AllTests.py script:
Code:
python AllTests.py --incremental --full --native
This'll build all native (production + test) code then execute all the tests. The script will stop if it encounters any failures. Once it runs to completion, your ohNet port will be complete!

For the tests I had to modify the variable buildCmd to 'gmake ' in the file AllTests.py. The tests don't run completely through. A lot of them work, but at one point there are failures (the complete log is attached, here only the last part):

Code:
Starting Test Runner: SSDP discovery

Suite 1: Alive / ByeBye / Update

FAILURE: OpenHome/Net/Device/Tests/TestDviDiscovery.cpp:270

..
FAILURE: OpenHome/Net/Device/Tests/TestDviDiscovery.cpp:281

.
FAILURE: OpenHome/Net/Device/Tests/TestDviDiscovery.cpp:288

..
FAILURE: OpenHome/Net/Device/Tests/TestDviDiscovery.cpp:297

.
Suite 2: Msearches
....
FAILURE: Suite: 2 caused an unhandled exception: WriterError.  Exception thrown at:  File: OpenHome/Stream.cpp.  Line: 165
Last successful test: OpenHome/Net/Device/Tests/TestDviDiscovery.cpp:553

Finished Test Runner: SSDP discovery

10 of 15 tests passed.
5 of 15 tests failed.

Test TestDviDiscovery failed, aborting

Quote:When things are complete, I'll be happy to accept a patch to save you having to maintain a fork. You can either post the output of git diff or, better, submit a pull request against the github repo.

That's great, and I'll certainly do that as soon as everything works!

(07-01-2015 11:03 AM)simoncn Wrote:  [...suggested changes]
@airflow, could you try this to see if it compiles OK on FreeBSD?

Certainly, but I'll try that as soon I made the existing stuff to work (I don't want to change too much at the same time).


Attached File(s)
.txt  2015-01-07_fractal.txt (Size: 62.87 KB / Downloads: 5)
Find all posts by this user
08-01-2015, 05:14 PM
Post: #27
RE: Compiling ohNet on FreeBSD
(07-01-2015 12:30 PM)airflow Wrote:  The tests don't run completely through. A lot of them work, but at one point there are failures (the complete log is attached, here only the last part):

Code:
Starting Test Runner: SSDP discovery

Suite 1: Alive / ByeBye / Update

FAILURE: OpenHome/Net/Device/Tests/TestDviDiscovery.cpp:270

..
FAILURE: OpenHome/Net/Device/Tests/TestDviDiscovery.cpp:281

.
FAILURE: OpenHome/Net/Device/Tests/TestDviDiscovery.cpp:288

..
FAILURE: OpenHome/Net/Device/Tests/TestDviDiscovery.cpp:297

.
Suite 2: Msearches
....
FAILURE: Suite: 2 caused an unhandled exception: WriterError.  Exception thrown at:  File: OpenHome/Stream.cpp.  Line: 165
Last successful test: OpenHome/Net/Device/Tests/TestDviDiscovery.cpp:553

Finished Test Runner: SSDP discovery

10 of 15 tests passed.
5 of 15 tests failed.

Test TestDviDiscovery failed, aborting

These failures are to do with SSDP (the protocol used to advertise and/or discover UPnP devices). The cause for this is likely in your ohNet OS port (Os.c) but could also be the configuration of your VM.

In rough order, I'd try investigating the following:
  • Enable the code in OsNetworkSocketSetMulticastIf for PLATFORM_FREEBSD too.
  • Change OsNetworkBindMulticast to pass aAdapter as the second argument to OsNetworkBind (for PLATFORM_FREEBSD only).
  • Investigate whether your VM can send and receive multicast on both external and loopback adapters
Find all posts by this user
03-02-2015, 11:49 AM
Post: #28
Rainbow RE: Compiling ohNet on FreeBSD
(08-01-2015 05:14 PM)simonc Wrote:  These failures are to do with SSDP (the protocol used to advertise and/or discover UPnP devices). The cause for this is likely in your ohNet OS port (Os.c) but could also be the configuration of your VM.

In rough order, I'd try investigating the following:
  • Enable the code in OsNetworkSocketSetMulticastIf for PLATFORM_FREEBSD too.
  • Change OsNetworkBindMulticast to pass aAdapter as the second argument to OsNetworkBind (for PLATFORM_FREEBSD only).
  • Investigate whether your VM can send and receive multicast on both external and loopback adapters

Hello again!

I couldn't pursue this task for a little while due to time constraints. But today I finally could try out your suggestions - and already the first one (enabling the code in OsNetworkSocketSetMulticastIf for PLATFORM_FREEBSD too) did the trick. Everything compiles and the test-suite completes. I will now try to make MinimServer to work.

Code:
TestDvLpec - completed

Finished.  All tests passed
Start time: 12:25:21
Builds complete: 12:26:10
End time: 12:28:34

Simon, you mentioned earlier you'd like to incorporate the changes to the project so that others may also benefit and the compatibility of the code is increased (and I don't have to maintain a fork). You already pointed to instructions earlier about how to do that. I will do it later today.
Find all posts by this user
03-02-2015, 02:44 PM
Post: #29
Big Grin RE: Compiling ohNet on FreeBSD
I just submitted a pull request for the changes we did elaborate. I hope everything is alright... I omitted the changes I did for the file AllTests.py (change to gmake).

Thanks for all the great help in the process! Much appreciated! :-)

(07-01-2015 11:03 AM)simoncn Wrote:  From a quick look through the code, it seems that using the Linux version of struct InterfaceChangedObserver together with the Linux versions of SetInterfaceChangedObserver and DestroyInterfaceChangedObserver might work, which would enable the full ohNet functionality to be supported on FreeBSD. The would require changing the ifdefs as follows:

[...changes]

@airflow, could you try this to see if it compiles OK on FreeBSD?

@simoncn: I'd also like to implement your suggestions for full functionality, but I don't quite get them. In each line given you write "retain the original line", which means I shouldn't change it, should I? So what should I actually change? :-)
Find all posts by this user
03-02-2015, 06:07 PM
Post: #30
RE: Compiling ohNet on FreeBSD
(03-02-2015 02:44 PM)airflow Wrote:  @simoncn: I'd also like to implement your suggestions for full functionality, but I don't quite get them. In each line given you write "retain the original line", which means I shouldn't change it, should I? So what should I actually change? :-)

I meant that in all the places I mentioned, you should remove your change and retain the code as it is currently on Github.
Find all posts by this user


Forum Jump: