[m-users.] Linker error because of double library
Volker Wysk
post at volker-wysk.de
Thu Mar 12 02:34:07 AEDT 2026
Am Donnerstag, dem 12.03.2026 um 00:42 +1100 schrieb Julien Fischer:
> Hi Volker,
Hi, Julien.
> 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.)
I remember that it worked, with the library being installed, before I
switched from Ubuntu to OpenSUSE. That was about a year ago. (Meanwhile I
switched back to Ubuntu.)
> 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
Okay. So I will do the same.
Thanks.
Volker
More information about the users
mailing list