Skip to content

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

Closed
smaheshm wants to merge 1 commit intosonic-net:masterfrom
smaheshm:libnl-args
Closed

[configure.ac] Add the option of passing libnl path to configure script#503
smaheshm wants to merge 1 commit intosonic-net:masterfrom
smaheshm:libnl-args

Conversation

@smaheshm
Copy link
Copy Markdown

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.

root@samaddik-vm-01:/var/sonic/src/sonic-swss/sonic-swss-common# env | grep LGTM
LGTM_WORKSPACE=/lgtm                                                                                                                                                                                                                                                           
LGTM=/lgtm                                                                                                                                                                                                                                                                     
root@samaddik-vm-01:/var/sonic/src/sonic-swss/sonic-swss-common# ./configure   --with-libnl-3.0-inc=$LGTM_WORKSPACE/usr/include/libnl3 --with-libnl-3.0-lib=$LGTM_WORKSPACE/lib/x86_64-linux-gnu --with-libnl-3.0-usr-lib=$LGTM_WORKSPACE/usr/lib/x86_64-linux-gnu             
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... gawk                      
checking whether make sets $(MAKE)... yes                                   
.
.
checking for python3 extension module directory... ${exec_prefix}/lib/python3/dist-packages
checking for redisConnect in -lhiredis... yes
checking for nl_addr_alloc in -lnl-3... yes
checking for nl_socket_get_cb in -lnl-genl-3... yes
checking for nl_object_alloc in -lnl-route-3... yes
checking for nfnl_connect in -lnl-nf-3... yes
checking for swig3.0... /usr/bin/swig3.0
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
.
.

root@samaddik-vm-01:/var/sonic/src/sonic-swss/sonic-swss-common# find . -name Makefile | xargs grep ^LIBS
./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 
./pyext/Makefile:LIBS = -lnl-nf-3 -lnl-route-3 -lnl-genl-3 -lnl-3 -lhiredis 
./pyext/py3/Makefile:LIBS = -lnl-nf-3 -lnl-route-3 -lnl-genl-3 -lnl-3 -lhiredis 
./pyext/py2/Makefile:LIBS = -lnl-nf-3 -lnl-route-3 -lnl-genl-3 -lnl-3 -lhiredis 
./common/Makefile:LIBS = -lnl-nf-3 -lnl-route-3 -lnl-genl-3 -lnl-3 -lhiredis 
root@samaddik-vm-01:/var/sonic/src/sonic-swss/sonic-swss-common# 

If options are not provided PKG_CHECK_MODULES will check for libnl and fail if not found.

configure:12270: checking pkg-config is at least version 0.9.0                                                                                                                                                                                                                                                                                                            
configure:12273: result: yes                                                                                                                                                                                                                                                                                                                                              
configure:12283: checking for LIBNL                                                                                                                                                                                                                                                                                                                                       
configure:12290: $PKG_CONFIG --exists --print-errors "libnl-3.0 libnl-genl-3.0 libnl-route-3.0 libnl-nf-3.0"                                                                                                                                                                                                                                                              
Package libnl-3.0 was not found in the pkg-config search path.                                                                                                                                                                                                                                                                                                            
Perhaps you should add the directory containing `libnl-3.0.pc'                                                                                                                                                                                                                                                                                                            
to the PKG_CONFIG_PATH environment variable                                                                                                                                                                                                                                                                                                                               
No package 'libnl-3.0' found                                                                                                                                                                                                                                                                                                                                              
Package libnl-genl-3.0 was not found in the pkg-config search path.                                                                                                                                                                                                                                                                                                       
Perhaps you should add the directory containing `libnl-genl-3.0.pc'                                                                                                                                                                                                                                                                                                       
to the PKG_CONFIG_PATH environment variable                                                                                                                                                                                                                                                                                                                               
No package 'libnl-genl-3.0' found                                                                                                                                                                                                                                                                                                                                         
Package libnl-route-3.0 was not found in the pkg-config search path.                                                                                                                                                                                                                                                                                                      
Perhaps you should add the directory containing `libnl-route-3.0.pc'                                                                                                                                                                                                                                                                                                      
to the PKG_CONFIG_PATH environment variable                                                                                                                                                                                                                                                                                                                               
No package 'libnl-route-3.0' found                                                                                                                                                                                                                                                                                                                                        
Package libnl-nf-3.0 was not found in the pkg-config search path.                                                                                                                                                                                                                                                                                                         
.
.
.

@smaheshm
Copy link
Copy Markdown
Author

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@smaheshm smaheshm requested review from kcudnik and lguohan July 15, 2021 03:12
@smaheshm
Copy link
Copy Markdown
Author

@qbdwlr

@smaheshm smaheshm requested a review from qiluo-msft July 15, 2021 21:32
@qiluo-msft
Copy link
Copy Markdown
Contributor

Offline discussed. Actually in the LGTM build process, you can build swss-common with Debian vanilla libnl3. then you can uninstall vanilla libnl3. The root issue is swss depends a patched version of libnl3, so you need to fix swss configure.ac this way. No need to change swss-common configure.ac at all.

@smaheshm
Copy link
Copy Markdown
Author

Offline discussed. Actually in the LGTM build process, you can build swss-common with Debian vanilla libnl3. then you can uninstall vanilla libnl3. The root issue is swss depends a patched version of libnl3, so you need to fix swss configure.ac this way. No need to change swss-common configure.ac at all.

created:

sonic-net/sonic-swss#1824

@smaheshm
Copy link
Copy Markdown
Author

created PR in sonic-swss
sonic-net/sonic-swss#1824

@smaheshm smaheshm closed this Jul 16, 2021
@smaheshm smaheshm deleted the libnl-args branch July 16, 2021 20:04
@smaheshm
Copy link
Copy Markdown
Author

Offline discussed. Actually in the LGTM build process, you can build swss-common with Debian vanilla libnl3. then you can uninstall vanilla libnl3. The root issue is swss depends a patched version of libnl3, so you need to fix swss configure.ac this way. No need to change swss-common configure.ac at all.

No need to uninstall as I'm specifying the custom libnl library path with "-L" option, so g++ should link those libs before looking at the usual location.

prgeor pushed a commit to prgeor/sonic-swss-common that referenced this pull request Feb 27, 2025
* wait for specified duration during LPmode on/off

* Add Macro and remove redundant sleep

* Update test_cmis.py

* Address review comments

* Indentation issue
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.

2 participants