Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[configure.ac] Add the option of passing libnl path to configure script #1824

Merged
merged 3 commits into from
Jul 20, 2021

Conversation

smaheshm
Copy link
Contributor

What I did
Add the option of passing custmol built libnl path to configure script

Why I did it
MPLS feature in sonic-buildimage requires a libnl patch to be applied before building libnl. Since this build is not installed in usual locations (/usr/lib/..) LGTM analysis fails. This change gives the option of passing libnl library location to 'configure' script and generate libraries to be linked.

In case the options are not passed, the configure script defaults to earlier behavior where it checks for LIBNL in usual locations
How I verified it

root@samaddik-vm-01:/var/sonic/src/sonic-swss# ./configure --prefix=/usr --with-extra-inc=/lgtm/usr/include --with-extra-lib=/lgtm/lib/x86_64-linux-gnu    --with-extra-usr-lib=/lgtm/usr/lib/x86_64-linux-gnu --with-libnl-3.0-inc=/lgtm/usr/include/libnl3; dh_auto_build 
.
.
mv -f .deps/gearsyncd-phyparser.Tpo .deps/gearsyncd-phyparser.Po                                                                                                                                                                                                                                                                                                          
/bin/bash ../libtool  --tag=CXX   --mode=link g++  -g -O2  -L/lgtm/lib/x86_64-linux-gnu -L/lgtm/usr/lib/x86_64-linux-gnu -o gearsyncd gearsyncd-gearboxutils.o gearsyncd-gearsyncd.o gearsyncd-gearparserbase.o gearsyncd-gearboxparser.o gearsyncd-phyparser.o -lnl-3 -lnl-route-3 -lswsscommon    -lnl-nf-3 -lnl-route-3 -lnl-genl-3 -lnl-3 -lhiredis                   
libtool: link: g++ -g -O2 -o gearsyncd gearsyncd-gearboxutils.o gearsyncd-gearsyncd.o gearsyncd-gearparserbase.o gearsyncd-gearboxparser.o gearsyncd-phyparser.o  -L/lgtm/lib/x86_64-linux-gnu -L/lgtm/usr/lib/x86_64-linux-gnu -lswsscommon -lnl-nf-3 -lnl-route-3 -lnl-genl-3 -lnl-3 -lhiredis                                                                          
make[2]: Leaving directory '/var/sonic/src/sonic-swss/gearsyncd'                                                                                                                                                                                                                                                                                                          
make[2]: Entering directory '/var/sonic/src/sonic-swss'                                                                                                                                                                                                                                                                                                                   
make[2]: Leaving directory '/var/sonic/src/sonic-swss'                                                                                                                                                                                                                                                                                                                    
make[1]: Leaving directory '/var/sonic/src/sonic-swss'    

root@samaddik-vm-01:/var/sonic/src/sonic-swss# find . -name Makefile | xargs grep LIBS | grep "nl-nf-3"
./tests/Makefile:LIBS = -lnl-nf-3 -lnl-route-3 -lnl-genl-3 -lnl-3 -lhiredis 
./tests/mock_tests/Makefile:LIBS = -lnl-nf-3 -lnl-route-3 -lnl-genl-3 -lnl-3 -lhiredis 
./Makefile:LIBS = -lnl-nf-3 -lnl-route-3 -lnl-genl-3 -lnl-3 -lhiredis 
./portsyncd/Makefile:LIBS = -lnl-nf-3 -lnl-route-3 -lnl-genl-3 -lnl-3 -lhiredis 
./natsyncd/Makefile:LIBS = -lnl-nf-3 -lnl-route-3 -lnl-genl-3 -lnl-3 -lhiredis 
./orchagent/Makefile:LIBS = -lnl-nf-3 -lnl-route-3 -lnl-genl-3 -lnl-3 -lhiredis 
./fpmsyncd/Makefile:LIBS = -lnl-nf-3 -lnl-route-3 -lnl-genl-3 -lnl-3 -lhiredis 

root@samaddik-vm-01:/var/sonic/src/sonic-swss# find . -name Makefile | xargs grep libnl3 | grep include
./tests/Makefile:CPPFLAGS =  -I/lgtm/usr/include -I/lgtm/usr/include/swss -I/lgtm/usr/include/sai -I/lgtm/usr/include/libnl3
./tests/Makefile:LIBNL_INC_DIR = /lgtm/usr/include/libnl3
./tests/mock_tests/Makefile:CPPFLAGS =  -I/lgtm/usr/include -I/lgtm/usr/include/swss -I/lgtm/usr/include/sai -I/lgtm/usr/include/libnl3
./tests/mock_tests/Makefile:LIBNL_INC_DIR = /lgtm/usr/include/libnl3
./Makefile:CPPFLAGS =  -I/lgtm/usr/include -I/lgtm/usr/include/swss -I/lgtm/usr/include/sai -I/lgtm/usr/include/libnl3
./Makefile:LIBNL_INC_DIR = /lgtm/usr/include/libnl3

Without the 'include' option:

root@samaddik-vm-01:/var/sonic/src/sonic-swss# find . -name Makefile | xargs grep libnl3 | grep include
./tests/Makefile:CFLAGS_COMMON = -std=c++14 -Wall -fPIC -Wno-write-strings -I/usr/include/swss I/usr/include/libnl3 
.
.

Details if related

prefix where extra libraries are installed],
[AC_SUBST(LDFLAGS, "$LDFLAGS -L${withval}")])

AC_CHECK_LIB([nl-3], [nl_addr_alloc])
Copy link
Contributor

@qiluo-msft qiluo-msft Jul 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nl_addr_alloc

Since you are requiring a local patched libnl3, do you want to check the required new function rtnl_route_nh_get_encap_mpls_dst? #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated.

checking for sai_object_type_query in -lsai... no                                                                                                                                    
configure: WARNING: libsai is not installed.                                                                                                                                         
checking for nl_addr_alloc in -lnl-3... yes                                                                                                                                          
checking for nl_socket_get_cb in -lnl-genl-3... yes                                                                                                                                  
checking for rtnl_route_nh_get_encap_mpls_dst in -lnl-route-3... yes                                                                                                                 
checking for nfnl_connect in -lnl-nf-3... yes                                                                                                                                        
checking that generated files are newer than configure... done                                                                                                                       

prefix where extra libraries are installed],
[AC_SUBST(LDFLAGS, "$LDFLAGS -L${withval}")])

AC_CHECK_LIB([nl-3], [nl_addr_alloc])
Copy link
Contributor

@qiluo-msft qiluo-msft Jul 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nl-3

If you have installed Debian vanilla libnl3, and extract patched libnl3 into a folder, which one will you prefer? #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the extracted one, always. The '-L' includes the path to the extracted libs so it will be the ones that will be linked.

@smaheshm
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@qiluo-msft qiluo-msft merged commit c805021 into sonic-net:master Jul 20, 2021
vaibhavhd added a commit to sonic-net/sonic-buildimage that referenced this pull request Aug 3, 2021
Update sonic-swss submodule head to include below fixes:

Ignore ALREADY_EXIST error in FDB creation (sonic-net/sonic-swss#1815)
Update MACsec SA PN counter to support SAI API 1.8 (sonic-net/sonic-swss#1818)
[swss]: Allow portsyncd to run on system without ports (sonic-net/sonic-swss#1808)
[debugcounterorch] check if counter type is supported before querying… (sonic-net/sonic-swss#1789)
[configure.ac] Add the option of passing libnl path to configure script (sonic-net/sonic-swss#1824)
refactor(fdbsyncd): Convert files with dos2unix (sonic-net/sonic-swss#1828)
[VS] Fix for VS test failures (sonic-net/sonic-swss#1836)
Td2: Reclaim buffer from unused ports (sonic-net/sonic-swss#1830)
[gearbox] Set context for phys based on configs (sonic-net/sonic-swss#1826)
[Dynamic Buffer Calc] Bug fix: Don't create lossless buffer profile for active ports without speed configured (sonic-net/sonic-swss#1822)
Bridge mac setting, fix statedb time format (sonic-net/sonic-swss#1844)
[cfgmgr]: Introduce common libs. (sonic-net/sonic-swss#1842)
carl-nokia pushed a commit to carl-nokia/sonic-buildimage that referenced this pull request Aug 7, 2021
…t#8313)

Update sonic-swss submodule head to include below fixes:

Ignore ALREADY_EXIST error in FDB creation (sonic-net/sonic-swss#1815)
Update MACsec SA PN counter to support SAI API 1.8 (sonic-net/sonic-swss#1818)
[swss]: Allow portsyncd to run on system without ports (sonic-net/sonic-swss#1808)
[debugcounterorch] check if counter type is supported before querying… (sonic-net/sonic-swss#1789)
[configure.ac] Add the option of passing libnl path to configure script (sonic-net/sonic-swss#1824)
refactor(fdbsyncd): Convert files with dos2unix (sonic-net/sonic-swss#1828)
[VS] Fix for VS test failures (sonic-net/sonic-swss#1836)
Td2: Reclaim buffer from unused ports (sonic-net/sonic-swss#1830)
[gearbox] Set context for phys based on configs (sonic-net/sonic-swss#1826)
[Dynamic Buffer Calc] Bug fix: Don't create lossless buffer profile for active ports without speed configured (sonic-net/sonic-swss#1822)
Bridge mac setting, fix statedb time format (sonic-net/sonic-swss#1844)
[cfgmgr]: Introduce common libs. (sonic-net/sonic-swss#1842)
raphaelt-nvidia pushed a commit to raphaelt-nvidia/sonic-swss that referenced this pull request Oct 5, 2021
…pt (sonic-net#1824)

**What I did**
Add the option of passing custmol built libnl path to configure script

**Why I did it**
MPLS feature in sonic-buildimage requires a libnl patch to be applied before building libnl. Since this build is not installed in usual locations (/usr/lib/..) LGTM analysis fails. This change gives the option of passing libnl library location to 'configure' script and generate libraries to be linked.

In case the options are not passed, the configure script defaults to earlier behavior where it checks for LIBNL in usual locations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants