Hi,
On Wed, May 27, 2015 at 10:08:34PM +0200, Jerome BENOIT wrote:
> > Yes, because I noticed that the code I pasted needs to be compiled like
> > this in Debian:
> >
> > gcc -o test test.c -lecm -lgmp
> >
> > (when run: "No factor found")
>
> On my box:
>
> ldd /usr/lib/libecm.so
> linux-vdso.so.1 => (0x00007fff1adff000)
> libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f86edf38000)
> libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f86edbad000)
> /lib64/ld-linux-x86-64.so.2 (0x00007f86ee44a000)
>
> So my understanding/guessing is that libecm brings the math library with it
> (or something).
Definitely ; but in one case I need to be explicit about it.
> Can you compare the config.log files ?
Uh... I'm typing the compilation lines directly, so which config.log do you
want me to check?
> >
> > while within sage, it's:
> >
> > gcc -o test test.c -I<cut> -L<cut> -lecl -lgmp -lm
>
> ^^^^
> is it a typo ?
Yes it is.
> >
> > (when run: "1")
> >
> > You'll notice that the -I and -L switch are normal, since I link against
> > non-system things. But why the -lm switch?
> >
> > Snark on #debian-science
> >
> > PS: here is a more complete version of my sample code (justifies there is
> > no error):
> > #include <ecm.h>
> >
> > int
> > main(int argc, char *argv[])
> > {
> > mpz_t n, f;
> > int res;
> >
> > mpz_init(n);
> > mpz_set_d(n, 1);
> > mpz_init(f);
> > res = ecm_factor (f, n, 100, NULL);
> > if (res == ECM_NO_FACTOR_FOUND)
> > gmp_printf("No factor found\n");
> > else if (res == ECM_ERROR)
> > gmp_printf("ECM_ERROR\n");
> > else
> > /* factor.c says ECM_FACTOR_FOUND can be returned...
> > * but it doesn't exist!
> > */
> > gmp_printf("%Zd\n", f);
> > return 0;
> > }
> > ECM_NO_FACTOR_FOUND
>
> You can complicate it by printing errno: I get 22 when (res ==
> ECM_NO_FACTOR_FOUND)
What is the point of printing an error number if there is no error ? I'm not
sure errno means anything in that case.
Since yesterday, I noticed that sage doesn't compile a dynamic version of ECM :
it only has a static version! I also saw that the debian
libecm0 package only depends on libc6, while I need -lgmp on the command line.
And ldd libecm0.so doesn't link to gmp either. I don't know if
it's annoying :-/
It doesn't really explain the difference yet...
Snark on #debian-science
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]