Skip to content
This repository

Mac OS 10.7(.4): ld: unknown option #17

Closed
bennlich opened this Issue September 11, 2012 · 16 comments

4 participants

Benny Lichtner nirgal Noli Sicad Guglielmo
Benny Lichtner

I downloaded a zip of the current release and ran ./autogen.sh
It finished, printing:
Now type 'make' to compile MDBTools.
I typed make:
Making all in src
Making all in libmdb
CC catalog.lo
CC mem.lo
CC file.lo
file.c: In function ‘_mdb_read_pg’:
file.c:367: warning: format ‘%lu’ expects type ‘long unsigned int’, but argument 3 has type ‘off_t’
file.c:367: warning: format ‘%lu’ expects type ‘long unsigned int’, but argument 3 has type ‘off_t’
CC table.lo
CC data.lo
CC dump.lo
CC backend.lo
CC money.lo
CC sargs.lo
CC index.lo
CC like.lo
CC write.lo
write.c: In function ‘mdb_write_pg’:
write.c:83: warning: format ‘%lu’ expects type ‘long unsigned int’, but argument 3 has type ‘off_t’
write.c:83: warning: format ‘%lu’ expects type ‘long unsigned int’, but argument 3 has type ‘off_t’
CC stats.lo
CC map.lo
CC props.lo
CC worktable.lo
CC options.lo
CC iconv.lo
CCLD libmdb.la
ld: unknown option: --version-script=./libmdb.map
collect2: ld returned 1 exit status
make[2]: *** [libmdb.la] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all-recursive] Error 1

Any ideas? I'm running Mac OS 10.7.4 with XCode 4.2.1.

Thank you!

nirgal
Collaborator

See my answer on #13

Benny Lichtner
Noli Sicad

I git clone the repository in Mac OS X (10.8.2). I got this error (below).

Any suggestion how to fix this or needed package to fix this error?

iconv library comes with Apple OS X and it's located in:

/usr/lib/libiconv.2.dylib

I think the same error (posted above) with Mac OS 10.7.4

Yes, patched from brianb/mdbtools#13 included in this clone (I just checked it).

Thanks.

#########
Last login: Tue Sep 25 10:34:02 on ttys002
Nolis-MacBook-Pro:mdbtools nsicad$ ./autogen.sh
/usr/local/bin/glibtoolize
Warning: I am going to run configure' with no arguments.
If you wish to pass any to it, please specify them on the
./autogen.sh' command line.

processing .
Running aclocal ...
Running libtoolize...
glibtoolize: putting auxiliary files in .'.
glibtoolize: copying file
./ltmain.sh'
glibtoolize: Consider adding AC_CONFIG_MACRO_DIR([m4])' to configure.ac and
glibtoolize: rerunning glibtoolize, to keep the correct libtool macros in-tree.
glibtoolize: Consider adding
-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
Running autoheader...
Running automake --gnu ...
configure.ac:14: installing './config.guess'
configure.ac:14: installing './config.sub'
configure.ac:4: installing './install-sh'
configure.ac:4: installing './missing'
src/extras/Makefile.am: installing './depcomp'
configure.ac: installing './ylwrap'
Running autoconf ...
Running ./configure ...
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... yes
checking whether make supports nested variables... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking whether make sets $(MAKE)... (cached) yes
checking build system type... x86_64-apple-darwin12.2.0
checking host system type... x86_64-apple-darwin12.2.0
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... no
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm
checking the name lister (/usr/bin/nm) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 196608
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert x86_64-apple-darwin12.2.0 file names to x86_64-apple-darwin12.2.0 format... func_convert_file_noop
checking how to convert x86_64-apple-darwin12.2.0 file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... no
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... no
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm output from gcc object... ok
checking for sysroot... no
checking for mt... no
checking if : is a manifest tool... no
checking for dsymutil... dsymutil
checking for nmedit... nmedit
checking for lipo... lipo
checking for otool... otool
checking for otool64... no
checking for -single_module linker flag... yes
checking for -exported_symbols_list linker flag... yes
checking for -force_load linker flag... yes
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fno-common -DPIC
checking if gcc PIC flag -fno-common -DPIC works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin12.2.0 dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for flex... flex
checking lex output file root... lex.yy
checking lex library... -ll
checking whether yytext is a pointer... yes
checking for bison... bison -y
checking for ANSI C header files... (cached) yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking for unistd.h... (cached) yes
checking wordexp.h usability... yes
checking wordexp.h presence... yes
checking for wordexp.h... yes
checking for an ANSI C-conforming const... yes
checking for size_t... yes
checking for iconv... no, consider installing GNU libiconv
checking whether the target supports symbol aliases... no
checking Are we using flex ... yes
checking for pkg-config... /usr/local/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for GLIB... yes
checking for GNOME... no
checking gtk-doc version >= 1.0... no
checking for a readline compatible library...
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating src/Makefile
config.status: creating libmdb.pc
config.status: creating libmdbsql.pc
config.status: creating src/util/Makefile
config.status: creating src/extras/Makefile
config.status: creating Makefile
config.status: creating include/Makefile
config.status: creating src/libmdb/Makefile
config.status: creating src/sql/Makefile
config.status: creating src/odbc/Makefile
config.status: creating doc/Makefile
config.status: creating src/gmdb2/Makefile
config.status: creating src/gmdb2/gladefiles/Makefile
config.status: creating src/gmdb2/pixmaps/Makefile
config.status: creating src/gmdb2/help/Makefile
config.status: creating src/gmdb2/help/C/Makefile
config.status: creating mdbtools.spec
config.status: creating include/mdbver.h
config.status: creating include/config.h
config.status: executing depfiles commands
config.status: executing libtool commands
Now type `make' to compile MDBTools.
Nolis-MacBook-Pro:mdbtools nsicad$ make
Making all in src
Making all in libmdb
CC catalog.lo
CC mem.lo
CC file.lo
file.c: In function '_mdb_read_pg':
file.c:367:17: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'off_t' [-Wformat]
file.c:367:17: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'off_t' [-Wformat]
CC table.lo
CC data.lo
CC dump.lo
CC backend.lo
CC money.lo
CC sargs.lo
CC index.lo
CC like.lo
CC write.lo
write.c: In function 'mdb_write_pg':
write.c:83:3: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'off_t' [-Wformat]
write.c:83:3: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'off_t' [-Wformat]
CC stats.lo
CC map.lo
CC props.lo
CC worktable.lo
CC options.lo
CC iconv.lo
iconv.c: In function 'mdb_unicode2ascii':
iconv.c:34:17: warning: variable 'len_out' set but not used [-Wunused-but-set-variable]
CCLD libmdb.la
ld: unknown option: --version-script=./libmdb.map
collect2: error: ld returned 1 exit status
make[2]: *** [libmdb.la] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all-recursive] Error 1

nirgal
Collaborator

Can you try removing the -Wl,--version-script=.... from:

  • src/libmdb/Makefile.am
  • src/odbc/Makefile.am
  • src/sql/Makefile.am
Noli Sicad

Removing the -Wl,--version-script=....

I got this error


config.status: include/config.h is unchanged
config.status: executing depfiles commands
config.status: executing libtool commands
Nolis-MacBook-Pro:mdbtools nsicad$ make
Making all in src
Making all in libmdb
  CCLD     libmdb.la
ld: unknown option: --as-needed
collect2: error: ld returned 1 exit status
make[2]: *** [libmdb.la] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all-recursive] Error 1
nirgal
Collaborator

Doh....
Ok, commit 6b6e54b will take care of removing --version-script when not supported.

Can you try to remove line "LDFLAGS="$LDFLAGS -Wl,--as-needed"" from configure.ac too, please?

Thank you for your help!

Noli Sicad

I checked out another copy of the code (i.e. git clone ...) after your commit.

However, I still got this error (below).

Thanks for looking after this error. However, it is not yet working.


Nolis-MacBook-Pro:mdbtools nsicad$ make
Making all in src
Making all in libmdb
  CC       catalog.lo
  CC       mem.lo
  CC       file.lo
file.c: In function '_mdb_read_pg':
file.c:367:17: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'off_t' [-Wformat]
file.c:367:17: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'off_t' [-Wformat]
  CC       table.lo
  CC       data.lo
  CC       dump.lo
  CC       backend.lo
  CC       money.lo
  CC       sargs.lo
  CC       index.lo
  CC       like.lo
  CC       write.lo
write.c: In function 'mdb_write_pg':
write.c:83:3: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'off_t' [-Wformat]
write.c:83:3: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'off_t' [-Wformat]
  CC       stats.lo
  CC       map.lo
  CC       props.lo
  CC       worktable.lo
  CC       options.lo
  CC       iconv.lo
iconv.c: In function 'mdb_unicode2ascii':
iconv.c:34:17: warning: variable 'len_out' set but not used [-Wunused-but-set-variable]
  CCLD     libmdb.la
ld: unknown option: --as-needed
collect2: error: ld returned 1 exit status
make[2]: *** [libmdb.la] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all-recursive] Error 1

nirgal
Collaborator

Like I said before, can you try to remove line "LDFLAGS="$LDFLAGS -Wl,--as-needed"" from configure.ac too, please?
I suppose you'll need to reconfigure the project after this.

Noli Sicad
Noli Sicad
nirgal
Collaborator

I just added a quick note about txt2man in INSTALL file. Thank you for the repport.
commit 195a818

nirgal
Collaborator

I just added --disable-as-needed option to configure script.
When as-needed is enabled (default), it is tested and disabled automatically when not available.
commit a13e268

nirgal nirgal closed this October 05, 2012
Guglielmo

Just to clarify for OSX users. To remove the ld: unknown option: --version-script=./libmdb.map problem you can now use the master branch (this is oct 11 2012)

./autogen.sh
./configure --disable-ld-version-script
make
sudo make install

and you're good to go.

nirgal
Collaborator

--disable-ld-version-script should be automatic with last version. If you git pull over an existing repository, remember to reconfigure the project

autoreconf

Can you confirm the autodetection is not working? I mean that it doesn't work without that option from a fresh git clone.

I think macosx users should also add the --with-libiconv-prefix=.... because iconv is bundled separately in that system. Without multibyte support, many options will not work...
Configure comand should output this:

(...)
checking for iconv... yes
checking for iconv declaration... 
         extern size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
Noli Sicad
nirgal
Collaborator

Aaaarg, noooo. It's not ok. sigh
Ok, I disabled "Solaris style script-version" ea9a4ef and used -export-symbols-regex instead as a backup. bd9091c

It works ok with GNU tools, so I'm not reopening the issue. Please do if you still have problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.