abseil / abseil-cpp

Abseil Common Libraries (C++)

Home Page:https://abseil.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Workaround for missing -l option in libraries

KartikShrivastava opened this issue · comments

commented

Hi,

Package config files generated by grpc does not include -l option for these libraries advapi32, dbghelp and bcrypt. Currently grpc generates these library names within quotes "" rather than with a -l option. Which makes linking to these libraries errorneous.

I tried to look for underlying issue. And I think the issue is probably with this $<JOIN:${ABSL_CC_LIB_LINKOPTS}, > here grpc-1.45.2/third_party/abseil-cpp/CMAKE/AbseilHelpers.cmake.

And the affected pkgconfig files are the only ones which adds libraries using ${ABSL_CC_LIB_LINKOPTS} that too within quotes "" as opposed to followed by -l option. Just for records the effected files are absl_base.pc, absl_symbolize.pc and recently added absl_random_internal_seed_material.pc with "advapi32", "dbghelp" and "bcrypt" libraries respectively.

Can you please give a workaround for this or a correct way to use .pc files which does not include -l option with the mentioned libraries?

I think this is fixed by 1963f10.

If not, please post more information about what platform you're building on and how to reproduce the problem.

commented

Thanks for taking action on this. I haven't tested the changes but this is how the issue mentioned was reproduced earlier on windows platform using msys-mingw-64bit terminal.

  1. Open MSYS2 MinGW 64-bit terminal on Windows 10 OS
  2. Run pkg-config --libs grpc
  3. In the output string notice the libraries such as advapi32, dbghelp, bcrypt without -l prefix.

Those missing -l prefix causes error upon using pkg-config --libs grpc command to fetch grpc libraries in make workflow.

This change has made its way into MSYS's package, but it didn't solve the problem. Building with CMake as done here still produces .pc files with quoted rather than -l-prefixed names.

The change in 1963f10 addressed a slightly different issue that doesn't look related. The fix here looks like it should just be to change the $<$<BOOL:${MINGW}>:"bcrypt"> generator expressions to use the -l form?