[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#617751: ocaml-soundtouch: Shouldn't link against stdc++



2011/3/11 Cyril Brulebois <kibi@debian.org>:
> Hi,
>
> Stéphane Glondu <glondu@debian.org> (11/03/2011):
>> So you mean that by using some specific library, one should change
>> linker?
>
> no, I mean that by using the C++ programming language, you're supposed
> to link using g++.
>
>> Doesn't sound right to me... Do you have any reference that
>> explains why linking to -lstdc++ without g++ is bad practice? I've
>> already heard of that, but couldn't find any decent explanation.
>
> Because it's not guaranteed to work. Example:
> | $ cat foo.cpp
> | #include <iostream>
> |
> | using namespace std;
> |
> | int main(void) {
> |   cout << "Hello world!" << endl;
> |   return 0;
> | }
>
> | $ g++ -c foo.cpp -o foo.o
>
> | $ ld -lstdc++ foo.o -o foo
> | ld: cannot find -lstdc++
>
> Both work, with the intermediate target:
> | g++ foo.o -o foo
>
> or directly:
> | $ g++ foo.cpp -o foo
>
> http://gcc.gnu.org/onlinedocs/gcc/Link-Options.html also suggests you
> should be using g++ to link (see -static-*).

That sounds like a big headache for OCaml: native code generated by
OCaml are bundled together at link-time. For instance, in Liquidsoap,
where ocaml-soundtouch is used, we use C and C++ code for the
bindings.

Therefore, there is no reason to use g++ to link the final binary...
Do you have any idea concerning this situation?

Romain

> KiBi.
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (GNU/Linux)
>
> iEYEARECAAYFAk16AuEACgkQeGfVPHR5Nd2+2gCfbk6o8rBjt44n3BaEQQaWQ6zw
> uCAAn2DsLIjQcefTKT2QQItk+80N7dqZ
> =mdL1
> -----END PGP SIGNATURE-----
>
>



Reply to: