Skip to content

Commit 9404364

Browse files
[configure.ac] SAI version check fix for gcc 10.2 (bullseye) (sonic-net#1049)
The command to build a check program was: ``` gcc -lsai -I./SAI/inc -I./SAI/experimental -I./SAI/meta conftest.cpp -o conftest ``` This, however, does not work on gcc 10.2 where the linker wants first the executable and then the shared library: ``` gcc -I./SAI/inc -I./SAI/experimental -I./SAI/meta conftest.cpp -lsai -o conftest ``` However CXX_FLAGS comes first before the source file, so added --no-as-needed as a fix for this issue to make it link against libsai in any order passed to the linker. Signed-off-by: Stepan Blyschak <[email protected]>
1 parent bd47844 commit 9404364

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

configure.ac

+1-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ AC_SUBST(SAIINC, "-I\$(top_srcdir)/SAI/inc -I\$(top_srcdir)/SAI/experimental -I\
185185
AM_COND_IF([SYNCD], [
186186
AM_COND_IF([SAIVS], [], [
187187
SAVED_FLAGS="$CXXFLAGS"
188-
CXXFLAGS="-lsai -I$srcdir/SAI/inc -I$srcdir/SAI/experimental -I$srcdir/SAI/meta"
188+
CXXFLAGS="-Xlinker --no-as-needed -lsai -I$srcdir/SAI/inc -I$srcdir/SAI/experimental -I$srcdir/SAI/meta"
189189
AC_CHECK_FUNCS(sai_query_api_version, [
190190
AC_MSG_CHECKING([SAI headers API version and library version check])
191191
AC_TRY_RUN([

0 commit comments

Comments
 (0)