Linker Error Help!

Hi, I am trying to build proverif project with ocaml, but cannot get past this error. I’ve been searching for hours and cannot seem to find a solution :slightly_frowning_face:. Any idea how?

It sounds like you are mixing two configurations of clang: one for iOS and another for macOS. Did you try to switch to an opam-managed version of OCaml?

Hi, Thank you for the reply. I’m not so sure what you mean by that. All I did was opam install ocaml to install ocaml. What should I do after?


This seems to be the problem, but I have no luck find solution on the internet… :weary:

I guess that this failure happens when you are trying to build a ocaml-base-compiler switch? Any way this error seems to indicate that you are missing a working C compiler on your system. (It might be useful to copy paste the whole configure output).

Yea I thought so too and I re installed my C compiler yet I’m still getting the same error :/!

Heres the full log:

This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by OCaml configure 4.12.0, which was
generated by GNU Autoconf 2.69. Invocation command line was

$ ./configure --prefix=/Users/tty/.opam/4.12.0 -C CC=cc ASPP=cc -c

---------

Platform.

---------

hostname = MacBook-Pro.local
uname -m = x86_64
uname -r = 20.5.0
uname -s = Darwin
uname -v = Darwin Kernel Version 20.5.0: Sat May 8 05:10:33 PDT 2021; root:xnu-7195.121.3~9/RELEASE_X86_64

/usr/bin/uname -p = i386
/bin/uname -X = unknown

/bin/arch = unknown
/usr/bin/arch -k = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo = Mach kernel version:
Darwin Kernel Version 20.5.0: Sat May 8 05:10:33 PDT 2021; root:xnu-7195.121.3~9/RELEASE_X86_64
Kernel configured for up to 12 processors.
6 processors are physically available.
12 processors are logically available.
Processor type: x86_64h (Intel x86-64h Haswell)
Processors active: 0 1 2 3 4 5 6 7 8 9 10 11
Primary memory available: 32.00 gigabytes
Default processor set: 669 tasks, 3583 threads, 12 processors
Load average: 2.73, Mach factor: 9.26
/bin/machine = unknown
/usr/bin/oslevel = unknown
/bin/universe = unknown

PATH: /Users/tty/.opam/4.12.0/bin
PATH: /path/to/gcc-4.9.2/bin/
PATH: /usr/local/bin
PATH: /usr/bin
PATH: /bin
PATH: /usr/sbin
PATH: /sbin
PATH: /Library/TeX/texbin
PATH: /Library/Apple/usr/bin
PATH: /Library/Frameworks/Mono.framework/Versions/Current/Commands
PATH: /Users/tty/Documents/flutter/bin

-----------

Core tests.

-----------

configure:2681: creating cache config.cache
configure:2755: Configuring OCaml version 4.12.0
configure:2949: checking build system type
configure:2963: result: x86_64-apple-darwin20.5.0
configure:2983: checking host system type
configure:2996: result: x86_64-apple-darwin20.5.0
configure:3016: checking target system type
configure:3029: result: x86_64-apple-darwin20.5.0
configure:3386: checking for ld
configure:3402: found /usr/bin/ld
configure:3413: result: ld
configure:3492: checking how to print strings
configure:3519: result: printf
configure:3588: checking for gcc
configure:3615: result: cc
configure:3844: checking for C compiler version
configure:3853: cc --version >&5
Apple clang version 12.0.5 (clang-1205.0.22.11)
Target: x86_64-apple-darwin20.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
configure:3864: $? = 0
configure:3853: cc -v >&5
Apple clang version 12.0.5 (clang-1205.0.22.11)
Target: x86_64-apple-darwin20.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
configure:3864: $? = 0
configure:3853: cc -V >&5
clang: error: argument to β€˜-V’ is missing (expected 1 value)
clang: error: no input files
configure:3864: $? = 1
configure:3853: cc -qversion >&5
clang: error: unknown argument β€˜-qversion’; did you mean β€˜β€“version’?
clang: error: no input files
configure:3864: $? = 1
configure:3884: checking whether the C compiler works
configure:3906: cc conftest.c >&5
configure:3910: $? = 0
configure:3958: result: yes
configure:3961: checking for C compiler default output file name
configure:3963: result: a.out
configure:3969: checking for suffix of executables
configure:3976: cc -o conftest conftest.c >&5
configure:3980: $? = 0
configure:4002: result:
configure:4024: checking whether we are cross compiling
configure:4032: cc -o conftest conftest.c >&5
configure:4036: $? = 0
configure:4043: ./conftest
dyld: attempt to run simulator program outside simulator (DYLD_ROOT_PATH not set)
./configure: line 4045: 40215 Abort trap: 6 ./conftest$ac_cv_exeext
configure:4047: $? = 134
configure:4054: error: in /Users/tty/.opam/4.12.0/.opam-switch/build/ocaml-base-compiler.4.12.0': configure:4056: error: cannot run C compiled programs. If you meant to cross compile, use –host’.
See `config.log’ for more details

----------------

Cache variables.

----------------

ac_cv_build=x86_64-apple-darwin20.5.0
ac_cv_env_ASPP_set=set
ac_cv_env_ASPP_value=β€˜cc -c’
ac_cv_env_AS_set=
ac_cv_env_AS_value=
ac_cv_env_CC_set=set
ac_cv_env_CC_value=cc
ac_cv_env_CFLAGS_set=
ac_cv_env_CFLAGS_value=
ac_cv_env_CPPFLAGS_set=
ac_cv_env_CPPFLAGS_value=
ac_cv_env_CPP_set=
ac_cv_env_CPP_value=
ac_cv_env_DEFAULT_STRING_set=
ac_cv_env_DEFAULT_STRING_value=
ac_cv_env_DLLIBS_set=
ac_cv_env_DLLIBS_value=
ac_cv_env_LDFLAGS_set=
ac_cv_env_LDFLAGS_value=
ac_cv_env_LIBS_set=
ac_cv_env_LIBS_value=
ac_cv_env_LT_SYS_LIBRARY_PATH_set=
ac_cv_env_LT_SYS_LIBRARY_PATH_value=
ac_cv_env_PARTIALLD_set=
ac_cv_env_PARTIALLD_value=
ac_cv_env_WINDOWS_UNICODE_MODE_set=
ac_cv_env_WINDOWS_UNICODE_MODE_value=
ac_cv_env_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_host_alias_set=
ac_cv_env_host_alias_value=
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_host=x86_64-apple-darwin20.5.0
ac_cv_prog_ac_ct_CC=cc
ac_cv_prog_ac_ct_LD=ld
ac_cv_target=x86_64-apple-darwin20.5.0

-----------------

Output variables.

-----------------

AR=’’
AS=’’
ASPP=β€˜cc -c’
AWK=’’
CC=β€˜cc’
CFLAGS=’’
CONFIGURE_ARGS=’–prefix=/Users/tty/.opam/4.12.0 -C CC=cc ASPP=cc -c’
CPP=’’
CPPFLAGS=’’
DEFAULT_STRING=’’
DEFS=’’
DEP_CC=’’
DIRECT_CPP=’’
DIRECT_LD=’’
DLLIBS=’’
DLLTOOL=’’
DSYMUTIL=’’
DUMPBIN=’’
ECHO_C=’\c’
ECHO_N=’’
ECHO_T=’’
EGREP=’’
EXEEXT=’’
FGREP=’’
GREP=’’
INSTALL_DATA=’’
INSTALL_PROGRAM=’’
INSTALL_SCRIPT=’’
LD=β€˜ld’
LDFLAGS=’’
LIBOBJS=’’
LIBS=’’
LIBTOOL=’’
LIPO=’’
LN_S=’’
LTLIBOBJS=’’
LT_SYS_LIBRARY_PATH=’’
MANIFEST_TOOL=’’
NM=’’
NMEDIT=’’
OBJDUMP=’’
OBJEXT=’’
OTOOL64=’’
OTOOL=’’
PACKAGE_BUGREPORT=β€˜caml-list@inria.fr’
PACKAGE_NAME=β€˜OCaml’
PACKAGE_STRING=β€˜OCaml 4.12.0’
PACKAGE_TARNAME=β€˜ocaml’
PACKAGE_URL=β€˜http://www.ocaml.org’
PACKAGE_VERSION=β€˜4.12.0’
PACKLD=’’
PARTIALLD=’’
PATH_SEPARATOR=’:’
PTHREAD_CC=’’
PTHREAD_CFLAGS=’’
PTHREAD_LIBS=’’
RANLIB=’’
RANLIBCMD=’’
S=β€˜s’
SED=’/usr/bin/sed’
SHELL=’/bin/sh’
SO=β€˜so’
STRIP=’’
SYSTEM_AS=’’
VERSION=β€˜4.12.0’
WINDOWS_UNICODE_MODE=’’
ac_ct_AR=’’
ac_ct_CC=β€˜cc’
ac_ct_DEP_CC=’’
ac_ct_DUMPBIN=’’
ac_ct_LD=β€˜ld’
ac_tool_prefix=’’
afl=’’
arch64=’’
arch=β€˜undefined_arch’
as_has_debug_prefix_map=’’
asm_cfi_supported=’’
ax_pthread_config=’’
bindir=’${exec_prefix}/bin’
build=β€˜x86_64-apple-darwin20.5.0’
build_alias=’’
build_cpu=β€˜x86_64’
build_os=β€˜darwin20.5.0’
build_vendor=β€˜apple’
bytecclibs=’’
cc_has_debug_prefix_map=’’
ccomptype=β€˜cc’
cmxs=’’
compute_deps=’’
datadir=’${datarootdir}’
datarootdir=’${prefix}/share’
debug_runtime=’’
default_safe_string=’’
docdir=’${datarootdir}/doc/${PACKAGE_TARNAME}’
dvidir=’${docdir}’
endianness=’’
exec_prefix=β€˜NONE’
exeext=’’
extralibs=’’
flambda=’’
flambda_invariants=’’
flat_float_array=’’
flexdll_chain=’’
flexlink_flags=’’
force_safe_string=’’
fpic=’’
frame_pointers=’’
function_sections=’’
has_monotonic_clock=’’
host=β€˜x86_64-apple-darwin20.5.0’
host_alias=’’
host_cpu=β€˜x86_64’
host_os=β€˜darwin20.5.0’
host_vendor=β€˜apple’
htmldir=’${docdir}’
iflexdir=’’
includedir=’${prefix}/include’
infodir=’${datarootdir}/info’
install_bytecode_programs=’’
install_source_artifacts=’’
instrumented_runtime=β€˜false’
libdir=’${exec_prefix}/lib’
libexecdir=’${exec_prefix}/libexec’
libext=’’
libraries_man_section=β€˜3’
localedir=’${datarootdir}/locale’
localstatedir=’${prefix}/var’
long_shebang=’’
mandir=’${datarootdir}/man’
mkexe=’$(CC) $(OC_CFLAGS) $(CFLAGS) $(OC_LDFLAGS)’
mkexedebugflag=’-g’
mklib=’’
mkmaindll=’’
mksharedlib=’’
mksharedlibrpath=’’
model=’’
naked_pointers=’’
naked_pointers_checker=’’
natdynlink=’’
natdynlinkopts=’’
native_compiler=’’
nativecclibs=’’
oc_cflags=’’
oc_cppflags=’’
oc_dll_ldflags=’’
oc_ldflags=’’
ocamlc_cflags=’’
ocamlc_cppflags=’’
ocamldoc=β€˜auto’
ocamltest=’’
oldincludedir=’/usr/include’
otherlibraries=’’
outputexe=’-o $(EMPTY)’
outputobj=’’
pdfdir=’${docdir}’
prefix=’/Users/tty/.opam/4.12.0’
profinfo=β€˜false’
profinfo_width=β€˜0’
program_transform_name=β€˜s,x,x,’
programs_man_section=β€˜1’
psdir=’${docdir}’
pthread_link=’’
rlwrap=’’
rpath=’’
sbindir=’${exec_prefix}/sbin’
sharedlib_cflags=’’
sharedstatedir=’${prefix}/com’
shebangscripts=’’
stdlib_manpages=’’
supports_shared_libraries=’’
sysconfdir=’${prefix}/etc’
syslib=’-l$(1)’
system=’’
systhread_support=’’
target=β€˜x86_64-apple-darwin20.5.0’
target_alias=’’
target_cpu=β€˜x86_64’
target_os=β€˜darwin20.5.0’
target_vendor=β€˜apple’
toolchain=β€˜cc’
unix_or_win32=’’
unixlib=’’
windows_unicode=’’
with_camltex=β€˜true’
with_debugger=’’
x_includes=β€˜NONE’
x_libraries=β€˜NONE’

-----------

confdefs.h.

-----------

/* confdefs.h */
#define PACKAGE_NAME β€œOCaml”
#define PACKAGE_TARNAME β€œocaml”
#define PACKAGE_VERSION β€œ4.12.0”
#define PACKAGE_STRING β€œOCaml 4.12.0”
#define PACKAGE_BUGREPORT β€œcaml-list@inria.fr”

configure: exit 1

It appears you’re trying to build this β€œmanually”. Have you tried doing it thru opam? That is to say, setting up opam in the completely standard way and then installing proverif with it?

I might also suggest that you might want to figure out how to use docker on macos, to build proverif in the most-standard way – the one that is used for all the CI runs on macos.

The goal of these two things, would be to try to figure out what’s wrong with the way you’re building proverif2. I don’t know if it builds on macos, but from the opam file, I see no reason why it would not.

Thank you for the reply! so I reinstalled my opam and set it up in the standard way, then I did opam install proverif, but the same original build issue came up Screen Shot 2021-08-19 at 1.46.54 pm|690x495 Of all the solution I found online related to this problem is to change a certain setting in xcode, but I couldnt find any xcode project file to open and change…

I’m a UNIX jock, and even though macos is based on UNIX, it’s different-enough that maybe my instincts aren’t useful. Looking at your screenshot, I notice that

  1. your opam switch is ~/.opam/default
  2. but you’re using ocaml .o files from /usr/local/lib

I suspect that this means you have another ocaml installation, and it’s on some of your search paths. Can I suggest you uninstall that ocaml? Or at least, make sure that no paths to that installation (not to /usr/local/bin nor /usr/local/lib/ocaml) are in your environment? I really do think the best way is to just uninstall it.

You don’t have to have ocaml installed, to set up opam: there are prebuilt binaries, and I’ve used those successfully on (e.g.) a Chromebook.

Does this make sense?

I followed your suggestion and I tried to reinstall ocaml but it didn’t work, so I uninstalled opam entirely then did opam install proverif again, and now I’m back to the c compiler issue :weary: But my gcc is installed and functional. :sob: :sob:

OK, that isn’t how I’ve ever installed ocaml with opam. The standard method is:

  1. opam init – this will set up a directory, build a default ocaml switch
  2. then opam switch create 4.12.0 (or whatever version you want)
  3. then opam switch 4.12.0 (this switches to that version, in the event that you weren’t already there)
  4. it’ll put out a little helpful line
# Run eval $(opam env) to update the current shell environment

and you run that to make sure you environment variables are all OK.

THEN, you should be able to install various opam packages – don’t do proverif first, try some others. Only after you know you have a working opam installation with a working switch, should you try to install proverif.

There are instructions in the opam documentation for what to put in your dot.bashrc – if you have trouble with that, I can give you mine, but really, those instructions should be adequate.

It works now! Thank you so much!

Glad to be of help. I thought I should suggest that you

  1. try to build OCaml manually yourself (unless you already have)
  2. try to build proverif manually also

The reason is … well, let me put it this way:

when I started working with Linux, there were really no β€œinstallers”. Or at least, not for the hardware I used. So we did a lot manually. Stuff like futzing around with UMSDOS and other craziness. And as installers for (e.g.) Debian arose, I kept on doing it the manual way for a long time. B/c I felt that knowing the details of how my operating system was installed was important to being a systems programmer.

Eventually, after Ubuntu became really prevalent, I stopped. But I think that regularly dipping below the β€œpretty wrapper” to understand how software is built, is a useful habit, and a mostly-painfree way of becoming skilled in debugging build-failures and such.

Just a thought.

P.S. I realize that this thread started from your trying to build proverif manually. What I mean now, is that (a) having installed opam+switch properly, the previous error might disappear, and (b) Now you have a correct build you can look at (including build-logs that you can save from the install and inspect) to guide you.