PLCnext on LinkedInPLCnext on Instagram  PLCnext on YouTube Github PLCnext CommunityStore PLCnext Community

Resolved curl

0
Votes
Undo
  1. nick-peeters
  2. PLCnext Technology & PLCnext Controls
  3. Wednesday, 18 November 2020

dear developer, 

i am trying to send an email using

 

I assume that i am doing something wrong.

by trying to compile the sample code : https://curl.se/libcurl/c/smtp-mail.html

 

It won't compile giving the folowing error in eclipse:

cmd.exe /c ""C:\Program Files\PHOENIX CONTACT\PLCnCLI 2020.0 LTS/plcncli.exe" generate code -p"C:/Users/hybride/eclipse-workspace/Email" -s"src""cmd.exe /c ""C:\Program Files\PHOENIX CONTACT\PLCnCLI 2020.0 LTS/plcncli.exe" generate code -p"C:/Users/hybride/eclipse-workspace/Email" -s"src""Generating all files with the 'code' generator for C:\Users\hybride\eclipse-workspace\Email.Successfully generated all files with the 'code' generator for C:\Users\hybride\eclipse-workspace\Email.

cmd.exe /c ""C:\Program Files\PHOENIX CONTACT\PLCnCLI 2020.0 LTS/plcncli.exe" generate config -p"C:/Users/hybride/eclipse-workspace/Email" -s"src""Generating all files with the 'config' generator for C:\Users\hybride\eclipse-workspace\Email.Successfully generated all files with the 'config' generator for C:\Users\hybride\eclipse-workspace\Email.
cmd.exe /c ""C:\Program Files\PHOENIX CONTACT\PLCnCLI 2020.0 LTS/plcncli.exe" build -p"C:/Users/hybride/eclipse-workspace/Email" -b Release"Requested build for targets AXCF2152,20.6.1.30859Starting build for target AXCF2152,20.6.1.30859Checking if CMake needs to be reconfigured...[cmake]: [cmake]: C:\Users\hybride\eclipse-workspace\Email\intermediate\cmake\AXCF2152,20.6.1.30859\Release>set PATH=C:\SDKs\AXCF2152\2020.6\sysroots\x86_64-pokysdk-mingw32\usr\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\PuTTY\;C:\Users\hybride\AppData\Local\Microsoft\WindowsApps; [cmake]: make[1]: Entering directory 'C:/Users/hybride/eclipse-workspace/Email/intermediate/cmake/AXCF2152,20.6.1.30859/Release'[cmake]: make[2]: Entering directory 'C:/Users/hybride/eclipse-workspace/Email/intermediate/cmake/AXCF2152,20.6.1.30859/Release'[cmake]: Scanning dependencies of target Email[cmake]: make[2]: Leaving directory 'C:/Users/hybride/eclipse-workspace/Email/intermediate/cmake/AXCF2152,20.6.1.30859/Release'[cmake]: make[2]: Entering directory 'C:/Users/hybride/eclipse-workspace/Email/intermediate/cmake/AXCF2152,20.6.1.30859/Release'[cmake]: [ 12%] Building CXX object CMakeFiles/Email.dir/intermediate/code/EmailComponentProgramProvider.cpp.o[cmake]: [ 25%] Building CXX object CMakeFiles/Email.dir/intermediate/code/EmailLibrary.meta.cpp.o[cmake]: In file included from C:/SDKs/AXCF2152/2020.6/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/bits/socket.h:27,[cmake]:                  from C:/SDKs/AXCF2152/2020.6/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/sys/socket.h:33,[cmake]:                  from C:/SDKs/AXCF2152/2020.6/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/curl/system.h:436,[cmake]:                  from C:/SDKs/AXCF2152/2020.6/sysroots/cortexa9t2hf-neon-pxc-linux-gnueabi/usr/include/curl/curl.h:38,[cmake]:                  from C:/Users/hybride/eclipse-workspace/Email/src/EmailProgram.hpp:8,[cmake]:                  from C:/Users/hybride/eclipse-workspace/Email/intermediate/code/EmailLibrary.meta.cpp:3:[cmake]: C:/Users/hybride/eclipse-workspace/Email/intermediate/code/EmailLibrary.meta.cpp: In member function 'void Email::EmailLibrary::InitializeTypeDomain()':[cmake]: C:/Users/hybride/eclipse-workspace/Email/intermediate/code/EmailLibrary.meta.cpp:21:44: warning: offsetof within non-standard-layout type 'Email::EmailProgram' is conditionally-supported [-Winvalid-offsetof][cmake]:    21 |                         { "send", offsetof(::Email::EmailProgram, send_mail), DataType::Boolean, "", sizeof(boolean), alignof(boolean), {  }, StandardAttribute::Input },[cmake]:       |                                            ^[cmake]: C:/Users/hybride/eclipse-workspace/Email/intermediate/code/EmailLibrary.meta.cpp:22:47: warning: offsetof within non-standard-layout type 'Email::EmailProgram' is conditionally-supported [-Winvalid-offsetof][cmake]:    22 |                         { "message", offsetof(::Email::EmailProgram, function_answer), DataType::StaticString, "", sizeof(StaticString<80>), alignof(StaticString<80>), {  }, StandardAttribute::Output },[cmake]:       |                                               ^[cmake]: C:/Users/hybride/eclipse-workspace/Email/intermediate/code/EmailLibrary.meta.cpp:23:46: warning: offsetof within non-standard-layout type 'Email::EmailProgram' is conditionally-supported [-Winvalid-offsetof][cmake]:    23 |                         { "places", offsetof(::Email::EmailProgram, place), DataType::Boolean | DataType::Array, "", sizeof(boolean), alignof(boolean), { 50 }, StandardAttribute::Output },[cmake]:       |                                              ^[cmake]: [ 37%] Building CXX object CMakeFiles/Email.dir/src/EmailProgram.cpp.o[cmake]: [ 50%] Linking CXX shared library libEmail.so[cmake]: c:/sdks/axcf2152/2020.6/sysroots/x86_64-pokysdk-mingw32/usr/bin/arm-pxc-linux-gnueabi/../../libexec/arm-pxc-linux-gnueabi/gcc/arm-pxc-linux-gnueabi/9.3.0/real-ld.exe: CMakeFiles/Email.dir/src/EmailProgram.cpp.o: in function `Email::EmailProgram::Execute()':[cmake]: EmailProgram.cpp:(.text+0x12): undefined reference to `curl_easy_init'[cmake]: c:/sdks/axcf2152/2020.6/sysroots/x86_64-pokysdk-mingw32/usr/bin/arm-pxc-linux-gnueabi/../../libexec/arm-pxc-linux-gnueabi/gcc/arm-pxc-linux-gnueabi/9.3.0/real-ld.exe: EmailProgram.cpp:(.text+0x2a): undefined reference to `curl_easy_setopt'[cmake]: c:/sdks/axcf2152/2020.6/sysroots/x86_64-pokysdk-mingw32/usr/bin/arm-pxc-linux-gnueabi/../../libexec/arm-pxc-linux-gnueabi/gcc/arm-pxc-linux-gnueabi/9.3.0/real-ld.exe: EmailProgram.cpp:(.text+0x36): undefined reference to `curl_easy_setopt'[cmake]: c:/sdks/axcf2152/2020.6/sysroots/x86_64-pokysdk-mingw32/usr/bin/arm-pxc-linux-gnueabi/../../libexec/arm-pxc-linux-gnueabi/gcc/arm-pxc-linux-gnueabi/9.3.0/real-ld.exe: EmailProgram.cpp:(.text+0x44): undefined reference to `curl_easy_setopt'[cmake]: c:/sdks/axcf2152/2020.6/sysroots/x86_64-pokysdk-mingw32/usr/bin/arm-pxc-linux-gnueabi/../../libexec/arm-pxc-linux-gnueabi/gcc/arm-pxc-linux-gnueabi/9.3.0/real-ld.exe: EmailProgram.cpp:(.text+0x4e): undefined reference to `curl_easy_setopt'[cmake]: c:/sdks/axcf2152/2020.6/sysroots/x86_64-pokysdk-mingw32/usr/bin/arm-pxc-linux-gnueabi/../../libexec/arm-pxc-linux-gnueabi/gcc/arm-pxc-linux-gnueabi/9.3.0/real-ld.exe: EmailProgram.cpp:(.text+0x5c): undefined reference to `curl_easy_setopt'[cmake]: c:/sdks/axcf2152/2020.6/sysroots/x86_64-pokysdk-mingw32/usr/bin/arm-pxc-linux-gnueabi/../../libexec/arm-pxc-linux-gnueabi/gcc/arm-pxc-linux-gnueabi/9.3.0/real-ld.exe: CMakeFiles/Email.dir/src/EmailProgram.cpp.o:EmailProgram.cpp:(.text+0x68): more undefined references to `curl_easy_setopt' follow[cmake]: c:/sdks/axcf2152/2020.6/sysroots/x86_64-pokysdk-mingw32/usr/bin/arm-pxc-linux-gnueabi/../../libexec/arm-pxc-linux-gnueabi/gcc/arm-pxc-linux-gnueabi/9.3.0/real-ld.exe: CMakeFiles/Email.dir/src/EmailProgram.cpp.o: in function `Email::EmailProgram::Execute()':[cmake]: EmailProgram.cpp:(.text+0x70): undefined reference to `curl_slist_append'[cmake]: c:/sdks/axcf2152/2020.6/sysroots/x86_64-pokysdk-mingw32/usr/bin/arm-pxc-linux-gnueabi/../../libexec/arm-pxc-linux-gnueabi/gcc/arm-pxc-linux-gnueabi/9.3.0/real-ld.exe: EmailProgram.cpp:(.text+0x7e): undefined reference to `curl_easy_setopt'[cmake]: c:/sdks/axcf2152/2020.6/sysroots/x86_64-pokysdk-mingw32/usr/bin/arm-pxc-linux-gnueabi/../../libexec/arm-pxc-linux-gnueabi/gcc/arm-pxc-linux-gnueabi/9.3.0/real-ld.exe: EmailProgram.cpp:(.text+0x8c): undefined reference to `curl_easy_setopt'[cmake]: make[2]: Leaving directory 'C:/Users/hybride/eclipse-workspace/Email/intermediate/cmake/AXCF2152,20.6.1.30859/Release'[cmake]: c:/sdks/axcf2152/2020.6/sysroots/x86_64-pokysdk-mingw32/usr/bin/arm-pxc-linux-gnueabi/../../libexec/arm-pxc-linux-gnueabi/gcc/arm-pxc-linux-gnueabi/9.3.0/real-ld.exe: EmailProgram.cpp:(.text+0x98): undefined reference to `curl_easy_setopt'[cmake]: c:/sdks/axcf2152/2020.6/sysroots/x86_64-pokysdk-mingw32/usr/bin/arm-pxc-linux-gnueabi/../../libexec/arm-pxc-linux-gnueabi/gcc/arm-pxc-linux-gnueabi/9.3.0/real-ld.exe: EmailProgram.cpp:(.text+0xa2): undefined reference to `curl_easy_setopt'[cmake]: c:/sdks/axcf2152/2020.6/sysroots/x86_64-pokysdk-mingw32/usr/bin/arm-pxc-linux-gnueabi/../../libexec/arm-pxc-linux-gnueabi/gcc/arm-pxc-linux-gnueabi/9.3.0/real-ld.exe: EmailProgram.cpp:(.text+0xac): undefined reference to `curl_easy_setopt'[cmake]: c:/sdks/axcf2152/2020.6/sysroots/x86_64-pokysdk-mingw32/usr/bin/arm-pxc-linux-gnueabi/../../libexec/arm-pxc-linux-gnueabi/gcc/arm-pxc-linux-gnueabi/9.3.0/real-ld.exe: EmailProgram.cpp:(.text+0xb2): undefined reference to `curl_easy_perform'[cmake]: make[1]: Leaving directory 'C:/Users/hybride/eclipse-workspace/Email/intermediate/cmake/AXCF2152,20.6.1.30859/Release'[cmake]: c:/sdks/axcf2152/2020.6/sysroots/x86_64-pokysdk-mingw32/usr/bin/arm-pxc-linux-gnueabi/../../libexec/arm-pxc-linux-gnueabi/gcc/arm-pxc-linux-gnueabi/9.3.0/real-ld.exe: EmailProgram.cpp:(.text+0xba): undefined reference to `curl_slist_free_all'[cmake]: c:/sdks/axcf2152/2020.6/sysroots/x86_64-pokysdk-mingw32/usr/bin/arm-pxc-linux-gnueabi/../../libexec/arm-pxc-linux-gnueabi/gcc/arm-pxc-linux-gnueabi/9.3.0/real-ld.exe: EmailProgram.cpp:(.text+0xc0): undefined reference to `curl_easy_cleanup'[cmake]: c:/sdks/axcf2152/2020.6/sysroots/x86_64-pokysdk-mingw32/usr/bin/arm-pxc-linux-gnueabi/../../libexec/arm-pxc-linux-gnueabi/gcc/arm-pxc-linux-gnueabi/9.3.0/real-ld.exe: EmailProgram.cpp:(.text+0xd8): undefined reference to `curl_easy_strerror'[cmake]: collect2.exe: error: ld returned 1 exit status[cmake]: make[2]: *** [CMakeFiles/Email.dir/build.make:182: libEmail.so] Error 1[cmake]: make[1]: *** [CMakeFiles/Makefile2:73: CMakeFiles/Email.dir/all] Error 2[cmake]: make: *** [Makefile:130: all] Error 2cmake process exited with error

 

what is causing the undefined refference?  Does it need cross compilation for eclipse (because of the limited 'standard' librari of curl) or What am I doing wrong? 

thanks in advance

 

kind regards Nick 

Oliver PLCnext Team Accepted Answer Pending Moderation
0
Votes
Undo

Hello Nick,

Did you modify the CMakeLists.txt to look for the new curl and setup linking?



1. Add Curl to your linked libraries in CmakeLists.txt (you probably need libcurl.so)
2. Build Plcnext project in eclipse

Check that the libcurl in the SDK also supports the feature you want to use.
SMTP is not build into the Curl lib that is included so you will need to rebuild Curl as well..

Something Like this For Crosscompiling:

git clone https://github.com/curl/curl.git


cd curl
git checkout tags/curl-7_69_1

source /opt/pxc/2152/2020.6/environment-setup-cortexa9t2hf-neon-pxc-linux-gnueabi
. /opt/pxc/2152/2020.6/site-config-cortexa9t2hf-neon-pxc-linux-gnueabi

mkdir install
./buildconf
./configure $CONFIGURE_FLAGS --enable-smtp --prefix="$(pwd)/install" ' --disable-*Allthat you dont realy need*
make
make install

ls -la


kind regards,
Oliver

Phoenix Contact Electronics Headquarter - PLCnext Runtime Product Management and Support

  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.