In my configure.ac file I have warnings and errors like this one:
AC_MSG_ERROR([Could not find the Boost Math header files, did you specify the --with-boost-include-path option correctly?])
I'm old-fashioned and like to keep the line width less than 80 characters. However, when I split the line like this (I like some proper indentation as well)
AC_MSG_ERROR([Could not find the Boost Math header files, did you
specify the --with-boost-include-path option correctly?])
the error message keeps the line break and indentation when printed on the screen by ./configure.
What is the proper way to break a string in Autoconf?
This is an old question, but I found another solution, you can use m4_normalize like this:
AC_MSG_ERROR(m4_normalize([Could not find the Boost Math header files, did you
specify the --with-boost-include-path option correctly?]))
Or even:
AC_MSG_ERROR(m4_normalize([
Could not find the Boost Math header files, did you
specify the --with-boost-include-path option correctly?
]))
For doing something like this it might be helpful to define M4 macros:
m4_define([bst_e1], [Could not find the Boost Math header files[,] did you])
m4_define([bst_e2], [specify the --with-boost-include-path option correctly?])
AC_MSG_ERROR(bst_e1 bst_e2)
You could also do this when the configure script is run, since AC_MSG_ERROR will take a variable:
variable=$(cat | tr '\012' ' ' <<ΕΟF
Could not find the Boost Math header files, did you
specify the --with-boost-include-path option correctly?
ΕΟF
)
AC_MSG_ERROR($variable)
Well, after reading a bit more and trying a few things out, it seems I can get rid of the line breaks in the output by breaking the string with a \, but it looks like I won't be able to keep the indentation in the source:
AC_MSG_ERROR([Could not find the Boost Math header files, did you \
specify the --with-boost-include-path option correctly?])
produces:
configure: error: Could not find the Boost Math header files, did you specify the --with-boost-include-path option correctly?
whereas
AC_MSG_ERROR([Could not find the Boost Math header files, did you \
specify the --with-boost-include-path option correctly?])
gives:
configure: error: Could not find the Boost Math header files, did you specify the --with-boost-include-path option correctly?
Related
The problem arises firstly from the "isfinite" function: (undefined reference to isfinite). From google search I find that I must include "math.h" and write three lines of code, like:
ifdef __linux__
define _finite(v) (__builtin_isfinite(v))
endif
But then, there comes the error: (Make:47 missing endif. Stop).
If I comment out those three lines of code, the error becomes: (<math.h> no such file or directory).
My system is OpenSUSE Leap 15.4; gcc version 7; gnu make version 4.2.1-7.3.2.
I think I have installed all the needed packages. However the errors persist. Any help?
I primarily want to address this part of the question, as the underlying issue has been addressed elsewhere, multiple times:
The problem arises firstly from the "isfinite" function: (undefined reference to isfinite). From google search I find that I must include "math.h" and write three lines of code, like:
ifdef __linux__
define _finite(v) (__builtin_isfinite(v))
endif
I started to write "Google led you astray", but I think it's more likely that you seriously misunderstood what it led you to. And perhaps you happened to choose poor results.
The error message indicates that you put those lines in your makefile, but they are wholly inappropriate for that. Don't put them there.
The lines are C preprocessor directives that have been stripped of their leading # characters. You would use them by restoring the # characters ...
#ifdef __linux__
#define _finite(v) (__builtin_isfinite(v))
#endif
... and putting the resulting lines into one or more of your C source files. BUT DON'T! Those lines are unnecessary and at best unhelpful.
You do need to #include <math.h> in each C source file that contains a call to isfinite(), because that is the header that provides a declaration of the function. Since C99, functions must be declared before they are called (and it was good practice well before then).
Other than that, with GCC and many other traditional-style Unix C compilers, you need to explicitly include the math library in your link when you need any of the functions it provides. That would involve adding -lm to your makefile, at the end of the gcc command that builds the final executable. This is covered in gcc will not properly include math.h, and many other duplicates on this site.
There is a LIBS environment variable for mpicxx. But the man page only says
Libraries added when invoking the linker
I wish to know detailed syntax for this variable, for example, should we prefix -L before directory, should we just write the directory name or the lib filename, should we separate multiple libraries by space or comma or something else, etc.? I tried to google the syntax but could find no information about it. So I ask here. Thanks for your help.
I wish to know detailed syntax for this variable
The LIBS variable recognized by MPI compiler wrappers is not specific to those programs, and it does not have a syntax of its own. The variable is just expanded (unquoted) to form part of the link command line, at a position among the arguments appropriate for the designation of libraries to include in the link. The general syntax is a subset of the syntax of shell commands, and the specific significance of the contents is governed by linker.
Do note that to the extent that it matters, "the linker" is probably not ld directly, but rather (for mpicxx) a C++ compiler front-end such as g++. You specify libraries and library search path entries in the same form that you would do when linking your program with a non-MPI C++ compiler.
should we prefix -L before directory
If you want to add directories to the library search path then yes, you would use -L options.
should we just write [...] the lib filename
Most conventional would be to use -l options, so to link libfoo.so, you would use -lfoo. Alternatively, you should also be able to specify a relative or absolute path to the library file (without -l), in which case the search path is irrelevant. Specifying libraries via a specific path is normally used only for libraries built as part of the same project.
should we separate multiple libraries by space or comma or something else
You are specifying options and arguments that are expanded to be part of a shell command. Multiple arguments must be separated by whitespace.
etc.
The details all follow from the manner in which the variable is used, as already described. Some available features (but not usually anything described above) may vary from system to system, depending on the options recognized by the underlying linker.
I have a linux project I want to port to windows. Under Linux I did set up my makefile to run x86_64-w64-mingw32-g++ when I do call make ARCH=win
The problem is that some headers I need (tcl.h and friends) are located under '/usr/include' and if I pass that directory with the -I flag I will get a header collision for headers like stdlib.h which obviously are different for windows.
Is there a way around this besides copying the needed tcl headers into another location?
There is a sequentially order the compiler will look for header files. But no you cannot cherry pick the header file location.
A solution that you can try with this problem is using -I/usr and patch your project with the sed utility to convert the required headers like <tcl.h> to <include/tcl.h>. On top of that you can use the preprocessor to avoid patching every time your project.
I'm talking about this things:
warning: ds segment base generated, but will be ignored in 64-bit mode
I know that -w option can be used to suppress warnings in NASM, but from the list of warnings showed by the help menu nothing fits this type of warning. And -w-all gets rid of everything, except this.
Any way of doing this?
Since that particular error doesn't seem to be one of the suppressible ones (as you've stated, I'd just use sed as a post-processing step, piping the output through something like:
sed '/^warning: .. segment base generated, but will be ignored in 64-bit mode$/d'
Even if you're using nasm on Windows, you can still get the GNUWin32 port of sed to do the job.
And before you complain about this being a kludge, you should know that some of my greatest achievements were kludges, and many of them have out-lived my more well-designed code.
:-)
In Android.mk, I read the context of system environment variable like $(MY_ENV_VARIABLE). The env variable contains following string inside "Program(x86) Files".
But the build fails, claiming that the specified library cannot be found. The failure takes place of windows style weird space in "Program(x86) Files".
So my question is, is there any mechanism to automatically escape the special symbols like space (i.e "Program(x86)\ Files", for my case).
You might be able to try using the windows pathing conventions of using the tilde character so instead of C:\Program(x86) Files\mydir it would be C:\PROGRA~2\mydir (PROGRA~1 is for the 64 bit program files).
Like eldar said in the comments it is better to not use spaces in path names because most of make's functions use spaces as delimiters. Another option you could try is to take a look at my suggestion here: WINAVR not finding file in include path with whitespace
Since Android is a pretty complicated build environment it might be hard to see where to place the final substitution unless you know what you're doing and hopefully won't break anything else in the makefile.