I am trying to link a few static libraries to create the final executable for iOS using a build script. My problem is that ldalways exits with code 136. My question is: how can I find out what code 136 means? man ld does not mention any return codes at all. I found two lists of system error codes but none for ld:
System error codes from 0 to -261, System error codes from 1 to 32767
Alternatively, how can I get ld to tell me the problem. I have tried all the options for logging but none of them get it to print anything.
Typically, exit codes greater than 127 mean that a signal terminated your program. The signal number is the exit code - 128. In your case,the signal with the number 8 is SIGFPE. Seems like a floating point exception was the cause of the abort.
Related
I'm using gfortran compiler and trying to work on parallel programming without MPI. Even though, I spent too much time on reading about Fortran, gfortran, parallel programming, I couldn't do anything to use different processors at the same time.
My purpose is to create a matrix multiplication working on different processor to reduce the time. I have many ideas to do that but first of all, I have to use different processors. But even I use written codes, my computer have only one image. For example:
program hello_image
integer::a
write(*,*) "Hello from image ", this_image(), &
"out of ", num_images()," total images"
read(*,*), a
end program hello_image
This is a very simple program took from a pdf about parallel programming in Fortran. It should give the output:
Hello from image 1 out of 8
Hello from image 2 out of 8
Hello from image 3 out of 8
Hello from image 4 out of 8
Hello from image 5 out of 8
Hello from image 6 out of 8
Hello from image 7 out of 8
Hello from image 8 out of 8
But my compiler is just giving the output:
Hello from image 1 out of 1.
I use gfortran as a compiler with the command
gfortran "codename" -fcoarray=single
I spent too much time to solve this "probably simple problem" but I just couldn't solve it.
This is the output I got when I try -fcoarray=lib. That's why I was using -fcoarray=single because it is the only one that can be executed. What should I do to solve this? Thank you for help;
/tmp/ccvnPvRc.o: In function `MAIN__':
hew.f08:(.text+0x62): undefined reference to `_gfortran_caf_this_image'
hew.f08:(.text+0xa8): undefined reference to `_gfortran_caf_num_images'
/tmp/ccvnPvRc.o: In function `main':
hew.f08:(.text+0x175): undefined reference to `_gfortran_caf_init'
hew.f08:(.text+0x19f): undefined reference to `_gfortran_caf_finalize'
collect2: error: ld returned 1 exit status
Even though, I installed linuxbrew from the website of OpenCoarrays, still having the same issue. brew doctor says there is no problem at all but when I use the line
gfortran hew.f08 -fcoarray=lib -lcaf_mpi
same error appears. Should I use another package with another line? What is the package which I should download? How to download it? How to use gfortran to have a executable file? (I'm using Ubuntu)
I used
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install)"
line to install. Then, I used both of the lines for setting the path;
PATH=/home/[username]/.linuxbrew/bin:$PATH
PATH=/home/linuxbrew/.linuxbrew/bin:$PATH
Now, when I use the line
gfortran hew.f08 -fcoarray=lib -lcaf_mpi
The output is:
/usr/bin/ld: cannot find -lcaf_mpi
collect2: error: ld returned 1 exit status
I've noticed that when running gcc, if the compile failes, most of the time it returns an exit status code of '1'. However, it sometimes returns a status code of '4' (for example, if the input file does not exist). I haven't been able to find anything in the gcc documentation that covers what different error codes might mean -- does anyone know of any?
According to the official documentation of the command line switch -pass-exit-codes:
Normally the gcc program exits with the code of 1 if any phase of the compiler returns a non-success return code. If you specify -pass-exit-codes, the gcc program instead returns with the numerically highest error produced by any phase returning an error indication. The C, C++, and Fortran front ends return 4 if an internal compiler error is encountered.
I need to run an old program found here: http://netlib.sandia.gov/conformal/ under the title "kirch1" in the list. I have absolutely no experience running fortran code, but I would like to do so from my Mac OS X 10.10 command line.
I know I have the 'gfortan' compiler installed on my system, but I'm not sure if this doesn't like this older code. When I run gfortran KIRCH1.f (this file is the one above) I get the following error:
KIRCH1.f:266.8:
x(2) = -1. + dx
1
Warning: Array reference at (1) is out of bounds (2 > 1) in dimension 1
KIRCH1.f:200.21:
common /param1/ nq2,c2,x2(20),z2(20),qwork2(460),betam2(20)
1
Warning: Padding of 4 bytes required before 'c2' in COMMON 'param1' at (1); reorder elements or use -fno-align-commons
KIRCH1.f:285.21:
common /param1/ nq,c,x(20),z(20),qwork(460),betam(20)
1
Warning: Padding of 4 bytes required before 'c' in COMMON 'param1' at (1); reorder elements or use -fno-align-commons
Undefined symbols for architecture x86_64:
"_gaussj_", referenced from:
_qinitx_ in ccoKtvwZ.o
"_ns01a_", referenced from:
_ksolv_ in ccoKtvwZ.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
This error seems to be do to the syntax in the code? I doubt there is anything wrong with the code itself, so I'm thinking its something to do with my systems interpretation of the code (for lack of a better way of phrasing this)
I have no fortran programming experience, I should mention. What am I doing wrong?
EDIT
As suggested by Ed Smith
I run gfortran sclibdbl.f KIRCH1.f but I still get the following warnings:
KIRCH1.f:266.8:
x(2) = -1. + dx
1
Warning: Array reference at (1) is out of bounds (2 > 1) in dimension 1
KIRCH1.f:200.21:
common /param1/ nq2,c2,x2(20),z2(20),qwork2(460),betam2(20)
1
Warning: Padding of 4 bytes required before 'c2' in COMMON 'param1' at (1); reorder elements or use -fno-align-commons
KIRCH1.f:285.21:
common /param1/ nq,c,x(20),z(20),qwork(460),betam(20)
1
Warning: Padding of 4 bytes required before 'c' in COMMON 'param1' at (1); reorder elements or use -fno-align-commons
The following compiled for me:
gfortran sclibdbl.f KIRCH1.f
where KIRCH1.f is the code from http://netlib.sandia.gov/conformal/kirch1 and sclibdb1.f is the code from http://netlib.org/conformal/sclibdbl.
You were just missing the required subroutines gaussj and ns01a which are referenced in the KIRCH1 source code but included in sclibdbl. The code from netlib.org/conformal/sclibdbl includes both the gaussj and ns01a subroutine (note the underscore is added to routine names by default in gfortran).
As #francescalus noted, it's modern fortran compiler and old school FORTRAN code. The warning is because modern fortran is far more explicit about array extents. In this code, x is passed with size 1 to yxtran() which is okay as passing is a reference to the start of array. When element 2 is accessed the modern fortran compiler gets worried. You can remove the two common block errors by adding the -fno-align-commons flag to the compiler. The x(1) error could be removed by replacing x(1) on line 258 with x(n-1). Personally, I wouldn't worry unless you notice problems/unexpected behavior when you run the code (especially as it's from netlib).
I am using GCC ver-4.6.4 (both in Mac and Linux Mint 15) to compile a code I do for research.
The command I am using is :
gfortran -O2 -fopenmp -Wl,-stack_size,1000000 <...Lots of files...> -o a.out
, where I omit the actual file names.
This code compiles OK in Mac, however I get the following error in Mint:
/usr/bin/ld: unrecognized -a option `ck_size'
collect2: error: ld returned 1 exit status
make[1]: *** [a.out] Error 1
In Mint, this will compile if I do not use any flags at all, therefore this problem is related to OpenMP.
However, I do need OpenMP and do not understand what it says in the error, because I do not have 'ck_size'. BTW, deleting -O2 doesn't help.
The problem is not related to OpenMP, it is related to your different OS's.
-stack_size is specific to Macintosh and refers to the maximal size of arrays on the stack. Linux changes the stack size via the terminal command ulimit (to check your Mint settings type, ulimit -a to see everything, the stack size can be seen with ulimit -s, see the ulimit man page for more information).
Thus, you need to scrap that whole -stack_size,100000 portion from your compiler flag, it means nothing in Linux.
You passed -Wl,-stack_size,1000000 to gfortran, which is passing on the option "-stack_size 1000000" to the linker ld. It is interpreting "st" as single letter options "-s" and "-t", then reading the next letter as an option "-a", and the rest of the word ("ck_size") as its parameter.
I could find no reference to a -stack_size option for ld. It looks like the option is --stack, so you need to put something like -Wl,--stack,1000000 instead.
When I try to run "make all" on a makefile with some complexity I get this errors:
C:\BITCLOUD\BitCloud_PS_SAM3S_EK_1_10_0\BitCloud_PS_SAM3S_EK_1_10_0\Applications\ZAppSi\Dem o\SEDevice>make all
make -C makefiles/PC -f Makefile_PC_Gcc all APP_NAME=DemoSE
make[1]: Entering directory
'C:/BITCLOUD/BitCloud_PS_SAM3S_EK_1_10_0/BitCloud_PS_SAM3S_EK_1_10_0/Applications/ZAppSi/Demo/SEDevice/makefiles/PC'
A sintaxe do comando está incorrecta.
make[1]: *** [directories] Error 1
make[1]: Leaving directory
'C:/BITCLOUD/BitCloud_PS_SAM3S_EK_1_10_0/BitCloud_PS_SAM3S_EK_1_10_0/Applications/ZAppSi/Demo/SEDevice/makefiles/PC'
make: *** [all] Error 2
where the line
A sintaxe do comando está incorrecta.
translated to english means: "The syntax of the command is incorrect"
I already tried to change the project to different directories, check spaces in file names, using GNU make and also use MinGW make (mingw32-make) and the result is the same with both "make". I also checked for all files that are included in the makefile and they correspond.
Im not an expert in makefiles, so Im asking for help.
What is the main problem that occurs when make throws this type of error?
It is likely not make that throws this error, but a command executed by make returns with a nonzero exit status, in this case with status 1 (due to Error 1); then the top level make stops with Error 2. Note that make by default stops as soon as a command fails.
Since the output doesn't show what command was executed, there is no way to tell what went wrong exactly.
EDIT: from the GNU make manual:
-d Print debugging information in addition to normal processing.
The debugging information says which files are being considered
for remaking, which file-times are being compared and with what
results, which files actually need to be remade, which implicit
rules are considered and which are applied---everything inter‐
esting about how make decides what to do.
--debug[=FLAGS]
Print debugging information in addition to normal processing.
If the FLAGS are omitted, then the behavior is the same as if -d
was specified. FLAGS may be a for all debugging output (same as
using -d), b for basic debugging, v for more verbose basic
debugging, i for showing implicit rules, j for details on invo‐
cation of commands, and m for debugging while remaking make‐
files.
I suggest running make --debug=j to see the commands.