I'm trying to compile this project from DTU. This project requires that PETSc be installed.
I have installed PETSc to /Users/hornymoose/petsc-3.13.3/
I have extracted the zip from GitHub to /Users/hornymoose/dtu
The DTU project's makefile has the following lines:
include ${PETSC_DIR}/lib/petsc/conf/variables
include ${PETSC_DIR}/lib/petsc/conf/rules
include ${PETSC_DIR}/lib/petsc/conf/test
In these lines, {PETSC_DIR} is to be substituted with the user's PETSc installation directory. Thus, I changed these lines to:
include $/Users/hornymoose/petsc-3.13.3/lib/petsc/conf/variables
include $/Users/hornymoose/petsc-3.13.3/lib/petsc/conf/rules
include $/Users/hornymoose/petsc-3.13.3/lib/petsc/conf/test
To compile the code, I write make topopt in Terminal. Doing so yields:
makefile:13: Users/hornymoose/petsc-3.13.3/lib/petsc/conf/variables: No such file or directory
makefile:14: Users/hornymoose/petsc-3.13.3/lib/petsc/conf/rules: No such file or directory
makefile:15: Users/hornymoose/petsc-3.13.3/lib/petsc/conf/test: No such file or directory
make: *** No rule to make target `Users/jhutopopt/petsc-3.13.3/lib/petsc/conf/test'. Stop.
I have gone back and manually checked that Users/hornymoose/petsc-3.13.3/lib/petsc/conf/variables, ...rules, and ...test definitely exist and do not have errors.
Why am I receiving this error? Am I indicating the directory incorrectly in my makefile? Is the syntax in the makefile incorrect?
I'm sure there is a simple solution, I'm just very new to working with Terminal in MacOS. Thank you in advance!
There is a $ in the paths:
include $/Users/hornymoose/petsc-3.13.3/lib/petsc/conf/variables
^
This causes the / to be treated as a variable, and expanded to nothing because was never set. Run make with option --warn-undefined-variables to get a warning on that sort of thing. Perhaps already obvious at this point, but the correct line would be:
include /Users/hornymoose/petsc-3.13.3/lib/petsc/conf/variables
Rather than manually substituting the PETSC_DIR in the makefile you can provide it through an environment variable (assuming PETSc makefiles aren't bad):
export PETSC_DIR=/Users/hornymoose/petsc-3.13.3
make topopt
...or:
PETSC_DIR=/Users/hornymoose/petsc-3.13.3 make topopt
...or pass its value to the make invocation:
make topopt PETSC_DIR=/Users/hornymoose/petsc-3.13.3
While trying to compile the latest version of the apache web server(2.4.3) on my Mac (10.8) I run into a problem. When I run the ./configure command I got the following output:
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking build system type... x86_64-apple-darwin12.0.0
checking host system type... x86_64-apple-darwin12.0.0
checking target system type... x86_64-apple-darwin12.0.0
configure:
configure: Configuring Apache Portable Runtime library...
configure:
checking for APR... yes
setting CC to "/Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc"
setting CPP to "/Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc -E"
setting CFLAGS to " "
setting CPPFLAGS to " -DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK"
setting LDFLAGS to " "
configure:
configure: Configuring Apache Portable Runtime Utility library...
configure:
checking for APR-util... yes
checking for gcc... /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc
checking whether the C compiler works... no
configure: error: in `/Users/cti/Downloads/Applications/httpd-2.4.3':
configure: error: C compiler cannot create executables
See `config.log' for more details
Here are the last few lines in the log file:
## ----------- ##
## Core tests. ##
## ----------- ##
configure:3056: checking for chosen layout
configure:3058: result: Apache
configure:3861: checking for working mkdir -p
configure:3877: result: yes
configure:3886: checking for grep that handles long lines and -e
configure:3944: result: /usr/bin/grep
configure:3949: checking for egrep
configure:4011: result: /usr/bin/grep -E
configure:4027: checking build system type
configure:4041: result: x86_64-apple-darwin12.0.0
configure:4061: checking host system type
configure:4074: result: x86_64-apple-darwin12.0.0
configure:4094: checking target system type
configure:4107: result: x86_64-apple-darwin12.0.0
configure:4137:
configure:4139: Configuring Apache Portable Runtime library...
configure:4141:
configure:4182: checking for APR
configure:4327: result: yes
configure:4587:
configure:4589: Configuring Apache Portable Runtime Utility library...
configure:4591:
configure:4628: checking for APR-util
configure:4707: result: yes
configure:4968: checking for gcc
configure:4995: result: /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc
configure:5224: checking for C compiler version
configure:5233: /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc --version >&5
./configure: line 5235: /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc: No such file or directory
configure:5244: $? = 127
configure:5233: /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc -v >&5
./configure: line 5235: /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc: No such file or directory
configure:5244: $? = 127
configure:5233: /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc -V >&5
./configure: line 5235: /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc: No such file or directory
configure:5244: $? = 127
configure:5233: /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc -qversion >&5
./configure: line 5235: /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc: No such file or directory
configure:5244: $? = 127
configure:5264: checking whether the C compiler works
configure:5286: /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc -DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK conftest.c >&5
./configure: line 5288: /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc: No such file or directory
configure:5290: $? = 127
configure:5328: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| /* end confdefs.h. */
|
| int
| main ()
| {
|
| ;
| return 0;
| }
configure:5333: error: in `/Users/cti/Downloads/Applications/httpd-2.4.3':
configure:5335: error: C compiler cannot create executables
See `config.log' for more details
As you can see in the log output the script in ./configure couldn't find the path to my C compiler because it's in /Applications/Xcode.app/Contents/Developer/usr/bin/cc and not in /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/ccas it's stated in the log output
You may say that the solution is simple all I have to do is to modify the configure script, right?? well the problem with that is that I know nothing about shell script which is why I've been struggling with it for the last 3 hours.
Help please. Thanks in advance.
I was just struggling with a similar issue in this post I created and answered so I thought I would share my findings. Simply create the symlink by doing this:
# Create a symlink to default Xcode toolchain for OS X lion
sudo ln -s \
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain \
/Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain
# Create a symlink to default Xcode toolchain for OS X maverick
sudo ln -s \
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain \
/Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain
and you should at least get to the next step.
For OSX 10.9 Mavericks Apache is already installed, you can directly go to the terminal and type in the following commands
To Find the Apache Version
httpd -v
To start :
sudo apachectl start
To stop :
sudo apachectl stop
To restart :
sudo apachectl restart
I'm on OSX Mavericks and was trying to compile Apache 2.2.24 and ran into this error. I saw from other answers that the problem was with apxr and thus APR returning the wrong location for gcc. Apple supplies this and the Apache config was using the Apple supplied one.
On a whim, I looked and saw that the configure script has an option to ignore the system supplied APRs and use its own.
So I did this:
./configure --with-included-apr
And it got past the configure step and compiled without errors.
checking for gcc... /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc
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 /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc accepts -g... yes
checking for /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc option to accept ISO C89... none needed
checking how to run the C preprocessor... /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc -E
checking for /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc option to accept ISO C99... none needed
checking for pcre-config... false
configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/
====
I've downloaded the pcre-config, ran: ./configure;make;make install
and now..... Tcharammmm! Httpd apache full installed :D
OSX Yosemite (10.10.5):
The accepted answer worked for me:
$ cd /Applications/Xcode.app/Contents/Developer/Toolchains
$ ln -s XcodeDefault.xctoolchain/ OSX10.10.xctoolchain
^ ^
| |
existing dir(or file) link name
(Explanation of why that works below.)
Then:
httpd-2.4.18$ ./configure (php may require an additional option)
If you are also going to install php, you may need to add another option to ./configure.
The basic instructions for installing php on Unix also give instructions on how to install apache:
./configure --enable-so
make
make install
Apache's configuration help says this:
httpd-2.4.18$ ./configure --help
...
...
--enable-so DSO capability. This module will be automatically
enabled unless you build all modules statically.
That seems to indicate that the --enable-so option might be a default option, but the apache install instructions do not even mention --enable-so. In the apache 2.2 docs for configure, I found this:
Modules, disabled by default
Some modules are compiled by default and have to be enabled explicitly...
...
...
--enable-so
...
The apache 2.4 docs for configure do not mention --enable-so. Instead, they tell you to look at the output of ./configure --help under Optional features, which lists --enable-so.
As a result, I think you should configure apache like this:
httpd-2.4.18$ ./configure --enable-so
========
INSTALLING PHP
In order to get mysql to work with php, I had to reinstall php and change the following line in the php install docs:
php-7.0.2$ ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql
to:
php-7.0.2$ ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-pdo-mysql
With the first one, the configure output said that the --with-mysql option doesn’t exist--otherwise php installed fine, and php files in apache's htdocs directory were executed by php.
The problem is that php has changed its mysql support, and mysql_connect() is deprecated(and removed from php7), so now you need the pdo-mysql adapter, as described in the php docs.
After reinstalling php, the last lines of make install said this:
You may want to add: /usr/local/lib/php to your php.ini include_path
php.ini is located here: /usr/local/lib/php.ini, and I made that change:
include_path = ".:/php/includes:/usr/local/lib/php"
Then I restarted apache, made sure mysql was running, and I entered the following url in my browser:
http://localhost:8080/mysql_test.php
and my test PDO script worked (located in the directory /usr/local/apache2/htdocs):
<?php
$user = 'root';
$password = ’root_password_here’;
$host = 'localhost';
$dbname = 'my_db';
$pdo = new PDO(
"mysql:host=$host; dbname=$dbname",
$user,
$password
);
$statement = $pdo->query("SELECT 'Hello, dear MySQL user!' AS _message FROM DUAL");
$row = $statement->fetch(PDO::FETCH_ASSOC);
echo htmlentities($row['_message']);
?>
===========
After getting the same error message as the op, I checked config.log in the httpd-2.4.18 directory, and a line in there says:
./configure: line 5326: /Applications/Xcode.app/Contents/Developer/Toolchains/
OSX10.10.xctoolchain/usr/bin/cc:
No such file or directory
So the configure script is looking for:
A directory named:
/Applications/Xcode.app/Contents/Developer/
Toolchains/OSX10.10.xctoolchain/usr/bin/
A file named cc in that directory.
Okay, let's see if cc is in that directory:
~$ cd/Applications/Xcode.app/Contents/Developer/Toolchains/
OSX10.10.xctoolchain/usr/bin/
-bash: cd: /Applications/Xcode.app/Contents/Developer/Toolchains/
OSX10.10.xctoolchain/usr/bin/: No such file or directory
That means the directory does not exist. Now you have to figure out which directory in that long path is the one that doesn't exist:
~$ cd /Applications/Xcode.app
/Applications/Xcode.app$ cd Contents/Developer
/Applications/Xcode.app/Contents/Developer$ cd Toolchains/OSX10.10.xctoolchain
-bash: cd: Toolchains/OSX10.10.xctoolchain/: No such file or directory
/Applications/Xcode.app/Contents/Developer$ cd Toolchains
/Applications/Xcode.app/Contents/Developer/Toolchains$ ls
XcodeDefault.xctoolchain
You can see that there is no directory named OSX10.10.xctoolchain--there is only a directory named XcodeDefault.xctoolchain. As a result, the configure script can't locate the directory OSX10.10.xctoolchain in the path that it is using to find the cc file. Why is configure looking for that directory? Because either the dev who wrote the script screwed up or Apple screwed up.
The real goal of configure is not to find a directory but to find the pesky cc file. It turns out that the cc file is located here:
/Applications/Xcode.app/Contents/Developer/Toolchains/
XcodeDefault.xctoolchain/usr/bin$ ls
...
cc
clang
...
...
And for the more curious:
/Applications/Xcode.app/Contents/Developer/
Toolchains/XcodeDefault.xctoolchain/usr/bin$ ls -al cc
lrwxr-xr-x 1 7stud admin 5 Oct 29 15:22 cc -> clang
cc is just a link to Xcode's clang compiler.
The accepted answer creates a link from the name OSX10.10.xctoolchain to the directory that actually contains the cc file (albeit several directories deeper) XcodeDefault.xctoolchain:
Applications/
Xcode.app/
Contents/
Developer/
Toolchains/
XcodeDefault.xctoolchain/
OSX10.10.xctoolchain/ -> XcodeDefault.xctoolchain/
usr/
bin/
cc
In other words, after creating the link the two paths:
/Applications/Xcode.app/Contents/Developer/Toolchains/
XcodeDefault.xctoolchain/usr/bin
/Applications/Xcode.app/Contents/Developer/Toolchains/
OSX10.10.xctoolchain/usr/bin
will be equivalent. The names XcodeDefault.xctoolchain and OSX10.10.xctoolchain will be aliases for the same directory.
====
I don't understand #AlphaZygma's answer. It advises adding the following two directories to your PATH (via /etc/paths):
/Applications/Xcode.app/Contents/Developer/usr/bin
/Applications/Xcode.app/Contents/Developer/Toolchains/
OSX10.8.xctoolchain/usr/bin
On my system, the first directory does not contain a cc file, so there's no reason for me to add that directory to my PATH.
The second directory is the directory that configure says it can't find. Adding a non-existent directory to your PATH still means it's non-existent.
In any case, the configure script does not seem to be searching the PATH directories for cc because the error message lists a non-exist path as the problem. How would searching the PATH directories result in the error message listing a non-existent path? The configure script seems to be getting directions from somewhere else telling it where to search for cc.
I'm not sure why #AlphaZygma inserted the new paths between some of the existing paths in /etc/paths. Why not add the new paths below the existing paths?
I tried several different versions of this answer, but nothing worked for me.
====
I looked at the output of ./configure --help:
Usage: ./configure [OPTION]... [VAR=VALUE]...
To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE. See below for descriptions of some of the useful variables.
...
...
Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
LIBS libraries to pass to the linker, e.g. -l<library>
CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
you have headers in a nonstandard directory <include dir>
CPP C preprocessor
Hey, CC is listed there. Let's try:
$ ./configure CC=/Applications/Xcode.app/Contents/Developer/
Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
...
...
checking for APR... yes
setting CPP to "/Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.10.xctoolchain/usr/bin/cc -E"
setting CFLAGS to " "
setting CPPFLAGS to " -DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK -DDARWIN_10"
setting LDFLAGS to " "
configure:
...
...
configure: error: C compiler cannot create executables
Looking at the output a little more carefully there is this line:
setting CPP to "/Applications/Xcode.app/Contents/Developer/Toolchains/
OSX10.10.xctoolchain
The configure script is still mentioning that non-existent path in conjunction with CPP. Looking at the output of ./configure --help again:
Usage: ./configure [OPTION]... [VAR=VALUE]...
To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE. See below for descriptions of some of the useful variables.
...
...
Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
LIBS libraries to pass to the linker, e.g. -l<library>
CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
you have headers in a nonstandard directory <include dir>
CPP C preprocessor
The last line lists the variable CPP, which was mentioned in the error line. Let's try:
$ ./configure \
> CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc \
> CPP=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
...
...
checking how to run the C preprocessor... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
configure: error: in `/Users/7stud/Downloads/httpd-2.4.18':
configure: error: C preprocessor "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc" fails sanity check
See `config.log' for more details
Now all the paths are correct in the error message, but something "fails sanity check". I give up! Maybe someone else can pick up where I left off.
Okay, thanks to the suggestions here, the following works:
$ ./configure \
> CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc \
> CPP='/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -E'
and that can be shortened to:
$ ./configure \
> CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc \
> CPP='cc -E'
But then make failed:
$ make
...
/usr/share/apr-1/build-1/libtool: line 8962: /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.10.xctoolchain/usr/bin/cc: No such file or directory
Once again the non-existent path is mentioned--this time in conjunction with libtool. That's as far as I'm going down that rabbit hole.
Ran into same issue, on Mac OS X 10.9 (Mavericks); yes as user3097424 states, Apache is pre-installed for Mavericks users, though for me, version 2.2. Therefore, needing to upgrade to 2.4, do as Adrian Rodriguez says and create a symlink, replacing '10.8' with '10.9':
sudo ln -s /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain
Instead of creating a symlink, you could just add the path to your library path, just use the appropriate directories to your OSX Version.
So, in your case, it may look like
[user#host ~]$ sudo vi /etc/paths
/usr/bin
/Applications/Xcode.app/Contents/Developer/usr/bin
/Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin
/bin
...
I think this approach is a bit cleaner without having to add symlinks in different places as expected by different tools.
Anyway, this is just an alternate solution.
Hope this helps.
#AlphaZygma this worked great for me. I'm on 10.8.5 and had to add the following to /etc/paths:
/Applications/Xcode.app/Contents/Developer/usr/bin
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
instead of yours.
Complete solution that allowed me to pass through:
checking for gcc... /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc
checking whether the C compiler works... no
issue can be found here:
http://mac-dev-env.patrickbougie.com/apache/
The command are (some needs sudo su):
cd /usr/local/src (mkdir /usr/local/srt if /usr/local/src doesnt exist)
curl --remote-name http://mirror.csclub.uwaterloo.ca/apache/httpd/httpd-2.4.9.tar.gz
tar -xzvf httpd-2.4.9.tar.gz
rmhttpd-2.4.9.tar.gz
cd httpd-2.4.9
sudo xcode-select -switch /
mkdir -p /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain/usr/bin (this might require sudo su)
ln -s /usr/bin/cc /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain/usr/bin/cc (this might require sudo su)
./configure --prefix=/usr/local/apache-2.4.9
make
make install
ln -s apache-2.4.9 /usr/local/apache
I just recently updated to Mavericks and was re-creating my web development environment (including installing port). I had this problem when I was upgrading port:
checking whether the C compiler works... no
I thought I had everything setup, including installing XCode from the App Store. But kept having issues. I was able to fix it by actually running XCode once, accepting the license agreement, and letting XCode startup fully. The next time I tried to upgrade port I did not get the error above.
Everybody
I have a small problem . I just doing it for experiment. I'm using ubuntu 10.04
my problem is that my c program name 2.c is at /home/Desktop (location) but my .o files are at different location /tmp/man(location of 3.o) /usr/jan(location of 4.o)
I complied the program form home account by command
gcc"/home/Desktop/2.c""/tmp/man/3.0"/usr/jan/4.0 "
but every time i compile the program it shows error like that
bash: gcc/home/Desktop/2.c/tmp/man/3.0: No such file or directory.
what I'm doing wrong ?
can any body what is the proper way to run the program
one request please don't tell to paste the all file in same folder than use gcc or changind ld_library path .
if You are giving me suggestion about makefile than please give the complete make file .
just tell me how i can compile and run the program ?
First, don't use " to separate the arguments, use spaces. Also, you wrote 3.0 and 4.0 (with zero, not oh). Then, do you want to compile the 2.c file and link it with the 3.o and 4.o files ? You just have to call
> gcc /home/Desktop/2.c /tmp/man/3.o /usr/jan/4.o -o /your/path/exefile
This will compile 2.c, link it with 3.o and 4.o and build the exefile executable in the specified path.
Try
$ gcc /home/Desktop/2.c /tmp/man/3.o /usr/jan/4.o
Why on earth do you have .o files in /tmp/man?
I tried to build OCaml batteries included 1.3.0 on my Mac OS X 10.6.6 (MacBook Air3,2) but couldn't.
OCaml itself and denpending libraries versions are as follows:
OCaml : 3.11.2
findlib : 1.2.6
OUnit : 1.1.0
camomile : 0.8.1
make : 3.81
I'm not using GODI for installation. Are there anyone who runs OCaml batteries included on you Mac and if there are, can you let me know your libraries versions? Further more, could you find any solution for fixing this error?
% make all
cp -f src/batCamomile-0.8.1.ml src/batCamomile.ml
test ! -e src/batteries_config.ml || rm src/batteries_config.ml
ocamlbuild syntax.otarget byte.otarget src/batteries_help.cmo META shared.otarget
Finished, 0 targets (0 cached) in 00:00:00.
+ ocamlfind ocamlopt -shared -linkall -package camomile,num,str -o src/batteries_uni.cmxs src/batteries_uni.cmxa
ld: warning: -read_only_relocs cannot be used with x86_64
ld: codegen problem, can't use rel32 to external symbol _caml_negf_mask in .L101 from src/batteries_uni.a(batFloat.o)
collect2: ld returned 1 exit status
File "caml_startup", line 1, characters 0-1:
Error: Error during linking
Command exited with code 2.
Compilation unsuccessful after building 479 targets (478 cached) in 00:00:01.
make: *** [all] Error 10
Thanks,
Yoshi a.k.a. ymotongpoo
On Mac OS, you must disable native shared library building. Use the BATTERIES_NATIVE_SHLIB=no argument to Make to accomplish this:
$ make all install BATTERIES_NATIVE_SHLIB=no
The GODI package sets this parameter by default on Mac, but you must set it manually when building from source yourself. You need to set this parameter on every invocation of make (or set it as an environment variable).
Finally, I highly recommending using GODI. It makes managing an OCaml installation far easier than doing it by hand.
I reported to bug tracker and the cause of make test qtest failure is -n option of echo command.
https://github.com/ocaml-batteries-team/batteries-included/issues#issue/122
At first in OS X, option BATTERIES_NATIVE_SHLIB=false has to be set. And still, you need to modify Makefile to run test successfully.
Latest version in the repository has been fixed but if you want to build 1.3.0 tarball, modify Makefile as follows:
#put all the testing modules in a library
qtest/test_mods.mllib: $(TESTABLE)
- echo -n "Quickcheck Tests \c" > $#
+ echo "Quickcheck Tests \c" > $#
echo $(patsubst src/%.ml,%_t, $(TESTABLE)) >> $#
or, you can use /bin/echo
#put all the testing modules in a library
qtest/test_mods.mllib: $(TESTABLE)
- echo -n "Quickcheck Tests \c" > $#
+ /bin/echo -n "Quickcheck Tests \c" > $#
echo $(patsubst src/%.ml,%_t, $(TESTABLE)) >> $#
Both way work.
I have a Makefile of the following content:
NUMBERS = 1 2 3 4
lib:
$(foreach var,$(NUMBERS),./a.out $(var);)
And this is the command that I run ( in the same directory as the Makefile)
make -f Makefile
But I got an error message saying that "The system cannot find the file specified".
Following the suggestion of one of the answers, I created the following file inside the same directory as the Makefile:
a.out
1.out
2.out
3.out
4.out
Now the error becomes:
./a.out 1; ./a.out 2; ./a.out 3;
./a.out 4; make (e=-1): Error -1 make:
*** [lib] Error -1
Note: I am running on Windows XP platform
The purpose of make is to create (and update) target files that depends on source files by running commands.
Here, the problem is with the command that is run. You are trying to run (through make) the command a.out but it does not exist, or is not an executable command. Try to replace a.out in your makefile by the actual executable command you want to run.
On Windows/DOS, use && instead of ; to join multiple commands on one line. You have to manually include a final command or the trailing && will throw a syntax error. Try something like:
NUMBERS = 1 2 3 4
lib:
$(foreach var,$(NUMBERS),.\a.out $(var) && ) echo.
It seems to me that the error comes because the file a.out cannot be located and not because the makefile could not be found.
Also if the name of your makefile is "Makefile" just invoking "make" is enough (without using -f option) as make by default would look for a file by names: GNUmakefile, makefile, and Makefile in that order.
Just what are you trying to do?
It seems to me that a plain script would be better suited rather than using make.
I found the answer by bta most useful, but it didn't work for me on both Windows and Linux, so I found a way to remove the final &&, which avoids the need for a no-op command that works on both platforms:
NUMBERS = 1 2 3 4
lib:
$(filter-out &&EOL, $(foreach var,$(NUMBERS), .\a.out $(var) &&)EOL)
Of course be careful of elements within your array matching &&EOL, but in my case, this isn't a problem.