SynoCommunity / spksrc

Cross compilation framework to create native packages for the Synology's NAS
https://synocommunity.com
Other
2.98k stars 1.22k forks source link

Domoticz #1041

Closed dbouchabou closed 9 years ago

dbouchabou commented 10 years ago

After the installation on my DS1512+ it is impossible to start the package. Error message: faill, file format invalid

remb0 commented 10 years ago

var/logs: Jun 3 08:53:20 Nas entry.cgi_SYNO.Core.Package.Control[1].start[27281]: pkgstartstop.cpp:121 Failed to start package domoticz Jun 3 08:53:22 Nas PkgMan.cgi: pkgtool.cpp:2005 Failed to query package status, domoticz

unheilig commented 10 years ago

hi all, on ds213 it's impossible to start the package. It looks like it's a compatibility issue related to DSM 5 Can anyone help finding a solution for Domoticz to work?

thanks

therealmko commented 10 years ago

I don't have a solution but I build a Domoticz package for my cedarview DS1812+. It installed but like reported here did not start. This is what is said in /var/log/messages. Unfortunately I can't find any more meaningful logs.

Jun 4 20:43:05 MiesStorage entry.cgi_SYNO.Core.Package.Installation[1].install[23710]: pkgtool.cpp:1450 Failed to exrtact package INFO to /volume1/@tmp/538F68B97653CC7A/ Jun 4 20:43:05 MiesStorage entry.cgi_SYNO.Core.Package.Installation[1].install[23710]: pkgtool.cpp:1451 /bin/tar xf /volume1/@tmp/upload_tmp.229410 -C /volume1/@tmp/538F68B97653CC7A/ INFO Jun 4 21:00:24 MiesStorage entry.cgi_SYNO.Core.Package.Control[1].start[2392]: pkgstartstop.cpp:121 Failed to start package domoticz ... Jun 4 21:08:44 XXX PkgMan.cgi: pkgtool.cpp:2052 Failed to query package status, domoticz

However I can manually start the binary, although connecting with a browser gives a 404 message, so it is not working properly in any case.

./domoticz -www 8085 -verbose 1 Domoticz V1.0.10 (c)2012-2013 GizMoCuz Startup Path: /volume1/@appstore/domoticz/bin/ Webserver started on port: 8085 Camera settings (re)loaded Incoming connection from: 192.168.x.x ^CClosing application!... stopping worker... Scheduler stopped... Camera fetch stopped... WebServer stopped... Mainworker Stopped...

ghost commented 10 years ago

Hello I try install Domoticz on my Synology DS713+ but i can not. I have a error: Can not run service packet and then Invalid file format.

Dr-Bean commented 10 years ago

This package doesn't work right now, regardless of DSM version, and will need some attention to get in working order again.

@Diaoul: Until we have time to work on it, maybe it's best to turn off distribution of this package? I don't know that it was originally shared on the old repo.

waveterm commented 10 years ago

Same issue on RS3412xs. I hope it gets fixed,as I'd love to give it a try :)

Diaoul commented 10 years ago

Yep, let's disable it. I don't have time to work on this yet, still working on the server side :)

Dr-Bean commented 10 years ago

Done, disabled. I might take a look at it, after sorting some other things out, at least just to get it running.

unheilig commented 10 years ago

thanks guys, we'd like you to fix it. it would be great to have a running version!

thank you

jorikcaljouw commented 10 years ago

Yeah, I also found that the package is missing lots of files. I'll do my best to see if I can create a version of the spk that works correctly. Don't hold your breath though, it may take quite some time for me to understand all the necessary steps to make this work ;-) (the www folder is for instance missing from the package, which explains the 404 I think)

unheilig commented 10 years ago

that would be definitely great! thank you for all your time... please keep us updated :)

jorikcaljouw commented 10 years ago

Just a quick note. Making pretty good progress. I have overcome some issues with compiling and running. Although I'm not sure I found the best solution for all of them, I think I should be able to make some packages available for x86 (my own DS411+II uses x86 arch) by the end of the week for testing purposes. edit: I'm using r1801 from the domoticz repository (currently latest revision)

Diaoul commented 10 years ago

Submit a pull request instead of distributing your own package. A bad package can screw up the system prety bad so it's best to have it reviewed.

jorikcaljouw commented 10 years ago

Thanks, I'll do that instead! I will probably have a couple of questions as to the best way to workaround a certain issue, I'll make sure to put those in the pull request ;-)

unheilig commented 10 years ago

Guys, I own a DS213, it's a marwel kirkwood processor. do you think it will be available also for that kind of processor?

thanks

remb0 commented 10 years ago

when the package is good it can be compiled for every CPU.

maybe gizmocuz (creator of domoticz) can help with the compile issues?

Diaoul commented 10 years ago

There are no compile issue with domoticz. The package I created basically just contains the binary. @Dr-Bean built all archs successfully. The only issue, from what I understand, is that the package doesn't ship the html pages for the webui so when one attempts to access the web interface, domoticz crashes.

jorikcaljouw commented 10 years ago

I have no reason to think that there will be issues with compiling for other archs.

BTW, the issues I found so far (and I am using r1801) are the following

  1. I am using cmake from Ubuntu 12.04 and it thinks that boost libraries should have -mt added, but if the boost libraries are built, they do not have -mt as a postfix. This page indicates that this has to do with threadsafety: http://www.boost.org/doc/libs/1_55_0/more/getting_started/unix-variants.html#library-naming But I have also found other references that state, that newer boost-version do not use the -mt postfix anymore. I'm not sure what is correct here. I "fixed" FindBoost.cmake on my system, but I don't think that is the best solution for this. Maybe we should create symlinks after building boost? (like e.g. Ubuntu itself does?)
  2. cross/curl is a dependency for domoticz
  3. the include-boost.patch in cross/domoticz cannot be applied for r1801 and does not seem to be necessary anymore
  4. domoticz-r1801/hardware/Teleinfo.cpp has a unicode BOM, which does not appear to be a problem for the build-tools in ubuntu 12.04, but the toolchain that is used for x86, chokes on it. So I had to remove the BOM for compiling Teleinfo.cpp. This should probably be fixed upstream, though.
  5. Then indeed the www-folder should be included in the package and the starting-script can then point the -wwwroot input argument to where the www-folder is stored. (I don't think we should put it inside a www-subdirectory of where the binary is located, which is where domoticz expects it to be by default).
Diaoul commented 10 years ago

3 You can make a patch for this until it's fixed upstream 4 If there is a compile-time option for this, I think it's better to use it rather than having an argument in the starting script.

I advise you to test compilation on ARM architectures rather than x86. With x86 there is a small chance that your system libraries are picked instead of the compiled ones.

unheilig commented 10 years ago

Hi guys, any news on this? thank you very much for your work...

jorikcaljouw commented 10 years ago

Yes, sorry this is taking a bit longer than I hoped. Still working on it, but had very limited time last week. Hope to get a bit further and work on the suggestions given above this week :).

jorikcaljouw commented 10 years ago

Pull request https://github.com/SynoCommunity/spksrc/pull/1098 created. If there are issues with linking against boost, you may need to update cmake. An alternative is to create symlinks for the -mt names of boost libraries. I was able to correctly compile arch-88f6281 and arch-x86 and since I only have a DS411+II, I could only test the x86 package. This package does NOT use/depend on openzwave (yet).

Diaoul commented 10 years ago

I added a few comments on the PR

jorikcaljouw commented 10 years ago

Hi Diaoul, thanks for the comments/improvements! (Not sure if I should ask for your help here or if it's better in the PR).

One of your comments is to copy the binary to install/bin and set the path to include the bin directory instead of the root of the install_dir. I actually copied the binary to the root of the package folder, because that is also the location of the domoticz binary as being used upstream.

If I would put the binary file in /bin (which seems to be the best location!), then I would need to add source-code patches, to fix relative path changes in the source code. I thought it would be best to limit the changes to the source code as much as possible.

Can you advise me what is the best solution here?

  1. keep the binary in the root of install as it is is now or
  2. add patches to the source code and copy the binary to /bin or
  3. put the binary in /bin and add a symlink to the root and only start it from the symlink?

Thanks! Jorik

jorikcaljouw commented 10 years ago

Until further advise on the binary location, I'm keeping the domoticz binary in install_dir. I have committed some more changes (including update to rev 1809 which resolves the Unicode BOM from upstream).

Diaoul commented 10 years ago

No compile time option to change this behavior?

jorikcaljouw commented 10 years ago

I have just created a topic for this in the domoticz forum. I could not find an option, but the project uses CMake, I am not very familiar with this makefile generator, so it might already be possible compile-time.

jorikcaljouw commented 10 years ago

I'm one step further. There is now an -approot command line option that specifies the root that contains a bunch of other files/folders. Because of this the domoticz binary can now be stored in /bin.

I do have another question: I used port 8084 (as it is unclaimed in the synology ports wiki), is this ok? And can it be listed there such that no other App will use it? Or should I create a separate Issue for this?

I have a couple of other things I want to add to the package, but the package should work quite well already :)

  1. (I should be able to add this pretty soon) add an icon to the main menu and an URL to open domoticz from DSM directly
  2. add openzwave as a dependency as a cross/openzwave addition. Not sure how easy or difficult this will be. But since I want to use my Synology for openzwave, really looking forward to getting this to work as well!
jorikcaljouw commented 10 years ago

And 1. is done (it is now accessible as a regular package/app in DSM) and domoticz is now also running as the domoticz user instead of as root :)

If somebody could look into my pull request I'd be happy to make other changes if necessary.

unheilig commented 10 years ago

hi jorikcaljouw, are you saying that it has been deployed on the synocommunity source (i.e.: are we able to install it on DSM 5.0?)

thank you for your work!

jorikcaljouw commented 10 years ago

Sorry, not meant to confuse anybody. This is not (yet) in the SynoCommunity repository. I do have a pull request in place. So once one of the SynoCommunity maintainers approves it, it will be in the source and then the packages should be made available (although I'm not sure exactly how and how fast that works). If you can't wait for that you could build the package yourself from my fork: https://github.com/jorikcaljouw/spksrc Following the steps in the README was quite straightforward. I use an Ubuntu 12.04-based virtual machine for this. I did have to patch FindBoost from cmake. As Diaoul mentioned, I am not going to put my packages available for everybody here to download, but if you want I can make a package available for you. Of course with a disclaimer that although I have not deliberately put anything harmful in the package, I have not tested it extensively. ;-)

edit: While the package is being built with the DSM4 toolchain (as are all packages in SynoCommunity repository if I'm not mistaken), it works perfectly fine on my DS411+II with DSM5.

unheilig commented 10 years ago

that's a great news! ok I would love to try the package you'd build, in somehow it could represent some kind of testing for me! what kind of information do you need in order to compile the package? I own a DS213 (marvel kirkwood), running DSM 5.0

and, thank you again for all your work!

jorikcaljouw commented 10 years ago

I actually already compiled a version into a package for the 88f6282-architecture (which is what your DS213 is using according to the wiki) for testing the compilation stage. Will do some testing with @unheilig on this platform.

ghost commented 10 years ago

Can you compile to cedarview - DS713+ and ARM 88f6281 DS210J and DS211J ? I will test it.

remb0 commented 10 years ago

I can test it also!

jorikcaljouw commented 10 years ago

I'm sorry, but at this point I think it is best to perform some additional testing with unheilig only. If all goes well, it should be accepted in the SynoCommunity repository soon, so then it should be available from the package repository. :-)

steef84 commented 10 years ago

tried crosscompile for arch-qoriq (ds213+) with your fork, it compiled for 100% without errors. Then I manually installed package. It got the error cannot start package. Manually starting works through ssh, but still www folder etc is missing. Keep following this issue closely and hopefully the testing with Unheulig will reveal / fix it :). Keep u the good work

jorikcaljouw commented 10 years ago

@steef84, did you checkout my forked repository with the updateDomoticz branch? Since the pull request is not yet accepted, SynoCommunity/spksrc does not contain my modifications.

steef84 commented 10 years ago

@jorikcaljouw apparently using git clone https://github.com/jorikcaljouw/spksrc.git won't get your custom changes. Will look into how to "checkout your forked repository". will report back

jorikcaljouw commented 10 years ago

Can you try git clone -b updateDomoticz [etc...] ?

steef84 commented 10 years ago

@jorikcaljouw thanks it worked perfectly. Compiled with your fixes and package is now up and running on qoriq. Setup rfxcom with the right ftdi drivers and testing began. Will report back..

steef84 commented 10 years ago

The package ran for 3 days now, I encountered no problems yet. Events working, Timers working.. package starts after reboot. So far so good as it seems. I already migrated from pi to syno :)

jorikcaljouw commented 10 years ago

Thanks for the feedback :).

jorikcaljouw commented 10 years ago

@steef84, do you see the Domoticz application in the Applications menu? @unheilig is unable to see the icon there, but it does show up correctly for me. He is also having some issues with email setup, but that is also working correctly for me.

steef84 commented 10 years ago

Yes i have the icon visible, clicking on it opens domoticz. Its working here as it supposed to do. Ive just tested an gmail account and the test mail is received correctly. Also my NMA notifications working great. . No issues so far.

unheilig commented 10 years ago

hi @steef84, do you have an intel based DS or what?

steef84 commented 10 years ago

I own an DS213+, Freescale QorIQ P1022 ppc CPU

unheilig commented 10 years ago

still thinking it's related to the specific Marvel-kirkwood compiled version. any ideas about email configuration (for notification), guys? thank you

Schim9 commented 9 years ago

Hello,

@jorikcaljouw : How did you fixe the FindBoost.cmake error ? Would you mind providing me with an example of commands ? I have done : cd /usr/lib ln -s libboost_thread.so libboost_thread-mt.so ln -s libboost_system.so libboost_system-mt.so ln -s libboost_date_time.so libboost_date_time-mt.so

But I still have this error :


The following Boost libraries could not be found: boost_thread boost_date_time boost_system


When I do cd domoticz cmake CMakeLists.txt

Your help would be very appreciated.

Thanks in advance

Eric

jorikcaljouw commented 9 years ago

Hi @Schim57300,

Since with spksrc we're cross-compiling for the Synology architecture target platform, any changes you make to the shared objects for your host system will not affect the compilation.

If you would like to create symlinks for this, you could possibly do this in one of the Makefiles after compilation of the boost libraries.

Since I believe this was a change in the boost libraries naming convention and the FindMake on my ubuntu system was relatively old, I decided to update FindBoost.cmake to accept to find libboost without -mt.

On Ubuntu 12.04, the file you need to edit is: /usr/share/cmake-2.8/Modules/FindBoost.cmake

Since cmake is used on the host platform for making the Makefile and we're not building cmake as part of the package creation process, changing this on your host computer does affect the building of the applications for the Synology platform.

Hope this helps. I'm not 100% sure what change I made to FindBoost.cmake, apparently I did not create a copy before changing (oops). But I do see the following lines. I probably added some comments (#).

#  set (_boost_MULTITHREADED "-mt")
#  if( NOT Boost_USE_MULTITHREADED )
    set (_boost_MULTITHREADED "")
#  endif()
  if(Boost_DEBUG)
    message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
      "_boost_MULTITHREADED = ${_boost_MULTITHREADED}")
  endif()