sonic-net/sonic-sairedis

sonic-sairedis compilation problem

chenpiaoping opened this issue · 42 comments

I have encountered the following compilation problems. Is there a more detailed documentation on sonic-sairedis compilation? thank you!
root@sonic:/home/chenpp/sonic-sairedis# make
make all-recursive
make[1]: Entering directory '/home/chenpp/sonic-sairedis'
Making all in meta
make[2]: Entering directory '/home/chenpp/sonic-sairedis/meta'
Makefile:659: ../SAI/meta/.deps/libsaimeta_la-saimetadata.Plo: No such file or directory
Makefile:660: ../SAI/meta/.deps/libsaimeta_la-saimetadatautils.Plo: No such file or directory
Makefile:661: ../SAI/meta/.deps/libsaimeta_la-saiserialize.Plo: No such file or directory
make[2]: *** No rule to make target '../SAI/meta/.deps/libsaimeta_la-saiserialize.Plo'. Stop.
make[2]: Leaving directory '/home/chenpp/sonic-sairedis/meta'
Makefile:411: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/chenpp/sonic-sairedis'
Makefile:341: recipe for target 'all' failed
make: *** [all] Error 2

did you pulled git SAI modules for this repo ?

did you pulled git SAI modules for this repo ?

yes, i did.

is this straight forward "make" after clone and submodule fetch ? or did you make "clean" before that ?

is this straight forward "make" after clone and submodule fetch ? or did you make "clean" before that ?

Thank you for your reply @kcudnik Here are my steps:

  1. Use my browser to download sonic-sairedis and SAI projects and extract them.
  2. Move the SAI directory to the sonic-sairedis directory.
  3. run ./autogen.sh script.
  4. run ./configure script.
  5. run make command.

Before that, I had installed all the dependent packages.

try this:

try this:

I found the reason. The soft link meta/$ (top_srcdir) / SAI was invalid. I recreated it and it work now.In addition, the compilation of SAI requires the following dependencies.
sudo apt-get install graphviz
sudo apt-get install aspell

but I encountered other problems:
sai_meta.cpp: In function 'sai_status_t meta_sai_flush_fdb_entries(sai_object_id_t, uint32_t, const sai_attribute_t*, sai_flush_fdb_entries_fn)':
sai_meta.cpp:6800:55: error: missing initializer for member '_sai_fdb_event_notification_data_t::event_type' [-Werror=missing-field-initializers]
sai_fdb_event_notification_data_t data = {};
^
sai_meta.cpp:6800:55: error: missing initializer for member '_sai_fdb_event_notification_data_t::fdb_entry' [-Werror=missing-field-initializers]
sai_meta.cpp:6800:55: error: missing initializer for member '_sai_fdb_event_notification_data_t::attr_count' [-Werror=missing-field-initializers]
sai_meta.cpp:6800:55: error: missing initializer for member '_sai_fdb_event_notification_data_t::attr' [-Werror=missing-field-initializers]
cc1plus: all warnings being treated as errors

chenpp@ubuntu:/sonic-sairedis$ g++ --version
g++ (Ubuntu 4.8.4-2ubuntu1
14.04.4) 4.8.4
Copyright (C) 2013 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.
sonic-sairedis version: 201911

we already observed different errors vs different versions of gcc with the same code, in this case seems like version of your gcc is old, i think we compile this repo with at least v8.x, a personally on v9.x (seems like this error is not thrown any more on newer ones), and i also just checked 201911 branch for other possible variables variables that can cause this error, and there can be a few of them.

What my proposal here would be, you could make a fix for this adding " = { 0 };" this should solve the compilation issue, and then you could post pull request to that branch with that fix, after you already successfully compile this repo locally and possible fix all coming errors.

I also see that this same line of code exists on origin/master as well, so i would appreciate if you could also try compile origin/master and try to see if there are any potential errors like that. Just note that on origin/master you will need to checkout different branch on SAI/ directory since from 201911 it moved a lot forward.

Please let me know

we already observed different errors vs different versions of gcc with the same code, in this case seems like version of your gcc is old, i think we compile this repo with at least v8.x, a personally on v9.x (seems like this error is not thrown any more on newer ones), and i also just checked 201911 branch for other possible variables variables that can cause this error, and there can be a few of them.

What my proposal here would be, you could make a fix for this adding " = { 0 };" this should solve the compilation issue, and then you could post pull request to that branch with that fix, after you already successfully compile this repo locally and possible fix all coming errors.

I also see that this same line of code exists on origin/master as well, so i would appreciate if you could also try compile origin/master and try to see if there are any potential errors like that. Just note that on origin/master you will need to checkout different branch on SAI/ directory since from 201911 it moved a lot forward.

Please let me know

Thanks kcudnik, the 201911 branch can be compiled normally now, but there are some errors in master in my local environment. anyway, let me commit a PR to 201911 branch.

merged on 201911 branch, if you see some other issues on master that would be great if you could fix them too

I found the reason. The soft link meta/$ (top_srcdir) / SAI was invalid. I recreated it and it work now.In addition, the compilation of SAI requires the following dependencies.
Hi Chen/Kamil,

Can you please elaborate on this??

Facing same build issue

make all-recursive
make[1]: Entering directory '/home/gck/gangadhar/individual/sonic-sairedis'
Making all in meta
make[2]: Entering directory '/home/gck/gangadhar/individual/sonic-sairedis/meta'
Makefile:661: ../SAI/meta/.deps/libsaimeta_la-saimetadata.Plo: No such file or directory
Makefile:662: ../SAI/meta/.deps/libsaimeta_la-saimetadatautils.Plo: No such file or directory
Makefile:663: ../SAI/meta/.deps/libsaimeta_la-saiserialize.Plo: No such file or directory
make[2]: *** No rule to make target '../SAI/meta/.deps/libsaimeta_la-saiserialize.Plo'. Stop.
make[2]: Leaving directory '/home/gck/gangadhar/individual/sonic-sairedis/meta'
Makefile:411: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/gck/gangadhar/individual/sonic-sairedis'
Makefile:341: recipe for target 'all' failed
make: *** [all] Error 2

Facing same build issue

make all-recursive
make[1]: Entering directory '/home/gck/gangadhar/individual/sonic-sairedis'
Making all in meta
make[2]: Entering directory '/home/gck/gangadhar/individual/sonic-sairedis/meta'
Makefile:661: ../SAI/meta/.deps/libsaimeta_la-saimetadata.Plo: No such file or directory
Makefile:662: ../SAI/meta/.deps/libsaimeta_la-saimetadatautils.Plo: No such file or directory
Makefile:663: ../SAI/meta/.deps/libsaimeta_la-saiserialize.Plo: No such file or directory
make[2]: *** No rule to make target '../SAI/meta/.deps/libsaimeta_la-saiserialize.Plo'. Stop.
make[2]: Leaving directory '/home/gck/gangadhar/individual/sonic-sairedis/meta'
Makefile:411: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/gck/gangadhar/individual/sonic-sairedis'
Makefile:341: recipe for target 'all' failed
make: *** [all] Error 2

Please go to the directory ./meta and call make, to see if the output of make is normal.

Facing same build issue
make all-recursive
make[1]: Entering directory '/home/gck/gangadhar/individual/sonic-sairedis'
Making all in meta
make[2]: Entering directory '/home/gck/gangadhar/individual/sonic-sairedis/meta'
Makefile:661: ../SAI/meta/.deps/libsaimeta_la-saimetadata.Plo: No such file or directory
Makefile:662: ../SAI/meta/.deps/libsaimeta_la-saimetadatautils.Plo: No such file or directory
Makefile:663: ../SAI/meta/.deps/libsaimeta_la-saiserialize.Plo: No such file or directory
make[2]: *** No rule to make target '../SAI/meta/.deps/libsaimeta_la-saiserialize.Plo'. Stop.
make[2]: Leaving directory '/home/gck/gangadhar/individual/sonic-sairedis/meta'
Makefile:411: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/gck/gangadhar/individual/sonic-sairedis'
Makefile:341: recipe for target 'all' failed
make: *** [all] Error 2

Please go to the directory ./meta and call make, to see if the output of make is normal.

Same error again

Hi Chen,
Please find the output when compiled from ./meta/

Makefile:661: ../SAI/meta/.deps/libsaimeta_la-saimetadata.Plo: No such file or directory
Makefile:662: ../SAI/meta/.deps/libsaimeta_la-saimetadatautils.Plo: No such file or directory
Makefile:663: ../SAI/meta/.deps/libsaimeta_la-saiserialize.Plo: No such file or directory
make: *** No rule to make target '../SAI/meta/.deps/libsaimeta_la-saiserialize.Plo'. Stop.

Makefile:661: ../SAI/meta/.deps/libsaimeta_la-saimetadata.Plo: No such file or directory
Makefile:662: ../SAI/meta/.deps/libsaimeta_la-saimetadatautils.Plo: No such file or directory
Makefile:663: ../SAI/meta/.deps/libsaimeta_la-saiserialize.Plo: No such file or directory
make[2]: *** No rule to make target '../SAI/meta/.deps/libsaimeta_la-saiserialize.Plo'. Stop.
make[2]: Leaving directory '/home/gck/gangadhar/individual/sonic-sairedis/meta'
Makefile:411: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/gck/gangadhar/individual/sonic-sairedis'
Makefile:341: recipe for target 'all' failed
make: *** [all] Error 2

Go to the directory ./meta/$(top_srcdir)/SAI/meta, and call make again.

Makefile:661: ../SAI/meta/.deps/libsaimeta_la-saimetadata.Plo: No such file or directory
Makefile:662: ../SAI/meta/.deps/libsaimeta_la-saimetadatautils.Plo: No such file or directory
Makefile:663: ../SAI/meta/.deps/libsaimeta_la-saiserialize.Plo: No such file or directory
make[2]: *** No rule to make target '../SAI/meta/.deps/libsaimeta_la-saiserialize.Plo'. Stop.
make[2]: Leaving directory '/home/gck/gangadhar/individual/sonic-sairedis/meta'
Makefile:411: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/gck/gangadhar/individual/sonic-sairedis'
Makefile:341: recipe for target 'all' failed
make: *** [all] Error 2

Go to the directory ./meta/$(top_srcdir)/SAI/meta, and call make.

Directory is empty. No Makefile

Makefile:661: ../SAI/meta/.deps/libsaimeta_la-saimetadata.Plo: No such file or directory
Makefile:662: ../SAI/meta/.deps/libsaimeta_la-saimetadatautils.Plo: No such file or directory
Makefile:663: ../SAI/meta/.deps/libsaimeta_la-saiserialize.Plo: No such file or directory
make[2]: *** No rule to make target '../SAI/meta/.deps/libsaimeta_la-saiserialize.Plo'. Stop.
make[2]: Leaving directory '/home/gck/gangadhar/individual/sonic-sairedis/meta'
Makefile:411: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/gck/gangadhar/individual/sonic-sairedis'
Makefile:341: recipe for target 'all' failed
make: *** [all] Error 2

Go to the directory ./meta/$(top_srcdir)/SAI/meta, and call make.

Directory is empty. No Makefile

ln -s ./SAI ./meta/$(top_srcdir)/SAI

Makefile:661: ../SAI/meta/.deps/libsaimeta_la-saimetadata.Plo: No such file or directory
Makefile:662: ../SAI/meta/.deps/libsaimeta_la-saimetadatautils.Plo: No such file or directory
Makefile:663: ../SAI/meta/.deps/libsaimeta_la-saiserialize.Plo: No such file or directory
make[2]: *** No rule to make target '../SAI/meta/.deps/libsaimeta_la-saiserialize.Plo'. Stop.
make[2]: Leaving directory '/home/gck/gangadhar/individual/sonic-sairedis/meta'
Makefile:411: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/gck/gangadhar/individual/sonic-sairedis'
Makefile:341: recipe for target 'all' failed
make: *** [all] Error 2

Go to the directory ./meta/$(top_srcdir)/SAI/meta, and call make.

Directory is empty. No Makefile

ln -s ./SAI ./meta/$(top_srcdir)/SAI

Not able to compile same error

Makefile:661: ../SAI/meta/.deps/libsaimeta_la-saimetadata.Plo: No such file or directory
Makefile:662: ../SAI/meta/.deps/libsaimeta_la-saimetadatautils.Plo: No such file or directory
Makefile:663: ../SAI/meta/.deps/libsaimeta_la-saiserialize.Plo: No such file or directory
make[2]: *** No rule to make target '../SAI/meta/.deps/libsaimeta_la-saiserialize.Plo'. Stop.
make[2]: Leaving directory '/home/gck/gangadhar/individual/sonic-sairedis/meta'
Makefile:411: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/gck/gangadhar/individual/sonic-sairedis'
Makefile:341: recipe for target 'all' failed
make: *** [all] Error 2

Go to the directory ./meta/$(top_srcdir)/SAI/meta, and call make.

Directory is empty. No Makefile

ln -s ./SAI ./meta/$(top_srcdir)/SAI

Not able to compile same error

Go to the directory ./meta/$(top_srcdir)/SAI/meta, and call make again.
What is the error output?

Makefile:661: ../SAI/meta/.deps/libsaimeta_la-saimetadata.Plo: No such file or directory
Makefile:662: ../SAI/meta/.deps/libsaimeta_la-saimetadatautils.Plo: No such file or directory
Makefile:663: ../SAI/meta/.deps/libsaimeta_la-saiserialize.Plo: No such file or directory
make[2]: *** No rule to make target '../SAI/meta/.deps/libsaimeta_la-saiserialize.Plo'. Stop.
make[2]: Leaving directory '/home/gck/gangadhar/individual/sonic-sairedis/meta'
Makefile:411: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/gck/gangadhar/individual/sonic-sairedis'
Makefile:341: recipe for target 'all' failed
make: *** [all] Error 2

Go to the directory ./meta/$(top_srcdir)/SAI/meta, and call make.

Directory is empty. No Makefile

ln -s ./SAI ./meta/$(top_srcdir)/SAI

Not able to compile same error

Go to the directory ./meta/$(top_srcdir)/SAI/meta, and call make again.
What is the error output?

make: *** No targets specified and no makefile found. Stop.

Makefile:661: ../SAI/meta/.deps/libsaimeta_la-saimetadata.Plo: No such file or directory
Makefile:662: ../SAI/meta/.deps/libsaimeta_la-saimetadatautils.Plo: No such file or directory
Makefile:663: ../SAI/meta/.deps/libsaimeta_la-saiserialize.Plo: No such file or directory
make[2]: *** No rule to make target '../SAI/meta/.deps/libsaimeta_la-saiserialize.Plo'. Stop.
make[2]: Leaving directory '/home/gck/gangadhar/individual/sonic-sairedis/meta'
Makefile:411: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/gck/gangadhar/individual/sonic-sairedis'
Makefile:341: recipe for target 'all' failed
make: *** [all] Error 2

Go to the directory ./meta/$(top_srcdir)/SAI/meta, and call make.

Directory is empty. No Makefile

ln -s ./SAI ./meta/$(top_srcdir)/SAI

Not able to compile same error

Go to the directory ./meta/$(top_srcdir)/SAI/meta, and call make again.
What is the error output?

make: *** No targets specified and no makefile found. Stop.

Did you find the Makefile file in. / meta/$ (top_srcdir) / SAI/meta?

Did you follow these steps to get the source code:
git clone https://github.com/Azure/sonic-sairedis.git
git submodule update --init --recursive

Did you follow these steps to get the source code:
git clone https://github.com/Azure/sonic-sairedis.git
git submodule update --init --recursive

Followed exact steps

Makefile:661: ../SAI/meta/.deps/libsaimeta_la-saimetadata.Plo: No such file or directory
Makefile:662: ../SAI/meta/.deps/libsaimeta_la-saimetadatautils.Plo: No such file or directory
Makefile:663: ../SAI/meta/.deps/libsaimeta_la-saiserialize.Plo: No such file or directory
make[2]: *** No rule to make target '../SAI/meta/.deps/libsaimeta_la-saiserialize.Plo'. Stop.
make[2]: Leaving directory '/home/gck/gangadhar/individual/sonic-sairedis/meta'
Makefile:411: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/gck/gangadhar/individual/sonic-sairedis'
Makefile:341: recipe for target 'all' failed
make: *** [all] Error 2

Go to the directory ./meta/$(top_srcdir)/SAI/meta, and call make.

Directory is empty. No Makefile

ln -s ./SAI ./meta/$(top_srcdir)/SAI

Not able to compile same error

Go to the directory ./meta/$(top_srcdir)/SAI/meta, and call make again.
What is the error output?

make: *** No targets specified and no makefile found. Stop.

Did you find the Makefile file in. / meta/$ (top_srcdir) / SAI/meta?

Nope. empty directory

Makefile:661: ../SAI/meta/.deps/libsaimeta_la-saimetadata.Plo: No such file or directory
Makefile:662: ../SAI/meta/.deps/libsaimeta_la-saimetadatautils.Plo: No such file or directory
Makefile:663: ../SAI/meta/.deps/libsaimeta_la-saiserialize.Plo: No such file or directory
make[2]: *** No rule to make target '../SAI/meta/.deps/libsaimeta_la-saiserialize.Plo'. Stop.
make[2]: Leaving directory '/home/gck/gangadhar/individual/sonic-sairedis/meta'
Makefile:411: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/gck/gangadhar/individual/sonic-sairedis'
Makefile:341: recipe for target 'all' failed
make: *** [all] Error 2

Go to the directory ./meta/$(top_srcdir)/SAI/meta, and call make.

Directory is empty. No Makefile

ln -s ./SAI ./meta/$(top_srcdir)/SAI

Not able to compile same error

Go to the directory ./meta/$(top_srcdir)/SAI/meta, and call make again.
What is the error output?

make: *** No targets specified and no makefile found. Stop.

Did you find the Makefile file in. / meta/$ (top_srcdir) / SAI/meta?

Nope. empty directory

There may be two reasons: one is that you did not download the SAI code correctly (you can see if the directory. / SAI is empty), and the other is that the. / SAI directory is not empty, but you have not correctly created the soft link.:
ln -s ./SAI ./meta/$(top_srcdir)/SAI

git clone https://github.com/Azure/sonic-sairedis.git
cd sonic-sairedis
git submodule update --init --recursive

last command must be executed inside sairedis-repo directory

and you get still errors while compile ?
can you paste all console output from all commands ?

and you get still errors while compile ?
can you paste all console output from all commands ?

Hi Kamil,

Please find the attached

sairedis_console.log

Also, $(top_srcdir)/ directory is getting created. strange, can be seen below
gck@ubuntu:/gangadhar/individual/sonic-sairedis$ ls meta
AttrKeyMap.cpp Makefile MetaKeyHasher.h OidRefCounter.h SaiAttrWrapper.cpp saiserialize.cpp
AttrKeyMap.h Makefile.am MetaTestSaiInterface.cpp PortRelatedSet.cpp SaiAttrWrapper.h sai_serialize.h
DummySaiInterface.cpp Makefile.in MetaTestSaiInterface.h PortRelatedSet.h SaiObjectCollection.cpp tests.cpp
DummySaiInterface.h Meta.cpp NumberOidIndexGenerator.cpp SaiAttributeList.cpp SaiObjectCollection.h '$(top_srcdir)' Globals.cpp Meta.h NumberOidIndexGenerator.h saiattributelist.h SaiObject.cpp
Globals.h MetaKeyHasher.cpp OidRefCounter.cpp SaiAttributeList.h SaiObject.h
gck@ubuntu:
/gangadhar/individual/sonic-sairedis$

System info

gck@ubuntu:~/gangadhar/individual/sonic-sairedis$ uname -a
Linux ubuntu 5.5.0 #1 SMP x86_64 x86_64 x86_64 GNU/Linux

gck@ubuntu:~/gangadhar/individual/sonic-sairedis$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.5 LTS
Release: 18.04
Codename: bionic

automake version: 1.15.1
gcc version : 7.5

i don't see command "./configure --with-sai=vs" executed

you need to have swss-common installed first before you compile sonic-sairedis

yes, you need to install swss-common package first

Hi Kamil, Yes, it is missed. But I have executed it. By the way, I was able to go past the above issue. In meta/Makefile.am, I replaced $top_srcdir with ../ Now make is failing while compiling swss package. Reporting the absence of logger.h file.

you chould not replace top_src dir, this is part of make job and configure, i dont know why this is actually happening, your tools are not too far off in version which im using so it should produce correct makefiles

have you tried upgrade ubuntu packages to latest versions ?

I'm not using ubuntu

~ $ make --version
GNU Make 4.2.1
Ten program został zbudowany dla systemu x86_64-slackware-linux-gnu
Copyright (C) 1988-2016 Free Software Foundation, Inc.
Licencja GPLv3+: GNU GPL wersja 3 lub nowsza <http://gnu.org/licenses/gpl.html>
To oprogramowanie jest wolnodostępne: można je swobodnie zmieniać i rozpowszechniać.
Nie ma ŻADNEJ GWARANCJI w zakresie dopuszczalnym przez prawo.
~ $ automake --version
automake (GNU automake) 1.16.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv2+: GNU GPL version 2 or later <https://gnu.org/licenses/gpl-2.0.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Tom Tromey <tromey@redhat.com>
       and Alexandre Duret-Lutz <adl@gnu.org>.
~ $ gcc --version
gcc (GCC) 9.1.0
Copyright (C) 2019 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.

is this problem still stands?

archiving, please reopen if problem still stands