mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   Aliquot Sequences (https://www.mersenneforum.org/forumdisplay.php?f=90)
-   -   Aliqueit.exe discussion (https://www.mersenneforum.org/showthread.php?t=11618)

EdH 2012-09-30 00:29

I have run across some trouble trying to compile Aliqueit for a 64-bit installation of Ubuntu. This is in reference to my page on the steps to create an Ubuntu Aliqueit system with ggnfs, msieve, YAFU and associated scripts, etc.

The machine info:
[code]
AMD Athlon(tm) 64 X2 Dual Core Processor 4000+
2G memory
Linux math11 3.2.0-31-generic #50-Ubuntu SMP Fri Sep 7 16:16:45 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
[/code]I have successfully compiled and installed gmp (per instructions, I uninstalled all gmp and libgmp repository packages first), gmp-ecm, msieve and YAFU. But, Aliqueit seems to be missing something from the gmp library:
[code]
aliqueit.cc:(.text._ZSt16__introsort_loopIN9__gnu_cxx17__normal_iteratorIPSt4pairI10__gmp_exprIA1_12__mpz_structS5_EiESt6vectorIS7_SaIS7_EEEElEvT_SD_T0_[void std::__introsort_loop<__gnu_cxx::__normal_iterator<std::pair<__gmp_expr<__mpz_struct [1], __mpz_struct [1]>, int>*, std::vector<std::pair<__gmp_expr<__mpz_struct [1], __mpz_struct [1]>, int>, std::allocator<std::pair<__gmp_expr<__mpz_struct [1], __mpz_struct [1]>, int> > > >, long>(__gnu_cxx::__normal_iterator<std::pair<__gmp_expr<__mpz_struct [1], __mpz_struct [1]>, int>*, std::vector<std::pair<__gmp_expr<__mpz_struct [1], __mpz_struct [1]>, int>, std::allocator<std::pair<__gmp_expr<__mpz_struct [1], __mpz_struct [1]>, int> > > >, __gnu_cxx::__normal_iterator<std::pair<__gmp_expr<__mpz_struct [1], __mpz_struct [1]>, int>*, std::vector<std::pair<__gmp_expr<__mpz_struct [1], __mpz_struct [1]>, int>, std::allocator<std::pair<__gmp_expr<__mpz_struct [1], __mpz_struct [1]>, int> > > >, long)]+0x13f): undefined reference to `__gmpz_clear'
aliqueit.o: In function `main':
aliqueit.cc:(.text.startup+0x66): undefined reference to `__gmpz_init_set_si'
aliqueit.cc:(.text.startup+0x82): undefined reference to `__gmpz_init_set_si'
aliqueit.cc:(.text.startup+0x9e): undefined reference to `__gmpz_init_set_si'
aliqueit.cc:(.text.startup+0x1c1): undefined reference to `__gmpz_set_str'
aliqueit.cc:(.text.startup+0x2a2): undefined reference to `__gmpz_clear'
aliqueit.cc:(.text.startup+0x2af): undefined reference to `__gmpz_clear'
aliqueit.cc:(.text.startup+0x2bc): undefined reference to `__gmpz_clear'
aliqueit.cc:(.text.startup+0x36f): undefined reference to `__gmpz_init_set'
aliqueit.cc:(.text.startup+0x385): undefined reference to `__gmpz_clear'
aliqueit.cc:(.text.startup+0x706): undefined reference to `__gmpz_set_str'
aliqueit.cc:(.text.startup+0x73e): undefined reference to `__gmpz_set'
aliqueit.cc:(.text.startup+0x78a): undefined reference to `__gmpz_cmp'
aliqueit.cc:(.text.startup+0x95d): undefined reference to `__gmpz_init_set'
aliqueit.cc:(.text.startup+0xa19): undefined reference to `__gmpz_cmp'
aliqueit.cc:(.text.startup+0xd0b): undefined reference to `__gmpz_init_set'
aliqueit.cc:(.text.startup+0xd44): undefined reference to `__gmpz_clear'
aliqueit.cc:(.text.startup+0xfac): undefined reference to `__gmpz_divexact_ui'
aliqueit.cc:(.text.startup+0xfc8): undefined reference to `__gmpz_divisible_ui_p'
aliqueit.cc:(.text.startup+0x116a): undefined reference to `__gmpz_init'
aliqueit.cc:(.text.startup+0x1177): undefined reference to `__gmpz_init'
aliqueit.cc:(.text.startup+0x11a4): undefined reference to `__gmpz_cmp'
aliqueit.cc:(.text.startup+0x11ea): undefined reference to `__gmpz_set'
aliqueit.cc:(.text.startup+0x1202): undefined reference to `__gmpz_sub'
aliqueit.cc:(.text.startup+0x1221): undefined reference to `__gmpz_clear'
aliqueit.cc:(.text.startup+0x122e): undefined reference to `__gmpz_clear'
aliqueit.cc:(.text.startup+0x126f): undefined reference to `__gmpz_clear'
aliqueit.cc:(.text.startup+0x16de): undefined reference to `__gmpz_clear'
aliqueit.cc:(.text.startup+0x1700): undefined reference to `__gmpz_clear'
aliqueit.o:aliqueit.cc:(.text.startup+0x1712): more undefined references to `__gmpz_clear' follow
collect2: ld returned 1 exit status
make: *** [aliqueit] Error 1
math11@math11:~/Math/Aliqueit/src/aliqueit$
[/code]I've tried several locations for the gmp directory and libs directory, but nothing changes.

Here's my current Aliqueit Makefile:
[code]
#
# aliqueit Makefile for linux
#

# you'll need to change this if your gmp headers aren't installed globally:
GMP_DIR = /home/math11/Math/gmp

CC = g++
CFLAGS = -O3 -I$(GMP_DIR)

# you'll need to change this if your gmp headers aren't installed globally:
LIBS = -L /usr/local/lib -lgmp

OBJ = aliqueit.o cfg.o misc.o


aliqueit: $(OBJ)
$(CC) $(CFLAGS) $(LIBS) $(OBJ) -o aliqueit

%.o: %.cc
$(CC) $(CFLAGS) -c -o $@ $<
[/code]my /usr/local/lib directory holds:
[code]
libecm.a libgmp.a libgmp.so libgmp.so.10.0.5
libecm.la libgmp.la libgmp.so.10 python2.7
[/code]and, my /home/math11/Math/gmp directory holds:
[code]acinclude.m4 gen-fac_ui.c mp_dv_tab.lo randlc2x.lo
aclocal.m4 gen-fib mp_dv_tab.o randlc2x.o
ansi2knr.1 gen-fib.c mpf rand.lo
ansi2knr.c gen-psqr mp_get_fns.c randmt.c
assert.c gen-psqr.c mp_get_fns.lo randmt.h
assert.lo gen-trialdivtab mp_get_fns.o randmt.lo
assert.o gen-trialdivtab.c mp.h randmt.o
AUTHORS gmp.h mp-h.in randmts.c
ChangeLog gmp-h.in mp_minv_tab.c randmts.lo
compat.c gmp-impl.h mp_minv_tab.lo randmts.o
compat.lo gmp-mparam.h mp_minv_tab.o randmui.c
compat.o gmpxx.h mpn randmui.lo
configfsf.guess INSTALL mpq randmui.o
configfsf.sub INSTALL.autoconf mp_set_fns.c rand.o
config.guess install-sh mp_set_fns.lo rands.c
config.h invalid.c mp_set_fns.o randsd.c
config.in invalid.lo mpz randsd.lo
config.log invalid.o NEWS randsd.o
config.m4 libgmp.la nextprime.c randsdui.c
config.status libmp.sym nextprime.lo randsdui.lo
config.sub libtool nextprime.o randsdui.o
configure longlong.h printf rands.lo
configure.in ltmain.sh randbui.c rands.o
COPYING Makefile randbui.lo README
COPYING.LIB Makefile.am randbui.o scanf
cxx Makefile.in rand.c stamp-h1
demos memory.c randclr.c tal-debug.c
doc memory.lo randclr.lo tal-notreent.c
dumbmp.c memory.o randclr.o tal-reent.c
errno.c missing randdef.c tal-reent.lo
errno.lo mp_bases.h randdef.lo tal-reent.o
errno.o mp_bpl.c randdef.o tests
extract-dbl.c mp_bpl.lo randiset.c trialdivtab.h
extract-dbl.lo mp_bpl.o randiset.lo tune
extract-dbl.o mpbsd randiset.o version.c
fib_table.h mp_clz_tab.c randlc2s.c version.lo
gen-bases mp_clz_tab.lo randlc2s.lo version.o
gen-bases.c mp_clz_tab.o randlc2s.o ylwrap
gen-fac_ui mp_dv_tab.c randlc2x.c
[/code]Thanks for any assistance.

Dubslow 2012-09-30 02:55

Try changing "-L /usr/local/lib" to "-L/usr/local/lib". gcc doesn't allow spaces.

EdH 2012-09-30 03:56

[QUOTE=Dubslow;313217]Try changing "-L /usr/local/lib" to "-L/usr/local/lib". gcc doesn't allow spaces.[/QUOTE]
No luck...

My memory must be really short term - a few posts back is the same trouble mentioned by Mr. Odd and solved in my earlier versions by adding libgmp3-dev via the repository. I'm also trying the procedure you put forth in [URL="http://www.mersenneforum.org/showpost.php?p=300091&postcount=424"]post 424[/URL], but that isn't working either.:sad:

Thanks for helping sort this out.

Dubslow 2012-09-30 05:14

[QUOTE=EdH;313224]No luck...

My memory must be really short term - a few posts back is the same trouble mentioned by Mr. Odd and solved in my earlier versions by adding libgmp3-dev via the repository. I'm also trying the procedure you put forth in [URL="http://www.mersenneforum.org/showpost.php?p=300091&postcount=424"]post 424[/URL], but that isn't working either.:sad:

Thanks for helping sort this out.[/QUOTE]

My last general comment would be that I compiled GMP 5.0.4 from source, because IIRC the repositories weren't working either. If you're using an older Ubuntu, it's possible that whatever you have installed doesn't have the necessary functions, and that self-compiling a newer GMP might work.

Edit: Perhaps try adding "-static"? I don't know why it's failing, you've pointed the linker to libgmp, and used "-lgmp", so that should be it... unless the mentioned functions aren't in that particular gmp version, like I hypothesized above.

EdH 2012-09-30 15:00

[QUOTE=Dubslow;313227]My last general comment would be that I compiled GMP 5.0.4 from source, because IIRC the repositories weren't working either. If you're using an older Ubuntu, it's possible that whatever you have installed doesn't have the necessary functions, and that self-compiling a newer GMP might work.

Edit: Perhaps try adding "-static"? I don't know why it's failing, you've pointed the linker to libgmp, and used "-lgmp", so that should be it... unless the mentioned functions aren't in that particular gmp version, like I hypothesized above.[/QUOTE]
That's the rub. I got the latest everything from the gmp(5.0.5) and ecm(6.4.3b) sites and compiled via their instructions. I gave up on trying to use the repositories and even had to remove some repository versions of packages so that gmp and ecm were "happy." So, if something is missing, they removed it from their latest versions, or it isn't showing up in my system via the methods of compile I used.

Thinking more about it, this might be the trouble. I used their "impatient procedure" to compile, so maybe there is a switch/option I need to engage that isn't invoked by default. However, I expected your procedure from post 424 would have taken care of it.

I do see the defines in gmp.h:
[code]
#define mpz_clear __gmpz_clear
__GMP_DECLSPEC void mpz_clear __GMP_PROTO ((mpz_ptr));
[/code]but, not where __gmpz_clear is defined, probably in a library.

Thanks again...

Mr. Odd 2012-09-30 15:58

Yeah, I never figured this out either. If you do, please let us know and/or post a binary!

EdH 2012-09-30 16:10

[QUOTE=Mr. Odd;313245]Yeah, I never figured this out either. If you do, please let us know and/or post a binary![/QUOTE]
I wish I'd known that. Since I saw no further posts, I "assumed" (erroneously) that you were up and running. Sorry!

I do need to track this down to some resolution so I can update my "Steps..." page.

The conclusion will be posted here...

Ralf Recker 2012-09-30 17:06

[QUOTE=EdH;313244]I do see the defines in gmp.h:
[code]
#define mpz_clear __gmpz_clear
__GMP_DECLSPEC void mpz_clear __GMP_PROTO ((mpz_ptr));
[/code]but, not where __gmpz_clear is defined, probably in a library.[/QUOTE]
It's defined in libgmp.so.10.0.5 (dynamic linking)

[CODE]ralf@quadriga:~$ objdump -T /usr/lib/x86_64-linux-gnu/libgmp.so.10.0.5 | grep __gmpz_clear
0000000000014900 g DF .text 0000000000000083 Base __gmpz_clears
00000000000148e0 g DF .text 0000000000000018 Base __gmpz_clear
[/CODE]or in libgmp.a (-static)

[CODE]ralf@quadriga:~$ objdump -t /usr/lib/x86_64-linux-gnu/libgmp.a | grep __gmpz_clear
0000000000000000 *UND* 0000000000000000 __gmpz_clear
0000000000000000 *UND* 0000000000000000 __gmpz_clear
0000000000000000 *UND* 0000000000000000 __gmpz_clear
0000000000000000 *UND* 0000000000000000 __gmpz_clear
0000000000000000 g F .text 0000000000000015 __gmpz_clear
0000000000000000 g F .text 0000000000000083 __gmpz_clears
0000000000000000 *UND* 0000000000000000 __gmpz_clear
0000000000000000 *UND* 0000000000000000 __gmpz_clear
0000000000000000 *UND* 0000000000000000 __gmpz_clear
[/CODE]This examples are from a Debian 7.0 test setup. Your paths may vary.

By the way: libgmp3-dev is a transitional package for smooth upgrades.
[CODE]This is a dummy package that simply pulls in libgmp-dev. It can safely be removed.[/CODE]You can check if other packets depend on it:

[CODE]ralf@quadriga:~$ apt-cache rdepends libgmp3-dev
libgmp3-dev
Reverse Depends:
swi-prolog-nox
libppl0.11-dev
open-cobol
libmpfr-dev
libmpfr-dev
libgmp-ocaml-dev
libgmp-dev
libgmp-dev
genius-dev
ecl
ats-lang-anairiats
libapron-dev[/CODE]libgmp-dev? Lets look at it:

[CODE]ralf@quadriga:~$ apt-cache depends libgmp-dev | grep libgmp3-dev
Conflicts: libgmp3-dev
Replaces: libgmp3-dev[/CODE]

Dubslow 2012-09-30 17:52

[QUOTE=Mr. Odd;313245]or post a binary![/QUOTE]

Like I've said more than once before, my binary is available [URL="https://sites.google.com/site/bbuhrow/home/aliquot-sequences"]here[/URL]. That's Aliqueit compiled on Ubuntu 11.04, gcc 4.5.2, GMP 5.0.4.

EdH 2012-09-30 18:28

@Dubslow: Thanks, again. I may have to take that route (even, if just for now), but I am still in question as to why... BTW, I did try -static.

@Ralf Recker: Thanks also. Unfortunately I'm not versed enough to see why my setup differs from yours. Here (with paths adjusted) are my outputs:
[code]
math11@math11:~/Math/gmp$ objdump -T /usr/local/lib/libgmp.so.10.0.5 | grep __gmpz_clear
0000000000015100 g DF .text 000000000000007f Base __gmpz_clears
00000000000150e0 g DF .text 0000000000000018 Base __gmpz_clear

math11@math11:~/Math/gmp$ objdump -t /usr/local/lib/libgmp.a | grep __gmpz_clear
0000000000000000 *UND* 0000000000000000 __gmpz_clear
0000000000000000 *UND* 0000000000000000 __gmpz_clear
0000000000000000 *UND* 0000000000000000 __gmpz_clear
0000000000000000 *UND* 0000000000000000 __gmpz_clear
0000000000000000 g F .text 0000000000000015 __gmpz_clear
0000000000000000 g F .text 000000000000007f __gmpz_clears
0000000000000000 *UND* 0000000000000000 __gmpz_clear
0000000000000000 *UND* 0000000000000000 __gmpz_clear
0000000000000000 *UND* 0000000000000000 __gmpz_clear

math11@math11:~/Math/gmp$ apt-cache rdepends libgmp3-dev
libgmp3-dev
Reverse Depends:
libmpfr-dev:i386
libmpfr-dev:i386
libgmp3-dev:i386
libgmp-dev:i386
libgmp-dev:i386
swi-prolog-nox
open-cobol
libgmp-ocaml-dev
libcloog-parma-dev
libapron-dev
genius-dev
ecl
ats-lang-anairiats
libppl0.11-dev
libmpfr-dev
libmpfr-dev
libgmp-dev
libgmp-dev

math11@math11:~/Math/gmp$ apt-cache depends libgmp-dev | grep libgmp3-dev
Conflicts: libgmp3-dev
Conflicts: libgmp3-dev:i386
Replaces: libgmp3-dev
Replaces: libgmp3-dev:i386
[/code]I don't see the significant difference.

Maybe I have found something. This message scrolls off the screen before I can even notice it, when I install gmp:
[code]
Libraries have been installed in:
/usr/local/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,-rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
[/code]I'm not familiar with libtool (yet), but maybe this is the issue...

EdH 2012-09-30 18:53

[QUOTE=EdH;313259]...

Maybe I have found something. This message scrolls off the screen before I can even notice it, when I install gmp:
[code]
Libraries have been installed in:
/usr/local/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,-rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
[/code]I'm not familiar with libtool (yet), but maybe this is the issue...[/QUOTE]

Appears to be a dead end. The library paths are already there, as far as I can tell.:sad:


All times are UTC. The time now is 21:52.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.