File "_none_", line 1: Error: Required module '<>' is unavailable - makefile

The make file has been executed, there is no bug reporting from each file. However, in terminal, I received:
File "_none_", line 1:
Error: Required module `Prettyprint' is unavailable
The Prettyprint.ml is one of my files. What does this error report mean? Thank you for your help.
First edit:
My makefile looks like:
#echo "# Lexer & Parser:"
ocamlc -g -c parser.mli lexer.ml parser.ml
#echo "# mainfile"
ocamlc -g -c TransitionalSemantics.ml
ocamlc -g -o main str.cma AbstractSyntax.cmo
TransitionalSemantics.cmo Prettyprint.cmo StaticSemantics.cmo
lexer.cmo parser.cmo
In my terminal, the error report begins at:
ocamlc -g -o main str.cma AbstractSyntax.cmo
TransitionalSemantics.cmo Prettyprint.cmo StaticSemantics.cmo
lexer.cmo parser.cmo
File "_none_", line 1:
Error: Required module `Prettyprint' is unavailable
make: *** [all] Error 2

Object files must be linked in an order compatible with their dependency digraph: if one of your module depends on the Prettyprint module, it must be linked after prettyprint.cmo.
Starting with 4.13, the error message is more informative and looks like
File "_none_", line 1:
Error: Wrong link order: B depends on A, B depends on A

You should show exactly what you did to get this error. Otherwise we have to guess :-)
The File "_none_" part means that you're typing in the toplevel so there's no file per se.
The Error part means that the toplevel can't locate your module named Prettyprint. Possibly you need to load it before you do whatever else you did:
# #load "prettyprint.cmo"
(The first # here is the toplevel prompt. The second one is something you should actually type.)
If you expand your question to include more details you will possibly get a more helpful answer.

Related

Ada Compilation Print full path

Simple question. I am compiling an ada program with gnat. The gcc command ends up looking like gcc -c -Ia -Ibunch -Iof -Iincludes -I- -o /some/object/file.o /some/source/file.adb however the error format consists of just file.adb:line:offset: problem.
Is there any way to get GNAT make or gcc to print the full path to the file in its errors, as specified on the command line? IE: to get /some/source/file.adb:line:offset: problem.
I know that with the -gnatv one could argue that it prints the full path, but I want something significantly less verbose than that.
you need -gnatef option:
-gnatef
Display full source path name in brief error messages.
gcc -gnatef -c %CD%\file.adb
C:\DATA\jff\data\python\stackoverflow\file.adb:1:01: "procedure" expected
https://gcc.gnu.org/onlinedocs/gcc-4.3.6/gnat_ugn_unw/Switches-for-gcc.html

Include mpi to make file

I am trying to include MPI compiler to my makefile. The makefile is already prepared such that I only need to include the address of the MPI compiler in a a separate env file. However doing so does not work. I can get the cpp file to run manually by typing:
mpicxx Demo_00.cpp -o aprogram
./aprogram
I test where the mpi compiler is located using:
which mpicxx
/usr/bin/mpicxx
In the env file the corresponding line is:
MPICXX=/usr/bin/mpicxx
However, when I try to 'make' he cpp file I get the following error:
make Demo_00
g++ Demo_00.cpp -o Demo_00
Demo_00.cpp:2:17: fatal error: mpi.h: No such file or directory
compilation terminated.
make: *** [Demo_00] Error 1
The cpp file is in the same folder as the env file and the makefile.
I am not quite sure how to identify the error.
Thank you for your help,
Tartaglia
If you want to change the name of the C++ compiler, you have to change the variable CXX. That's the default variable make uses when it wants to compile C++ code.
This line in your log file:
g++ Demo_00.cpp -o Demo_00
says that you are using g++ compiler instead of mpixx.
Usually in makefiles compiler definition is at the beginnig of the file and looks like this:
CC=g++
just change it to mpixx
CC=mpixx
Thank you all for your responses, I took a closer look into the makefile I thought I was using and it turns out, as you have already suggested, I was not using it at all. The makefile was only able to execute one specific cpp file with one specific name. So whenever I typed in make *.cpp I was using the standard make as you already pointed out.
Thanks again for your help.

why is gcc gets executed in this make file?

I have the following makefile when type make i got the following output. why is gcc gets called in this case?
nasm -felf ./source/multiboot.s
gcc multiboot.o -o multiboot
gcc: error: multiboot.o: No such file or directory
gcc: fatal error: no input files
compilation terminated.
make: *** [multiboot] Error 4
makefile:
CC=gcc
ASM=nasm
ASMFLAG=-felf
SOURCE=./source/
all: multiboot
multiboot.o: $(SOURCE)multiboot.s
$(ASM) $(ASMFLAG) $(SOURCE)multiboot.s
The "all" command depends on "multiboot", but there is no explicit rule defining how to produce "multiboot". In this case, Make uses a predefined rule that understands that, if the "$target.o" target exists, then "$target" can be constructed from "$target.o" by running the linker (in this case, GCC).
It seems like the problem in this case is that your instructions for the "multiboot.o" command does not actually produce the file "multiboot.o" as output. Try simply doing:
multiboot.o: multiboot.s
(That is, without specifying the command to run). Simply declaring this dependency should, by a similar mechanism, result in an implicit rule/command to create the "multiboot.o" output from "multiboot.s".

Fortran 77 with BLAS - can't figure out how to compile

I'm trying to get BLAS working with in a FORTRAN 77 program, but so far I've been unsuccesful and I can't figure out how to get going with this. For reference I'm doing this under Ubuntu 12.10.
This is the code of the program I'm trying to compile:
program blastest
implicit none
include 'cblas_f77.h'
end
The file cblas_f77.h resides in /usr/include, and there are both libblas.a and libblas.so (and a bunch of other BLAS related files) in /usr/lib.
How do you configure this to work properly?
So far, I've tried the following:
Note: adding -lblas to either of the options make no difference at all...
Just f77, no options (didn't really expect this to work, but what the heck...):
$ f77 blastest.f -o blastest
MAIN blastest:
Cannot open file cblas_f77.h
/usr/bin/f77: aborting compilation
f77 with include option to find the header file. Now, instead it fails on (despite the file name) not being coded with FORTRAN 77 in mind, so the first six columns are nonempty...
$ f77 blastest.f -o blastest -I/usr/include
MAIN blastest:
Error on line 1 of /usr/include/cblas_f77.h: nondigit in statement label field "/* "
Error on line 2 of /usr/include/cblas_f77.h: labeled continuation line (starts " * cbl")
Error on line 3 of /usr/include/cblas_f77.h: labeled continuation line (starts " * Wri")
...
Full output: http://pastebin.com/eZBzh9N5
Switched to gfortran, to be more flexible with the spacing in the header file:
$ gfortran blastest.f -o blastest -I/usr/include
Warning: cblas_f77.h:9: Illegal preprocessor directive
Warning: cblas_f77.h:10: Illegal preprocessor directive
Warning: cblas_f77.h:12: Illegal preprocessor directive
...
Full output: http://pastebin.com/P71Di9pR
OK, so I guessed I need -cpp to get the preprocessor working. That gave exactly the same output as above. Also, if you keep reading you see that the full output, the compiler is still complaining about labelled continuation lines further down...
I believe that you are using the C library "cblas". I would recompile with this command:
gfortran blastest.f -o blastest -L/usr/lib -lblas
and this should sort it all out. I do not believe (though i am not sure) that you need to make use of the "include" statement.

GCC says "syntax error before numeric constant" in generated header file from bison

When I compile my .y file with bison parser.y -d -t and then include the parser.tab.h file in my flex file, gcc says "error: syntax error before numeric constant." It's referencing line 32, which is the first line in the enum of yytokentype.
enum yytokentype {
BREAK = 258,
... }
The error is about the line "BREAK = 258." I honestly don't know why this is happening--I would really like to use the generated yylval and I need it from this header file. Even if I declared yytokentype like this in my flex file, I would get the same error. Anything I could be doing wrong?
Is BREAK defined somewhere else in your code? I get a similar error from the following toy example:
#define BREAK 10
enum yytokentype {
BREAK = 258
};
Build example:
$ cc -c file.c
file.c:4: error: expected identifier before numeric constant
Presumably BREAK is already defined somewhere in the flex output file, so after the preprocessor runs you are getting a statement like 99 = 258 or something. Try looking at the output of cpp yy.lex.c or gcc -E yy.lex.c. I looked at a flex output file but did not find BREAK anywhere in it, only YY_BREAK.

Resources