cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
89
Views
5
Helpful
2
Replies
Highlighted

Linking failure for tiny code using YDK-CPP

Hi !
Could you plz help me and point what am doing wrong ?

I compiled core ydk-cpp core , ydk-ietf and, ios-xr from source.
However during attempt of building of my tiny code I have huge amount of linker failures :

/usr/bin/x86_64-linux-gnu-g++-5 -g3 -std=c++11 -pthread \

    -L/usr/local/lib main.cpp output.o \

    -lydk -lydk_cisco_ios_xr -lydk_ietf -lpcre -ldl

(build log in attachement)

Tiny code is:

#include <iostream>
#include <memory>
#include "ydk/types.hpp"
#include "ydk/netconf_provider.hpp"
#include "ydk/crud_service.hpp"
#include <spdlog/spdlog.h>
#include "ydk_cisco_ios_xr/Cisco_IOS_XR_ipv4_bgp_cfg.hpp"
#include "ydk_cisco_ios_xr/Cisco_IOS_XR_ipv4_bgp_datatypes.hpp"
// #include "args_parser.h"

using namespace ydk;
using namespace cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_cfg;
using namespace cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_datatypes;
using namespace std;

int main(){
auto bgp = make_unique<Bgp>();
auto instance = make_unique<Bgp::Instance>();
auto instance_as = make_unique<Bgp::Instance::InstanceAs>();
instance_as->as = 65001;
instance->instance_as.append(move(instance_as));
bgp->instance.append(move(instance));
return 0;
}



What do I miss here ?

Thanks !

1 ACCEPTED SOLUTION

Accepted Solutions
Cisco Employee

Re: Linking failure for tiny code using YDK-CPP

Hi Alezandr

I suggest you to look at CMakeLists.txt in C++ samples. Here what we have for the linker:

target_link_libraries(${sample}
${ydk_location}
${ydk_openconfig_location}
${ydk_cisco_ios_xr_location}
${ydk_cisco_ios_xe_location}
${xml2_location}
${curl_location}
${ssh_location}
${ssh_threads_location}
${pcre_location}
${xslt_location}
${pthread_location}
${dl_location}
-rdynamic
)

First, add all the missing libraries and parameters.

Second, try to move the bundle library to the front; sometimes that helps.

Regards,

Yan

2 REPLIES 2
Cisco Employee

Re: Linking failure for tiny code using YDK-CPP

Hi Alezandr

I suggest you to look at CMakeLists.txt in C++ samples. Here what we have for the linker:

target_link_libraries(${sample}
${ydk_location}
${ydk_openconfig_location}
${ydk_cisco_ios_xr_location}
${ydk_cisco_ios_xe_location}
${xml2_location}
${curl_location}
${ssh_location}
${ssh_threads_location}
${pcre_location}
${xslt_location}
${pthread_location}
${dl_location}
-rdynamic
)

First, add all the missing libraries and parameters.

Second, try to move the bundle library to the front; sometimes that helps.

Regards,

Yan

Re: Linking failure for tiny code using YDK-CPP

That helped, Thanks !

Content for Community-Ad
August's Community Spotlight Awards
This widget could not be displayed.