fix compiling with musl
In case apt is compiled against musl-libc, then compilation fails with the following error:
cmdline/apt-internal-solver.cc:122:20: error: 'basename' was not declared in this scope; did you mean 'rename'?
| 122 | if (strcmp(basename(argv[0]), "solver3") == 0)
| | ^~~~~~~~
| | rename
To fix it, include libgen header which is where this function is defined.
Once this is fixed, compilation fails once again with musl-libc, because
the basename function takes char*
argument instead of const char*
:
this is because the musl implementation cuts off the trailing slashes
of the path, in case the argument is a folder path.
In our case, when passing argv[0]
, this is not something to worry about,
since this argument is always a filename, this argument won't be actually
modified, so cast it to *char.