Opened 9 years ago

Closed 9 years ago

#31988 closed defect (invalid)

libiconv doesn't seem to work on x86_64

Reported by: dave@… Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version: 2.0.3
Keywords: Cc: ryandesign (Ryan Schmidt)


The only way I could get trunk gcc to build was by downloading libiconv source and installing it under /usr/local as follows:

export LDFLAGS=-L/usr/local/lib && ~/src/gcc/configure  --enable-languages=c,c++ --prefix=/usr/local/stow/gcc-4.7 --with-gmp=/opt/local --with-mpfr=/opt/local --with-mpc=/opt/local --with-libiconv=/opt/local && make -j8

Otherwise I would get link errors when building cc1, generated by this command in the gcc make process:

gcc   -g -fkeep-inline-functions -DIN_GCC   -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Wold-style-definition -Wc++-compat -fno-common  -DHAVE_CONFIG_H -L/opt/local/lib -o cc1 c-lang.o c-family/stub-objc.o attribs.o c-errors.o c-decl.o c-typeck.o c-convert.o c-aux-info.o c-objc-common.o c-parser.o tree-mudflap.o c-family/c-common.o c-family/c-cppbuiltin.o c-family/c-dump.o c-family/c-format.o c-family/c-gimplify.o c-family/c-lex.o c-family/c-omp.o c-family/c-opts.o c-family/c-pch.o c-family/c-ppoutput.o c-family/c-pragma.o c-family/c-pretty-print.o c-family/c-semantics.o c-family/c-ada-spec.o i386-c.o darwin-c.o \
	  cc1-checksum.o main.o tree-browser.o libbackend.a libcommon-target.a libcommon.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a -liconv libcommon.a ../libcpp/libcpp.a -lintl -liconv -lc   ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a    -L/opt/local/lib -L/opt/local/lib -L/opt/local/lib -lmpc -lmpfr -lgmp -liconv   -L../zlib -lz

My macports.conf is attached

Attachments (1)

macports.conf (5.2 KB) - added by dave@… 9 years ago.
My macports configuration

Download all attachments as: .zip

Change History (4)

Changed 9 years ago by dave@…

Attachment: macports.conf added

My macports configuration

comment:1 Changed 9 years ago by ryandesign (Ryan Schmidt)

We don't support users installing things in /usr/local; it interferes with things installed by MacPorts.

Please remove or move aside /usr/local, clean the affected port, try again, and show us exactly what happened.

comment:2 Changed 9 years ago by dave@…

Huh? What affected port?

I'm trying to build gcc from source using macports' libiconv.

The build is invoked this way:

~/src/gcc/configure --enable-languages=c,c++ --disable-multilib --disable-bootstrap --prefix=/usr/local/stow/gcc-4.7 --with-gmp=/opt/local --with-mpfr=/opt/local --with-mpc=/opt/local --without-libitm

And fails as follows:

gcc -c   -g -O2 -DIN_GCC   -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Wold-style-definition -Wc++-compat -fno-common  -DHAVE_CONFIG_H -I. -I. -I/Users/dave/src/gcc/gcc -I/Users/dave/src/gcc/gcc/. -I/Users/dave/src/gcc/gcc/../include -I./../intl -I/Users/dave/src/gcc/gcc/../libcpp/include -I/opt/local/include -I/opt/local/include -I/opt/local/include  -I/Users/dave/src/gcc/gcc/../libdecnumber -I/Users/dave/src/gcc/gcc/../libdecnumber/dpd -I../libdecnumber    insn-automata.c -o insn-automata.o
rm -rf libcommon-target.a
ar rc libcommon-target.a i386-common.o prefix.o params.o opts.o opts-common.o options.o vec.o hooks.o common/common-targhooks.o
ranlib -c libcommon-target.a
rm -rf libcommon.a
ar rc libcommon.a diagnostic.o pretty-print.o intl.o input.o version.o
ranlib -c libcommon.a
gcc   -g -O2 -DIN_GCC   -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Wold-style-definition -Wc++-compat -fno-common  -DHAVE_CONFIG_H  gcov.o libcommon.a ../libcpp/libcpp.a ./../intl/libintl.a -liconv  ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a  -o gcov
Undefined symbols for architecture x86_64:
  "_libiconv_open", referenced from:
      _identifier_to_locale in libcommon.a(pretty-print.o)
  "_libiconv", referenced from:
      _identifier_to_locale in libcommon.a(pretty-print.o)
  "_libiconv_close", referenced from:
      _identifier_to_locale in libcommon.a(pretty-print.o)
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
gmake[2]: *** [gcov] Error 1
gmake[2]: *** Waiting for unfinished jobs....
rm gcov.pod cpp.pod gfdl.pod gcc.pod fsf-funding.pod
gmake[2]: Leaving directory `/private/tmp/gcc-build/gcc'
gmake[1]: *** [all-gcc] Error 2
gmake[1]: Leaving directory `/private/tmp/gcc-build'
gmake: *** [all] Error 2

The build is fixed by compiling and installing my own libiconv in /usr/local and using that one.

comment:3 in reply to:  2 Changed 9 years ago by ryandesign (Ryan Schmidt)

Cc: ryandesign@… added
Resolution: invalid
Status: newclosed

Replying to dave@…:

I'm trying to build gcc from source using macports' libiconv.

Oh. Ok. Well there's nothing wrong with the libiconv port. Based on the line...

gcc   -g -O2 -DIN_GCC   -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Wold-style-definition -Wc++-compat -fno-common  -DHAVE_CONFIG_H  gcov.o libcommon.a ../libcpp/libcpp.a ./../intl/libintl.a -liconv  ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a  -o gcov looks like "-L/opt/local/lib" is missing. The gcc46 port uses the configure argument --with-libiconv-prefix=/opt/local; perhaps you need to add that.

Note: See TracTickets for help on using tickets.