aristanetworks / EosSdk

EOS SDK - write native apps for your Arista switch
https://github.com/aristanetworks/EosSdk/wiki
BSD 3-Clause "New" or "Revised" License
156 stars 40 forks source link

bulid EosSdk fail on ubuntu #39

Closed chency closed 7 years ago

chency commented 7 years ago

root@ubuntu:/home/ccyuan/project/eos-sdk# ./build.sh checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... /bin/mkdir -p checking for gawk... no checking for mawk... mawk checking whether make sets $(MAKE)... yes checking whether make supports nested variables... yes checking how to create a pax tar archive... gnutar ./configure: line 2513: syntax error near unexpected token disable-static' ./configure: line 2513:LT_INIT(disable-static)' root@ubuntu:/home/ccyuan/project/eos-sdk# sudo ./build.sh checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... /bin/mkdir -p checking for gawk... no checking for mawk... mawk checking whether make sets $(MAKE)... yes checking whether make supports nested variables... yes checking how to create a pax tar archive... gnutar ./configure: line 2513: syntax error near unexpected token disable-static' ./configure: line 2513:LT_INIT(disable-static)'

aclocal root@ubuntu:/home/ccyuan/project/eos-sdk# autoconf root@ubuntu:/home/ccyuan/project/eos-sdk# automake --add-missing Makefile.am:1: error: Libtool library used but 'LIBTOOL' is undefined Makefile.am:1: The usual way to define 'LIBTOOL' is to add 'LT_INIT' Makefile.am:1: to 'configure.ac' and run 'aclocal' and 'autoconf' again. Makefile.am:1: If 'LT_INIT' is in 'configure.ac', make sure Makefile.am:1: its definition is in aclocal's search path. Makefile.am:74: warning: source file '$(srcdir)/eossdk_wrap.cpp' is in a subdirectory, Makefile.am:74: but option 'subdir-objects' is disabled automake: warning: possible forward-incompatibility. automake: At least a source file is in a subdirectory, but the 'subdir-objects' automake: automake option hasn't been enabled. For now, the corresponding output automake: object file(s) will be placed in the top-level directory. However, automake: this behaviour will change in future Automake versions: they will automake: unconditionally cause object files to be placed in the same subdirectory automake: of the corresponding sources. automake: You are advised to start using 'subdir-objects' option throughout your automake: project, to avoid future incompatibilities. Makefile.am:63: warning: source file 'examples/HelloWorld.cpp' is in a subdirectory, Makefile.am:63: but option 'subdir-objects' is

root@ubuntu:/home/ccyuan/project/eos-sdk# cat /proc/version Linux version 4.10.0-28-generic (buildd@lgw01-22) (gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4) ) #32~16.04.2-Ubuntu SMP Thu Jul 20 10:19:13 UTC 2017

ruferp commented 7 years ago

N.B. I tried Ubuntu 14.4 (where it works)

chency commented 7 years ago

32bits? I tried on Ubuntu 12.04、16.04 , but faild again and again!

tsuna commented 7 years ago

Sounds like you either forgot to run libtool or it's not installed?

./configure: line 2513: syntax error near unexpected token `disable-static'
./configure: line 2513: `LT_INIT(disable-static)'

Instead of running the autotools manually can you make sure libtool is installed and just run autoreconf -fvi and then try running ./build.sh again?

ruferp commented 7 years ago

Note that there are differences in what comes pre-packaged in different Ubuntu versions, or if you use the desktop or server version.

For reference, below is my cookbook, using 14.04.5 Ubuntu 64 bits: (note that the EosSdk stubs from github have no Makefile, the ones from the arista software-download page do, so that explains why autoconf is not always needed...).

> cat install_xgcc
wget http://mirror.pnl.gov/releases/14.04.5/ubuntu-14.04.5-server-amd64.iso
create/start VM, login
   sudo apt-get install -y ssh
   /etc/init.d/ssh start
   ifconfig eth0 # find ip address
on host
   ip=172.16.248.233
   username=prufer
   scp arista-fc18-gcc4-9-2.deb $username@$ip:/home/$username
   scp install_xgcc $username@$ip:/home/$username/n
   ssh $username@$ip
   cat n
   sudo apt-get install -y vim
   sudo apt-get install -y make
   sudo apt-get install -y libc6:i386  # cross-compiler is 32 bit binary
   sudo apt-get install -y zlib1g-dev:i386  # cross-compiler is 32 bit and needs libz.so
   sudo dpkg -i arista-fc18-gcc4-9-2.deb
   # get and compile the EosSdk stubs (libeos.so + development header files)
   wget https://github.com/aristanetworks/EosSdk/archive/v1.12.3.tar.gz # or from https://www.arista.com/en/support/software-download
   tar -xzvf v1.12.3.tar.gz
   cd EosSdk-1.12.3/  # stubs from software-download-page extract to EosSdk-stubs-1.12.3
   sudo apt-get install -y autoconf # needed with stubs from github (Makefile.in not included)
   sudo apt-get install -y libtool  # needed with stubs from github
   autoreconf -fvi                  # needed with stubs from github
   PATH=/opt/arista/fc18-gcc4.9.2/bin:$PATH ./build.sh >& build.log; echo $?
   sudo make install # not really needed for this demo
   # demo HelloWorld was compiled with the stubbed libeos.so, try it out on the EOS switch
   scp .libs/HelloWorld root@ol422:/tmp
   ssh admin@ol422
on EOS switch "ol422"
   ol422>en
   # create brute-force mount-profile that mounts everything an EosSdk app might ever need
   ol422#bash
   [admin@ol422 ~]$ sudo su
   bash-4.3# cp /usr/lib/SysdbMountProfiles/EosSdkAll /usr/lib/SysdbMountProfiles/HelloWorld
   bash-4.3# sed -i '1s/EosSdk/HelloWorld/' /usr/lib/SysdbMountProfiles/HelloWorld
   bash-4.3# exit
   [admin@ol422 ~]$ exit
   # configure and test the HelloWorld agent
   ol422#configure
   ol422(config)#daemon d1
   ol422(config-daemon-d1)#exe /tmp/HelloWorld
   ol422(config-daemon-d1)#no shut
   ol422(config-daemon-d1)#show daemon | grep greet
   greeting       Welcome! What is your name?
   ol422(config-daemon-d1)#option name value tartampion
   ol422(config-daemon-d1)#show daemon | grep greet
   greeting       Hello tartampion!
   ol422(config-daemon-d1)#
tsuna commented 7 years ago

(note that the EosSdk stubs from github have no Makefile, the ones from the arista software-download page do, so that explains why autoconf is not always needed...).

That's because we release pre-bootstrapped tarballs, whereas GitHub is just the raw source that requires bootstrapping. This is standard practice in the OSS community.

chency commented 7 years ago

Thank you @tsuna ,it seems to be the libtool no installed Thank you @ruferp。As a beginner,the Detailed operating instructions helps a lot。 After the libtool and g++ has been added, the libeos.so finally came out!