cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1357
Views
0
Helpful
11
Replies

YDK build from source fails with cross compile option

jkalaise
Cisco Employee
Cisco Employee

I am trying to install YDK 0.8.4 on alpine. I had installed SSH and GCC to compatible for YDK and had started ydk build from source option. At this point I am getting error as pasted below.

 

Could someone help on this? I had attached config.log with this post.

 

/ydk-gen/gen-api/cpp/ydk/build # cmake -DCMAKE_C_COMPILER=/root/GCC-7.1.0/bin/gcc -DCMAKE_CXX_COMPILER=/root/GCC-7.1.0/bin/g++ ..
Set libyang plugin installation directory to: lib/libyang
-- Configuring done
-- Generating done
-- Build files have been written to: /ydk-gen/gen-api/cpp/ydk/build
/ydk-gen/gen-api/cpp/ydk/build # make CC='/root/GCC-7.1.0/bin/gcc'
[ 6%] Built target project_libyang
[ 7%] Performing configure step for 'project_libnetconf'
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for pkg-config... /usr/bin/pkg-config
checking for pyang... yes
checking for xsltproc... yes
checking for host architecture... x86_64 is supported
checking for doxygen... doxygen
checking for rpmbuild... no
checking for greadlink... readlink
configure: WARNING: Try installing greadlink.
checking for libtool... yes
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... configure: error: in `/ydk-gen/gen-api/cpp/ydk/build/project_libnetconf/src/project_libnetconf':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
make[2]: *** [CMakeFiles/project_libnetconf.dir/build.make:109: project_libnetconf/src/project_libnetconf-stamp/project_libnetconf-configure] Error 1
make[1]: *** [CMakeFiles/Makefile2:105: CMakeFiles/project_libnetconf.dir/all] Error 2
make: *** [Makefile:163: all] Error 2

11 Replies 11

yangorelik
Spotlight
Spotlight

Hello jkalaise

The Linux Alpine is not supported platform. You are basically on your own to make it work. But I am sure it can be done. You probably need to play with environment, compiler parameters etc. in order to compile all the needed components. For your instance, you have some incompatibility with C-compiler. I suspect that your configuration process did not take right compiler. Please check location or soft links of the cc and c++ binaries; they should point to gcc and g++ respectively. 

I also wonder, why did you take YDK-0.8.4 for your installation, when new release of 0.8.5 is available, which fixed multiple issues in core components and generated API.

Yan Gorelik
YDK Solutions

Thank you for getting back Yan, Wishing you a very happy new year.

 

I did downloaded 0.8.5 only, but put it as 0.8.4. I did a manual install of GCC of version 5.5 and linked it as a version to use in my docker. cmake went through, however while doing make, I am hitting the below issue,

 

Scanning dependencies of target ydk
[ 51%] Building CXX object CMakeFiles/ydk.dir/src/bits.cpp.o
In file included from /ydk-gen/sdk/cpp/core/src/bits.cpp:29:0:
/ydk-gen/sdk/cpp/core/src/types.hpp:31:15: fatal error: map: No such file or directory
compilation terminated.
make[2]: *** [CMakeFiles/ydk.dir/build.make:275: CMakeFiles/ydk.dir/src/bits.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:254: CMakeFiles/ydk.dir/all] Error 2
make: *** [Makefile:183: all] Error 2

 

Attached the full log. Could you please help further.

bash-5.0# gcc --version
gcc (GCC) 5.5.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

bash-5.0# cc --version
cc (GCC) 5.5.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

bash-5.0# c++ --version
c++ (GCC) 5.5.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

bash-5.0# g++ --version
g++ (GCC) 5.5.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

 

Thanks,

Jasmine.K

Hi Jasmine

The fatal error appeared when compiler tried to load standard C++ header file map.h. It is possible that C++ standard header files were installed in non-standard location. Try to locate them and then set cmake environment variable CPLUS_INCLUDE_PATH to corresponding directory or list of directories. Example:

export CPLUS_INCLUDE_PATH=/usr/local/include:/opt/gcc/5.5.0/include

 

Yan Gorelik
YDK Solutions

Hi Yan,

 

Thank you, with your inputs I am inching close to the completion for it I believe. I had manually compiled GCC 5.5 on alpine linux., and that was missing many header files. I could not find clang (musl-dev) for 5.5 currently and hence included 0.7.3 version (gcc-7.3.0-x86_64-linux-musl.tar.xz) and thats throwing C++ error. Let me check for 5.5 version of this and if I include that, I hope I may be successful. Appreciate for your prolonged support.

 

export CPLUS_INCLUDE_PATH=/root/GCC-5.5.0/lib/gcc/x86_64-unknown-linux-gnu/5.5.0/plugin/include:/lib/gcc/x86_64-linux-musl/7.3.0/include:/x86_64-linux-musl/include/c++/7.3.0


[ 51%] Building CXX object CMakeFiles/ydk.dir/src/bits.cpp.o
[ 52%] Building CXX object CMakeFiles/ydk.dir/src/codec_provider.cpp.o
In file included from /ydk-gen/sdk/cpp/core/src/spdlog/details/log_msg.h:9,
from /ydk-gen/sdk/cpp/core/src/spdlog/sinks/sink.h:9,
from /ydk-gen/sdk/cpp/core/src/spdlog/sinks/base_sink.h:13,
from /ydk-gen/sdk/cpp/core/src/spdlog/logger.h:15,
from /ydk-gen/sdk/cpp/core/src/spdlog/spdlog.h:14,
from /ydk-gen/sdk/cpp/core/src/logger.hpp:23,
from /ydk-gen/sdk/cpp/core/src/codec_provider.cpp:28:
/ydk-gen/sdk/cpp/core/src/spdlog/details/os.h: In function 'std::__cxx11::string spdlog::details::os::errno_str(int)':
/ydk-gen/sdk/cpp/core/src/spdlog/details/os.h:389:58: error: no matching function for call to 'std::__cxx11::basic_string<char>::basic_string(int)'
389 | return std::string(strerror_r(err_num, buf, buf_size));
| ^
In file included from /x86_64-linux-musl/include/c++/7.3.0/string:52,
from /x86_64-linux-musl/include/c++/7.3.0/stdexcept:39,
from /x86_64-linux-musl/include/c++/7.3.0/array:39,
from /x86_64-linux-musl/include/c++/7.3.0/tuple:39,
from /x86_64-linux-musl/include/c++/7.3.0/bits/unique_ptr.h:37,
from /x86_64-linux-musl/include/c++/7.3.0/memory:80,

 

Regards,

Jasmine.K

Hi Jasmine

You are mixing two different compilers 5.5.0 and 7.3.0. This was not a good idea. Please stick to one or another version as their header files and libraries are different and can present conflicts.

Yan Gorelik
YDK Solutions

Hi Yan,

 

Used a precompiled one from https://github.com/just-containers/musl-cross-make/releases/download/v9/gcc-5.5.0-x86_64-linux-musl.tar.xz and had set CPLUS_INCLUDE_PATH=/lib/gcc/x86_64-linux-musl/5.5.0/include:/x86_64-linux-musl/include/c++/5.5.0:/usr/include

 

all the executables are pointing to 5.5 version now, however the alpine version 3.12 is natively having 0.9.3 GCC.

 

With this CMAKE went fine, however post that make failed at the below point,

 

-- Build files have been written to: /ydk-gen/sdk/cpp/core/build/project_libyang/src/project_libyang-build
[ 4%] Performing build step for 'project_libyang'
Scanning dependencies of target yang_static
[ 2%] Building C object CMakeFiles/yang_static.dir/src/common.c.o
In file included from /ydk-gen/sdk/cpp/core/build/project_libyang/src/project_libyang/src/common.c:29:0:
/ydk-gen/sdk/cpp/core/build/project_libyang/src/project_libyang/src/parser.h:18:18: fatal error: pcre.h: No such file or directory
compilation terminated.
make[5]: *** [CMakeFiles/yang_static.dir/build.make:83: CMakeFiles/yang_static.dir/src/common.c.o] Error 1
make[4]: *** [CMakeFiles/Makefile2:209: CMakeFiles/yang_static.dir/all] Error 2
make[3]: *** [Makefile:150: all] Error 2
make[2]: *** [CMakeFiles/project_libyang.dir/build.make:135: project_libyang/src/project_libyang-stamp/project_libyang-build] Error 2
make[1]: *** [CMakeFiles/Makefile2:145: CMakeFiles/project_libyang.dir/all] Error 2
make: *** [Makefile:183: all] Error 2

 

Tried many possibilities, however could not get this going on alpine. By any chance, do you have ydk8.5 on alpine environment?

 

Regards,

Jasmine.K

Hi Jasmine

Read the errors!

fatal error: pcre.h: No such file or directory

The compiler did not find the pcre.h header file. Either you did not install the pcre package or path were the file pcre.h is located is not in the CPLUS_INCLUDE_PATH or C_INCLUDE_PATH. Please define those environment variables to make all the installed header files visible for the Makefile.

Yan Gorelik
YDK Solutions

Hi Yan,

 

I have missed C_INCLUDE_PATH, I have added it and could move a bit from that error and hitting the below issue,

 

bash-5.0# env | grep INCLUDE
CPLUS_INCLUDE_PATH=/usr/include:/lib/gcc/x86_64-linux-musl/5.5.0/include:/x86_64-linux-musl/include/c++/5.5.0
C_INCLUDE_PATH=/usr/include:/lib/gcc/x86_64-linux-musl/5.5.0/include:/x86_64-linux-musl/include

 

bash-5.0# env | grep LD
LD_LIBRARY_PATH=/usr/lib:/usr/local/lib

 

bash-5.0# ls *pcre*
libpcre.a libpcre16.a libpcre2-8.so.0 libpcre32.a libpcrecpp.a libpcreposix.a
libpcre.so libpcre16.so libpcre2-8.so.0.10.0 libpcre32.so libpcrecpp.so libpcreposix.so
libpcre.so.1 libpcre16.so.0 libpcre2-posix.so.2 libpcre32.so.0 libpcrecpp.so.0 libpcreposix.so.0
libpcre.so.1.2.12 libpcre16.so.0.2.12 libpcre2-posix.so.2.0.3 libpcre32.so.0.0.12 libpcrecpp.so.0.0.2 libpcreposix.so.0.0.7

 

 

bash-5.0# make
[ 0%] Performing build step for 'project_libyang'
[ 61%] Built target yang_static
[ 63%] Linking C executable yangre
/lib/gcc/x86_64-linux-musl/5.5.0/../../../../x86_64-linux-musl/bin/ld: cannot find -lpcre
/lib/gcc/x86_64-linux-musl/5.5.0/../../../../x86_64-linux-musl/bin/ld: cannot find -lpcre
collect2: error: ld returned 1 exit status
make[5]: *** [CMakeFiles/yangre.dir/build.make:107: yangre] Error 1
make[4]: *** [CMakeFiles/Makefile2:128: CMakeFiles/yangre.dir/all] Error 2
make[3]: *** [Makefile:150: all] Error 2
make[2]: *** [CMakeFiles/project_libyang.dir/build.make:135: project_libyang/src/project_libyang-stamp/project_libyang-build] Error 2
make[1]: *** [CMakeFiles/Makefile2:145: CMakeFiles/project_libyang.dir/all] Error 2
make: *** [Makefile:183: all] Error 2

 

Regards,

Jasmine.K

Hi Jasmine

I only can guess that location of libpcre.a is not listed in the LD_LIBRARY_PATH.

Yan Gorelik
YDK Solutions

Hi Yan,

 

It is actually available on the path pointed my LD_LIBRARY

 

bash-5.0# env | grep LD
LD_LIBRARY_PATH=/usr/lib:/usr/local/lib
OLDPWD=/ydk-gen/sdk/cpp/core/build

 

bash-5.0# cd /usr/lib
bash-5.0# ls libpcre.a
libpcre.a
bash-5.0# ls libpcre.a

Hi Jasmine

I don't have the solution. If you find one, please share with community. I then can make appropriate changes in the YDK installation script and guide.

Thank you.

Yan Gorelik
YDK Solutions
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: