[m-users.] Linker error because of double library
Julien Fischer
jfischer at opturion.com
Thu Mar 12 00:42:34 AEDT 2026
Hi Volker,
On Wed, 11 Mar 2026 at 19:35, Volker Wysk <post at volker-wysk.de> wrote:
>
> After installing my improved ODBC library (with "mmc --make ...
> libodbc.install"), the programs which use it can't be linked any longer. I
> get linker errors about ODBC identifiers which aren't known.
>
> The reason is has to do with a double libary after the Mercury library has
> been installed: "libodbc.so" is the Mercury "odbc" library and in the system
> ODBC library as well (in the Ubuntu package "libodbc2"). Both contain the
> "libodbc.so.2" file. This shouldn't be a problem, since the mercury library
> is specified with "-ml odbc", whereas the system library is "-l odbc".
It will be a problem because -lodbc will occur twice on the command line
that the Mercury compiler constructs to invoke the linker. (The --ml
option is converted into -l option as part of that construction.)
IIRC, the linker will use the first one it finds (which, will depend
on how the library
search paths are set up.)
> I'm using the rotd-2026-02-28 version of the compiler. I think it is a
> Mercury problem, because it worked before I upgraded to rotd-2026-02-28.
I can't meaningfully comment on that because you didn't say what version
of Mercury you updated from. (I would note that there haven't been any changes
to the code used to invoke the linker since last August.)
In fact, this very problem is why I changed the name of the library we created.
for the version of the ODBC binding in the extras.
See: https://github.com/Mercury-Language/mercury/commit/133d040411f6604800e708b76ac790becaf82cc1
Julien.
More information about the users
mailing list