Telldus 2.1.2 fails to link on Synology DS1813+

Moderator: Telldus

Post Reply
LeprA
Posts: 21
Joined: Fri Mar 17, 2023 9:45 am

Telldus 2.1.2 fails to link on Synology DS1813+

Post by LeprA »

I have some problem while linking on this NAS (Synology DS1813+).

I am using this exports
export CFLAGS='-O3 -march=i686 -mtune=i686'
export CXXFLAGS='-O3 -march=i686 -mtune=i686'
export LD_CONFIG_PATH='/opt/lib:/opt/local/lib:/opt/i686-unknown-linux-gnu/lib:/lib:/usr/lib:/usr/local/lib'

Libs in use
libftdi.so.1.20.0
confuse - 2.7-2
libusb - 0.1.12-2

Output from the build:

Code: Select all

Synology> make -B
[  1%] Building CXX object common/CMakeFiles/TelldusCommon.dir/Event.cpp.o
[  3%] Building CXX object common/CMakeFiles/TelldusCommon.dir/Message.cpp.o
[  5%] Building CXX object common/CMakeFiles/TelldusCommon.dir/Mutex.cpp.o
[  7%] Building CXX object common/CMakeFiles/TelldusCommon.dir/Strings.cpp.o
[  9%] Building CXX object common/CMakeFiles/TelldusCommon.dir/Thread.cpp.o
[ 11%] Building CXX object common/CMakeFiles/TelldusCommon.dir/Event_unix.cpp.o
[ 13%] Building CXX object common/CMakeFiles/TelldusCommon.dir/EventHandler_unix.cpp.o
[ 15%] Building CXX object common/CMakeFiles/TelldusCommon.dir/Socket_unix.cpp.o
Linking CXX static library libTelldusCommon.a
[ 15%] Built target TelldusCommon
[ 17%] Building CXX object service/CMakeFiles/telldusd.dir/ClientCommunicationHandler.cpp.o
[ 19%] Building CXX object service/CMakeFiles/telldusd.dir/Controller.cpp.o
[ 21%] Building CXX object service/CMakeFiles/telldusd.dir/ControllerManager.cpp.o
[ 23%] Building CXX object service/CMakeFiles/telldusd.dir/ControllerMessage.cpp.o
[ 25%] Building CXX object service/CMakeFiles/telldusd.dir/Device.cpp.o
[ 27%] Building CXX object service/CMakeFiles/telldusd.dir/DeviceManager.cpp.o
[ 29%] Building CXX object service/CMakeFiles/telldusd.dir/Log.cpp.o
[ 31%] Building CXX object service/CMakeFiles/telldusd.dir/Sensor.cpp.o
[ 33%] Building CXX object service/CMakeFiles/telldusd.dir/Settings.cpp.o
[ 35%] Building CXX object service/CMakeFiles/telldusd.dir/TelldusMain.cpp.o
[ 37%] Building CXX object service/CMakeFiles/telldusd.dir/TellStick.cpp.o
[ 39%] Building CXX object service/CMakeFiles/telldusd.dir/Timer.cpp.o
[ 41%] Building CXX object service/CMakeFiles/telldusd.dir/EventUpdateManager.cpp.o
[ 43%] Building CXX object service/CMakeFiles/telldusd.dir/ConnectionListener_unix.cpp.o
[ 45%] Building CXX object service/CMakeFiles/telldusd.dir/main_unix.cpp.o
[ 47%] Building CXX object service/CMakeFiles/telldusd.dir/SettingsConfuse.cpp.o
[ 49%] Building CXX object service/CMakeFiles/telldusd.dir/TellStick_libftdi.cpp.o
[ 50%] Building CXX object service/CMakeFiles/telldusd.dir/Protocol.cpp.o
[ 52%] Building CXX object service/CMakeFiles/telldusd.dir/ProtocolBrateck.cpp.o
[ 54%] Building CXX object service/CMakeFiles/telldusd.dir/ProtocolComen.cpp.o
[ 56%] Building CXX object service/CMakeFiles/telldusd.dir/ProtocolEverflourish.cpp.o
[ 58%] Building CXX object service/CMakeFiles/telldusd.dir/ProtocolFineoffset.cpp.o
[ 60%] Building CXX object service/CMakeFiles/telldusd.dir/ProtocolFuhaote.cpp.o
[ 62%] Building CXX object service/CMakeFiles/telldusd.dir/ProtocolGroup.cpp.o
[ 64%] Building CXX object service/CMakeFiles/telldusd.dir/ProtocolHasta.cpp.o
[ 66%] Building CXX object service/CMakeFiles/telldusd.dir/ProtocolIkea.cpp.o
[ 68%] Building CXX object service/CMakeFiles/telldusd.dir/ProtocolMandolyn.cpp.o
[ 70%] Building CXX object service/CMakeFiles/telldusd.dir/ProtocolNexa.cpp.o
[ 72%] Building CXX object service/CMakeFiles/telldusd.dir/ProtocolOregon.cpp.o
[ 74%] Building CXX object service/CMakeFiles/telldusd.dir/ProtocolRisingSun.cpp.o
[ 76%] Building CXX object service/CMakeFiles/telldusd.dir/ProtocolSartano.cpp.o
[ 78%] Building CXX object service/CMakeFiles/telldusd.dir/ProtocolScene.cpp.o
[ 80%] Building CXX object service/CMakeFiles/telldusd.dir/ProtocolSilvanChip.cpp.o
[ 82%] Building CXX object service/CMakeFiles/telldusd.dir/ProtocolUpm.cpp.o
[ 84%] Building CXX object service/CMakeFiles/telldusd.dir/ProtocolWaveman.cpp.o
[ 86%] Building CXX object service/CMakeFiles/telldusd.dir/ProtocolX10.cpp.o
[ 88%] Building CXX object service/CMakeFiles/telldusd.dir/ProtocolYidong.cpp.o
Linking CXX executable telldusd
CMakeFiles/telldusd.dir/ClientCommunicationHandler.cpp.o: In function `__gnu_cxx::__exchange_and_add(int volatile*, int)':
ClientCommunicationHandler.cpp:(.text+0x84): undefined reference to `__sync_fetch_and_add_4'
CMakeFiles/telldusd.dir/Controller.cpp.o: In function `__gnu_cxx::__exchange_and_add(int volatile*, int)':
Controller.cpp:(.text+0x218): undefined reference to `__sync_fetch_and_add_4'
CMakeFiles/telldusd.dir/ControllerManager.cpp.o: In function `__gnu_cxx::__exchange_and_add(int volatile*, int)':
ControllerManager.cpp:(.text+0x72): undefined reference to `__sync_fetch_and_add_4'
CMakeFiles/telldusd.dir/DeviceManager.cpp.o: In function `__gnu_cxx::__exchange_and_add(int volatile*, int)':
DeviceManager.cpp:(.text+0x17e): undefined reference to `__sync_fetch_and_add_4'
CMakeFiles/telldusd.dir/TelldusMain.cpp.o: In function `__gnu_cxx::__exchange_and_add(int volatile*, int)':
TelldusMain.cpp:(.text+0x92): undefined reference to `__sync_fetch_and_add_4'
CMakeFiles/telldusd.dir/Timer.cpp.o:Timer.cpp:(.text+0x1dc): more undefined references to `__sync_fetch_and_add_4' follow
collect2: ld returned 1 exit status
make[2]: *** [service/telldusd] Error 1
make[1]: *** [service/CMakeFiles/telldusd.dir/all] Error 2
make: *** [all] Error 2
When googling on this linking problem they advice to set CFLAGS and CXXFLAGS but as you can see it still fails.

Anyone able to help me?
micke.prag
Site Admin
Posts: 2243
Joined: Fri Mar 17, 2023 9:45 am
Location: Lund
Contact:

Re: Telldus 2.1.2 fails to link on Synology DS1813+

Post by micke.prag »

I have never seen these issues before so my guesses might be as good as any.

To set CXXFLAGS it might not be enough to set them in the environment since cmake set its own. Try to set them in the cmake cache instead. There is a tool called ccmake you can use to alter cmake flags.
Micke Prag
Software
Telldus Technologies
LeprA
Posts: 21
Joined: Fri Mar 17, 2023 9:45 am

Re: Telldus 2.1.2 fails to link on Synology DS1813+

Post by LeprA »

micke.prag wrote:I have never seen these issues before so my guesses might be as good as any.

To set CXXFLAGS it might not be enough to set them in the environment since cmake set its own. Try to set them in the cmake cache instead. There is a tool called ccmake you can use to alter cmake flags.
You where right i needed to add this two lines in CMakeLists.txt
set ( CMAKE_CXX_FLAGS "-O3 -march=i686 -mtune=i686")
set ( CMAKE_C_FLAGS "-O3 -march=i686 -mtune=i686")

Thanks for the tip. :wave:
micke.prag
Site Admin
Posts: 2243
Joined: Fri Mar 17, 2023 9:45 am
Location: Lund
Contact:

Re: Telldus 2.1.2 fails to link on Synology DS1813+

Post by micke.prag »

I am glad to hear it solved the issue.

For future people with the same error:
You do not need to edit CMakeLists.txt. Its enough to set it in the cmake cache either by using ccmake or as parameters to cmake when the project is configured.
Micke Prag
Software
Telldus Technologies
LeprA
Posts: 21
Joined: Fri Mar 17, 2023 9:45 am

Re: Telldus 2.1.2 fails to link on Synology DS1813+

Post by LeprA »

Nicely done!

When are you going to post this short howto?
albin
Posts: 9
Joined: Fri Mar 17, 2023 9:45 am

Re: Telldus 2.1.2 fails to link on Synology DS1813+

Post by albin »

Had the same problem with Telldus 2.1.1 on Synology DS411+II. Must have spent 6h debugging this after accidentally upgrading the NAS (which apparently deleted my previous version of telldusd).

For me, the solution was to add this line to CMakeLists.txt:
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native -O3")

-march=i686 did not work! Also, without -O3 the binaries would be created but telldusd would immediately segfault when I tried to run it. With -O3 it worked.

V 2.1.2 didn't work at all, it complained about some integer being to large for the "long" type. Didn't bother to debug it further since 2.1.1 is enough for my needs.
albin
Posts: 9
Joined: Fri Mar 17, 2023 9:45 am

Re: Telldus 2.1.2 fails to link on Synology DS1813+

Post by albin »

Scratch that :P I do need 2.1.2 to get humidity support.

Managed to get around initial compilation problems of 2.1.2 with these instructions:
http://www.telldus.com/forum/viewtopic.php?t=4576

However, once compiled, "telldusd" always segfaults. Running a debugger only shows a very incomplete stack trace involving strcmp. Could not figure this out.

However, I realized now that the precompiled i386 binaries from http://download.telldus.com/debian/pool/unstable/ actually runs on the Synology DS411+II.... Most likely this is what I did last time and forgot about it.
So, for anyone else having the same problem with an Intel Synology NAS, just download the i386 binaries!
LeprA
Posts: 21
Joined: Fri Mar 17, 2023 9:45 am

Re: Telldus 2.1.2 fails to link on Synology DS1813+

Post by LeprA »

Hi again!

How did you use the debian files?

Any howto would be appreciated - Thanks!
Post Reply