[ https://issues.apache.org/jira/browse/MINIFICPP-695?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16718915#comment-16718915 ]
ASF GitHub Bot commented on MINIFICPP-695: ------------------------------------------ Github user arpadboda commented on a diff in the pull request: https://github.com/apache/nifi-minifi-cpp/pull/459#discussion_r240994771 --- Diff: nanofi/examples/CMakeLists.txt --- @@ -50,11 +50,11 @@ if (WIN32) set(LINK_FLAGS "/WHOLEARCHIVE") set(LINK_END_FLAGS "") elseif (APPLE) - set(LINK_FLAGS "-Wl,-all_load") + set(LINK_FLAGS "") --- End diff -- Good spot, the change made it better and worse as well. I debugged cmake and found that the problem is caused by "unifying" beginning and ending argument of whole-archive. This means that in case multiple makefiles specifies them, only the first specification takes effect. As other platforms don't need closing argument, the issue is Linux-specific. This is the original linker command generated: ``` /usr/bin/c++ -std=c++11 -DOPENSSL_SUPPORT -std=c++11 -std=c++11 -O3 -DNDEBUG -rdynamic CMakeFiles/generate_flow.dir/generate_flow.c.o -o generate_flow ../libnanofi.a -lpthread -Wl,--whole-archive ../../extensions/http-curl/libminifi-http-curl.a -Wl,--no-whole-archive ../../libminifi/libminifi.a ../../libminifi/libcore-minifi.a ../../thirdparty/yaml-cpp-yaml-cpp-20171024/libyaml-cpp.a ../../extensions/expression-language/libminifi-expression-language-extensions.a ../../thirdparty/uuid/libuuid.a ../../extensions/expression-language/date/libtz.a -lcurl -ldl -lssl -lcrypto ../../extensions/civetweb/libminifi-civet-extensions.a ../../thirdparty/civetweb-1.10/src/libcivetweb.a -lpthread ../../thirdparty/civetweb-1.10/src/libcivetweb-cpp.a -l ``` Which is wrong as it only specifies whole-archive for libminifi-http-curl.a, but the processors are in liminifi.a, so they are stripped out. The first version of my change made it to the opposite: ``` /usr/bin/c++ -std=c++11 -DOPENSSL_SUPPORT -std=c++11 -std=c++11 -O3 -DNDEBUG -rdynamic CMakeFiles/generate_flow.dir/generate_flow.c.o -o generate_flow ../libnanofi.a -lpthread ../../extensions/http-curl/libminifi-http-curl.a -Wl,--whole-archive ../../libminifi/libminifi.a ../../libminifi/libcore-minifi.a ../../thirdparty/yaml-cpp-yaml-cpp-20171024/libyaml-cpp.a ../../extensions/expression-language/libminifi-expression-language-extensions.a ../../thirdparty/uuid/libuuid.a ../../extensions/expression-language/date/libtz.a -Wl,--no-whole-archive -lcurl -ldl -lssl -lcrypto ../../extensions/civetweb/libminifi-civet-extensions.a ../../thirdparty/civetweb-1.10/src/libcivetweb.a -lpthread ../../thirdparty/civetweb-1.10/src/libcivetweb-cpp.a -lz ``` In this case libminifi was fine, but libminifi-http-curl is left without whole-archive flag. With the current change: ``` /usr/bin/c++ -std=c++11 -DOPENSSL_SUPPORT -std=c++11 -std=c++11 -O3 -DNDEBUG -rdynamic CMakeFiles/generate_flow.dir/generate_flow.c.o -o generate_flow ../libnanofi.a -lpthread -Wl,--whole-archive ../../extensions/http-curl/libminifi-http-curl.a ../../libminifi/libminifi.a ../../libminifi/libcore-minifi.a ../../thirdparty/yaml-cpp-yaml-cpp-20171024/libyaml-cpp.a ../../extensions/expression-language/libminifi-expression-language-extensions.a ../../thirdparty/uuid/libuuid.a ../../extensions/expression-language/date/libtz.a -Wl,--no-whole-archive -lcurl -ldl -lssl -lcrypto ../../extensions/civetweb/libminifi-civet-extensions.a ../../thirdparty/civetweb-1.10/src/libcivetweb.a -lpthread ../../thirdparty/civetweb-1.10/src/libcivetweb-cpp.a -lz ``` This looks good, verified curl symbols as well. > NanoFi Examples appear to be broken > ----------------------------------- > > Key: MINIFICPP-695 > URL: https://issues.apache.org/jira/browse/MINIFICPP-695 > Project: NiFi MiNiFi C++ > Issue Type: Bug > Reporter: Mr TheSegfault > Assignee: Arpad Boda > Priority: Blocker > Labels: nanofi > > When testing recent changes the examples appear to not work due to a > mis-configuration of the client. Not sure when/what broke it specifically, > but we should ensure that examples function. -- This message was sent by Atlassian JIRA (v7.6.3#76005)