Reputation: 381
I am trying to compile Z3 version 4.1.2. AFter a successful configuration, when you do "make", I get the following error:
Makefile:151: lib.srcs: No such file or directory
Makefile:152: shell.srcs: No such file or directory
Makefile:153: test.srcs: No such file or directory
Making test.srcs...
/usr/local/bin/dos2unix takes only stdin and stdout
make: *** [test.srcs] Error 1
Upvotes: 1
Views: 381
Reputation: 21475
I think the problem is that all textual files in z3-src-4.1.2.zip
use "carriage return" (cr) and "line feed" (lf) for encoding line termination. The zip was created on a Windows machine. Another problem is the "dos2unix" application. It is an application that converts windows/dos textual files into unix/linux/osx textual files. It is a very simple application. It just replaces cr/lf with a lf.
On Linux, this application takes a single argument: the file name to be modified.
I'm currently working on a new build system that avoids this issues. In the meantime, here a some workarounds.
1) Use git to retrieve the source. git will take care of the cr/lf vs lf issue. Here is the command for retrieving Z3:
git clone https://git01.codeplex.com/z3
If you do that, you don't need to use dos2unix. So, you can remove the lines @$(DOS2UNIX) in Makefile.in. Another option is to replace DOS2UNIX=@D2U@ with DOS2UNIX=touch in the beginning of Makefile.in
After these changes, you should be able to compile it on OSX. I successfully compiled it on OSX 10.7.
2) Get the "unstable" branch.
http://z3.codeplex.com/SourceControl/changeset/view/946a06cddbe4
This is the current "working branch". It contains the new build system. It is not ready, but it is good enough to generate the Z3 executable. Here are the instructions to build Z3 using this branch
Download the code from the page above. Or use git to retrieve the "unstable" branch. Then, execute
autoconf
./configure
python scripts/mk_make.py
cd build
make
I managed to compile it on OSX 10.7 last Friday.
3) Keep the .zip, but convert all textual files. I'm using the following python script to convert all files in the new build system. If you execute this python script in the Z3 root directory, it will convert all files.
import os
import glob
import re
import getopt
import sys
import shutil
def is_cr_lf(fname):
# Check whether text files use cr/lf
f = open(fname, 'r')
line = f.readline()
sz = len(line)
return sz >= 2 and line[sz-2] == '\r' and line[sz-1] == '\n'
# dos2unix in python
# cr/lf --> lf
def dos2unix(fname):
if is_cr_lf(fname):
fin = open(fname, 'r')
fname_new = '%s.new' % fname
fout = open(fname_new, 'w')
for line in fin:
line = line.rstrip('\r\n')
fout.write(line)
fout.write('\n')
fin.close()
fout.close()
shutil.move(fname_new, fname)
if is_verbose():
print "dos2unix '%s'" % fname
def dos2unix_tree_core(pattern, dir, files):
for filename in files:
if fnmatch(filename, pattern):
fname = os.path.join(dir, filename)
if not os.path.isdir(fname):
dos2unix(fname)
def dos2unix_tree():
os.path.walk('.', dos2unix_tree_core, '*')
dos2unix_tree()
Upvotes: 3