Skip to content

Commit

Permalink
[configure.ac] SAI version check fix for gcc 10.2 (bullseye) (sonic-n…
Browse files Browse the repository at this point in the history
…et#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 <stepanb@nvidia.com>
  • Loading branch information
stepanblyschak authored Jun 24, 2022
1 parent bd47844 commit 9404364
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ AC_SUBST(SAIINC, "-I\$(top_srcdir)/SAI/inc -I\$(top_srcdir)/SAI/experimental -I\
AM_COND_IF([SYNCD], [
AM_COND_IF([SAIVS], [], [
SAVED_FLAGS="$CXXFLAGS"
CXXFLAGS="-lsai -I$srcdir/SAI/inc -I$srcdir/SAI/experimental -I$srcdir/SAI/meta"
CXXFLAGS="-Xlinker --no-as-needed -lsai -I$srcdir/SAI/inc -I$srcdir/SAI/experimental -I$srcdir/SAI/meta"
AC_CHECK_FUNCS(sai_query_api_version, [
AC_MSG_CHECKING([SAI headers API version and library version check])
AC_TRY_RUN([
Expand Down

0 comments on commit 9404364

Please sign in to comment.