Ticket #1006 (closed bug: fixed)

Opened 5 years ago

Last modified 3 years ago

Does not build on clang with GMP

Reported by: whiteknight Owned by:
Priority: minor Milestone:
Component: build Version: 1.5.0
Severity: low Keywords: clang build
Cc: ligne Language:
Patch status: Platform:

Description (last modified by jkeenan) (diff)

Parrot was building with llvm/clang for a while, but recently it doesn't anymore. It fails when trying to link because it detects several of the GMP symbols are defined more than once. I do not know why it is having these problems, and I am not sure whether the issue is in GMP, Clang, or Parrot

I have been able to build with clang using this configuration command:

perl Configure.pl --cc=clang --ld=clang --link=clang --without-gmp

Change History

Changed 5 years ago by jkeenan

Andrew,

Can you attach output showing what happens when you try to build with clang and do not exclude GMP?

I'd like to understand better what you mean by "detects several of the GMP symbols are defined more then once."

Thank you very much.
kid51

Changed 5 years ago by moritz

I used to observe a similar problem, which I described here:  http://lists.parrot.org/pipermail/parrot-dev/2009-June/002407.html

src/pmc/bignum.o: In function `__gmpz_abs':
/usr/include/gmp.h:1611: multiple definition of `__gmpz_abs'
src/pmc/bigint.o:/usr/include/gmp.h:1611: first defined here
src/pmc/bignum.o: In function `__gmpz_fits_uint_p':
/usr/include/gmp.h:1637: multiple definition of `__gmpz_fits_uint_p'
src/pmc/bigint.o:/usr/include/gmp.h:1637: first defined here
src/pmc/bignum.o: In function `__gmpz_fits_ulong_p':
/usr/include/gmp.h:1648: multiple definition of `__gmpz_fits_ulong_p'
src/pmc/bigint.o:/usr/include/gmp.h:1648: first defined here
src/pmc/bignum.o: In function `__gmpz_fits_ushort_p':
...
collect2: ld returned 1 exit status
make: *** [blib/lib/libparrot.so.1.3.0] Error 1

These days (with parrot-1.6.0 and a much newer clang) I get other linking errors, also related to gmp (which also go away with --without-gmp):

cc -shared -O2 -g -L/usr/local/lib -fPIC -L/usr/local/lib  -o blib/lib/libparrot.so.1.6.0 -Wl,-soname=libparrot.so.1.6.0 \
		src/string/api.o src/ops/core_ops.o src/ops/core_ops_switch.o src/byteorder.o src/string/charset.o src/core_pmcs.o src/datatypes.o src/debug.o src/dynext.o src/embed.o src/string/encoding.o src/events.o src/exceptions.o src/exit.o src/extend.o src/extend_vtable.o src/gc/alloc_memory.o src/gc/api.o src/gc/gc_ms.o src/gc/gc_inf.o src/gc/mark_sweep.o src/gc/system.o src/global.o src/global_setup.o src/hash.o src/hll.o src/call/pcc.o src/interp/inter_cb.o src/interp/inter_create.o src/interp/inter_misc.o src/call/ops.o src/call/context.o src/key.o src/library.o src/list.o src/longopt.o src/misc.o src/multidispatch.o src/nci.o src/oo.o src/packfile.o src/packout.o src/platform.o src/pmc_freeze.o src/pmc.o src/runcore/main.o src/runcore/cores.o src/runcore/profiling.o src/scheduler.o src/spf_render.o src/spf_vtable.o src/string/primitives.o src/sub.o src/thread.o src/runcore/trace.o src/tsq.o src/utils.o src/vtables.o src/warnings.o src/packfile/pf_items.o src/ops/core_ops_cg.o src/ops/core_ops_cgp.o src/gc/alloc_resources.o  src/string/charset/ascii.o src/string/charset/binary.o src/string/charset/iso-8859-1.o src/string/charset/tables.o src/string/charset/unicode.o src/io/core.o src/io/api.o src/io/utf8.o src/io/buffer.o src/io/unix.o src/io/win32.o src/io/portable.o src/io/filehandle.o src/io/socket_api.o src/io/socket_unix.o src/io/socket_win32.o src/pmc/default.o src/pmc/null.o src/pmc/env.o src/pmc/key.o src/pmc/unmanagedstruct.o src/pmc/managedstruct.o src/pmc/exception.o src/pmc/parrotlibrary.o src/pmc/parrotinterpreter.o src/pmc/parrotthread.o src/pmc/lexpad.o src/pmc/timer.o src/pmc/pointer.o src/pmc/sub.o src/pmc/continuation.o src/pmc/retcontinuation.o src/pmc/coroutine.o src/pmc/eval.o src/pmc/nci.o src/pmc/float.o src/pmc/integer.o src/pmc/bigint.o src/pmc/bignum.o src/pmc/complex.o src/pmc/string.o src/pmc/boolean.o src/pmc/array.o src/pmc/fixedintegerarray.o src/pmc/iterator.o src/pmc/fixedstringarray.o src/pmc/hash.o src/pmc/orderedhash.o src/pmc/os.o src/pmc/file.o src/pmc/addrregistry.o src/pmc/arrayiterator.o src/pmc/callsignature.o src/pmc/capture.o src/pmc/class.o src/pmc/codestring.o src/pmc/context.o src/pmc/cpointer.o src/pmc/eventhandler.o src/pmc/exceptionhandler.o src/pmc/exporter.o src/pmc/filehandle.o src/pmc/fixedbooleanarray.o src/pmc/fixedfloatarray.o src/pmc/fixedpmcarray.o src/pmc/handle.o src/pmc/hashiterator.o src/pmc/hashiteratorkey.o src/pmc/lexinfo.o src/pmc/multisub.o src/pmc/namespace.o src/pmc/object.o src/pmc/orderedhashiterator.o src/pmc/packfile.o src/pmc/packfileannotation.o src/pmc/packfileannotations.o src/pmc/packfileconstanttable.o src/pmc/packfiledirectory.o src/pmc/packfilefixupentry.o src/pmc/packfilefixuptable.o src/pmc/packfilerawsegment.o src/pmc/packfilesegment.o src/pmc/parrotrunningthread.o src/pmc/pccmethod_test.o src/pmc/pmcproxy.o src/pmc/resizablebooleanarray.o src/pmc/resizablefloatarray.o src/pmc/resizableintegerarray.o src/pmc/resizablepmcarray.o src/pmc/resizablestringarray.o src/pmc/role.o src/pmc/scalar.o src/pmc/scheduler.o src/pmc/schedulermessage.o src/pmc/sockaddr.o src/pmc/socket.o src/pmc/stringhandle.o src/pmc/stringiterator.o src/pmc/task.o src/pmc/undef.o src/string/encoding/fixed_8.o src/string/encoding/ucs2.o src/string/encoding/utf16.o src/string/encoding/utf8.o compilers/imcc/imcparser.o compilers/imcc/imclexer.o compilers/imcc/imc.o compilers/imcc/main.o compilers/imcc/symreg.o compilers/imcc/instructions.o compilers/imcc/cfg.o compilers/imcc/reg_alloc.o compilers/imcc/sets.o compilers/imcc/debug.o compilers/imcc/optimizer.o compilers/imcc/pbc.o compilers/imcc/parser_util.o compilers/imcc/pcc.o -ldl -lm -lpthread -lcrypt -lrt -lgmp -lreadline  -lm -L/usr/lib  -licuuc -licudata -lm
: blib/lib/libparrot.a
/usr/bin/ld: src/pmc/bigint.o: relocation R_X86_64_PC32 against `__gmpz_neg' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: ld returned 1 exit status
make: *** [blib/lib/libparrot.so.1.6.0] Error 1

Cheers, Moritz

Changed 3 years ago by jkeenan

  • description modified (diff)

Changed 3 years ago by ligne

  • cc ligne added

i can't reproduce this. Fedora 14 x86_64, gmp 4.3.1, clang 2.8. it looks like a parser bug in (a rather old version of) clang.

is this ok to close?

Changed 3 years ago by whiteknight

  • status changed from new to closed
  • resolution set to fixed

I just tested this on my machine with a more recent clang and it does appear to work now. I'm going to chalk this up to an old bug in clang and close this ticket. Thanks ligne!

Note: See TracTickets for help on using tickets.