You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Attila Kalcsú <at...@gmail.com> on 2019/11/04 22:56:05 UTC

Qpid proton C++ static link

Hello,

I would like to static linking qpid proton c++ static libraries to my
executeable binary.

I've used the 'client' example codes to compile & build & run with static
lib linking.

---------------------------------------------------------------
command line
---------------------------------------------------------------

git clone https://github.com/apache/qpid-proton.git
cd qpid-proton
git checkout tags/0.29.0
mkdir _build
cd _build
cmake .. -DBUILD_WITH_CXX=ON -DBUILD_STATIC_LIBS=ON
make -j4
make install
sudo make install
sudo ldconfig

---------------------------------------------------------------

After these steps I found 3 qpid static library in the "/usr/local/lib/ "

-libqpid-proton-core-static.a

-libqpid-proton-proactor-static.a

-libqpid-proton-static.a


So I've created a CMakeLists.txt to link .a files:

---------------------------------------------------------------
Content of CMakeLists.txt:
---------------------------------------------------------------
add_executable (x main.cpp)

set(CMAKE_CXX_STANDARD 17)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -v -std=c++17 -lpthread
-static-libgcc -static-libstdc++ -fdiagnostics-color=auto")

include(ExternalProject)

add_library(qpid1 STATIC IMPORTED)
set_property(TARGET qpid1 PROPERTY IMPORTED_LOCATION
/usr/local/lib/libqpid-proton-core-static.a)
add_library(qpid2 STATIC IMPORTED)
set_property(TARGET qpid2 PROPERTY IMPORTED_LOCATION
/usr/local/lib/libqpid-proton-proactor-static.a)
add_library(qpid3 STATIC IMPORTED)
set_property(TARGET qpid3 PROPERTY IMPORTED_LOCATION
/usr/local/lib/libqpid-proton-static.a)

target_link_libraries(x qpid1 qpid2 qpid3)

---------------------------------------------------------------

But the result log is (snippets):

/usr/bin/ld: /home/pi/x/src/main.cpp:241: undefined reference to
`proton::container::run()'
/usr/bin/ld: /home/pi/x/src/main.cpp:241: undefined reference to
`proton::container::~container()'
/usr/bin/ld: /home/pi/x/src/main.cpp:241: undefined reference to
`proton::container::~container()'
/usr/bin/ld: CMakeFiles/x.dir/main.cpp.o: in function
`proton::endpoint::endpoint()':
/usr/local/include/proton/endpoint.hpp:67: undefined reference to `vtable
for proton::endpoint'
/usr/bin/ld: CMakeFiles/x.dir/main.cpp.o: in function
`proton::link::link()':
/usr/local/include/proton/link.hpp:49: undefined reference to `vtable for
proton::link'
/usr/bin/ld: CMakeFiles/x.dir/main.cpp.o: in function
`proton::receiver::receiver()':
/usr/local/include/proton/receiver.hpp:48: undefined reference to `vtable
for proton::receiver'
/usr/bin/ld: CMakeFiles/x.dir/main.cpp.o: in function
`proton::sender::sender()':
/usr/local/include/proton/sender.hpp:47: undefined reference to `vtable for
proton::sender'

...

/usr/bin/ld: /home/pi/x/src/main.cpp:212: undefined reference to
`proton::operator<<(std::ostream&, proton::value const&)'
/usr/bin/ld: /home/pi/x/src/main.cpp:218: undefined reference to
`proton::transfer::connection() const'
/usr/bin/ld: /home/pi/x/src/main.cpp:218: undefined reference to
`proton::connection::close()'
/usr/bin/ld: /home/pi/x/src/main.cpp:218: undefined reference to
`proton::connection::~connection()'
/usr/bin/ld: /home/pi/x/src/main.cpp:218: undefined reference to
`proton::connection::~connection()'

...

/usr/bin/ld:
CMakeFiles/x.dir/main.cpp.o:(.rodata._ZTV6client[_ZTV6client]+0x14):
undefined reference to
`proton::messaging_handler::on_container_stop(proton::container&)'
/usr/bin/ld:
CMakeFiles/x.dir/main.cpp.o:(.rodata._ZTV6client[_ZTV6client]+0x1c):
undefined reference to
`proton::messaging_handler::on_sendable(proton::sender&)'
/usr/bin/ld:
CMakeFiles/x.dir/main.cpp.o:(.rodata._ZTV6client[_ZTV6client]+0x20):
undefined reference to
`proton::messaging_handler::on_transport_open(proton::transport&)'
/usr/bin/ld:
CMakeFiles/x.dir/main.cpp.o:(.rodata._ZTV6client[_ZTV6client]+0x24):
undefined reference to
`proton::messaging_handler::on_transport_close(proton::transport&)'
/usr/bin/ld:
CMakeFiles/x.dir/main.cpp.o:(.rodata._ZTV6client[_ZTV6client]+0x28):
undefined reference to
`proton::messaging_handler::on_transport_error(proton::transport&)'
/usr/bin/ld:
CMakeFiles/x.dir/main.cpp.o:(.rodata._ZTV6client[_ZTV6client]+0x2c):
undefined reference to
`proton::messaging_handler::on_connection_open(proton::connection&)'
/usr/bin/ld:
CMakeFiles/x.dir/main.cpp.o:(.rodata._ZTV6client[_ZTV6client]+0x30):
undefined reference to
`proton::messaging_handler::on_connection_close(proton::connection&)'
/usr/bin/ld:
CMakeFiles/x.dir/main.cpp.o:(.rodata._ZTV6client[_ZTV6client]+0x34):
undefined reference to
`proton::messaging_handler::on_connection_error(proton::connection&)'

Thanks in advance

Zoltan Berge

<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Mentes
a vírusoktól. www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>