Undefined symbols for NETCDF 4.2 #13050
Comments
This will be difficult to debug as I don't have access to ifort any longer, so I cannot test it. Generally, if you're not using our gfortran distribution to build things you may be on your own since we can't debug what we can't reproduce. However, it would be very useful to see the output of |
@2bits Any Fortran code calling NETCDF can reproduce this: program main
use netcdf
integer ncid, ierr
ierr = nf90_open("test.nc", nf90_nowrite, ncid)
end program main @Sharpie I can't copy the output in a gist, maybe it is too long? When I linked with the static libs, it succeeded:
|
I get an error when I try to compile that code. I named it
|
@2bits You need to install |
I did install netcdf with |
I have a bit of experience with netcdf so I might be able to help. @2bits: It seems to be creating NETCDF.mod rather than netcdf.mod. Try to add -I/usr/local/include. Strange that the compiler seems to be looking for it in lower case. I wonder if the gfortran modules are working on case sensitive file systems. @dongli: I don't have access to ifort on mac, but I tried on Linux, and it seems fine. Can you gist nm /usr/local/lib/libnetcdff.5.dylib? The build log would also help. I have had problems pasting into github's gist form at times (usually because the output contains non-printable characters). You might try creating an empty gist, then cloning git repo it creates and adding the content from the commandline. I have had to resort to that before. |
The reason I ask for the install output is that ifort and GCC/Clang (can't tell which you are using without a build log) could have different name mangling schemes. So, if the dynamic library was assembled by GCC/Clang instead of ifort, then there may be some extra underscoring going on. If this guess is correct, you may need to pass some extra flags to |
@jbeezley thanks for the info. This worked:
What I don't understand is what I'm looking for. The symbol the example uses, But the OP said this was missing:
Because
|
It looks like I have to give them my name, address, and phone number to try Intel's iFort for 30 days. I think I'll pass. |
ifort and gfortran mangle names differently particularly with functions in modules. For ifort, it generally looks like mp. gfortran uses . There are also issues with how many underscores go after the name. The reason I asked for a gist of the symbol names in libnetcdff.dylib was to see what sort of convention was in this file and if the strerror function was missing entirely or just mangled differently. In any case, I suspect this is probably an upstream issue. Splitting the fortran and c interfaces has been a difficult transition. |
@jbeezley I have upload the output of It looks like that there is no F90 interface. @Sharpie The compilation output of |
None of the fortran 90 subroutines are being linked into the shared library. Here is the reason why: ifort: command line warning #10006: ignoring unknown option '-force_load,../f90/.libs/libnetcdff90.a' They need to fix this upstream with the proper flag for ifort. |
Nice one. I wonder if |
@jbeezley There seems a similar issue http://www.unidata.ucar.edu/support/help/MailArchives/netcdf/msg10626.html, which is related to |
If the default |
That issue you linked implies the problem is with libtool. If you have automake and libtool brewed, then you can try to run autoreconf like this: def install
system 'autoreconf', '-ivf'
ENV.fortran if fortran?
common_args = %W[
--disable-dependency-tracking
--prefix=#{prefix}
--enable-static
--enable-shared
] After each |
@2bits I have added
|
Strange. Maybe each subformula needs autoreconf also. Gist the output of NetcdfCXX.new.brew do
system 'autoreconf', '-ivf'
system './configure', *common_args
system 'make install'
system 'make check'
end unless no_cxx?
NetcdfFortran.new.brew do
system 'autoreconf', '-ivf'
system './configure', *common_args
system 'make install'
system 'make check'
end if fortran? |
@2bits I added
|
@dongli I just got that same error. You hit a bug in our formula. We set the PATH in the formula incorrectly. Below you can see how it has an extra space.
The space instead of a ENV.prepend 'PATH', bin Change that to be: ENV.prepend 'PATH', bin, ':' |
Oops, that was my bad. Should be fixed now. |
Thanks @Sharpie. It turns out that the netcdf website has a FAQ about iFort and MacOSX: They give us the fix too. We probably only have to check if |
@2bits It works now! |
Great news. We'll add the |
Netcdf when built with `--enable-fortran` using the Intel Fortran compiler, ifort, does accept the `--force-load` option, causing a build error where libnetcdff.dylib is missing all the f90 symbols. The solution is in a FAQ on their website: Set lt_cv_ld_force_load=no http://www.unidata.ucar.edu/software/netcdf/docs/known_problems.html#intel-fortran-macosx Reported in Homebrew#13050
Netcdf when built with `--enable-fortran` using the Intel Fortran compiler, ifort, does accept the `--force-load` option, causing a build error where libnetcdff.dylib is missing all the f90 symbols. The solution is in a FAQ on their website: Set lt_cv_ld_force_load=no http://www.unidata.ucar.edu/software/netcdf/docs/known_problems.html#intel-fortran-macosx Fixes Homebrew#13050. Closes Homebrew#13174. Signed-off-by: Charlie Sharpsteen <source@sharpsteen.net>
Fixes a buglet discovered in Homebrew#13050.
Netcdf when built with `--enable-fortran` using the Intel Fortran compiler, ifort, does accept the `--force-load` option, causing a build error where libnetcdff.dylib is missing all the f90 symbols. The solution is in a FAQ on their website: Set lt_cv_ld_force_load=no http://www.unidata.ucar.edu/software/netcdf/docs/known_problems.html#intel-fortran-macosx Fixes Homebrew#13050. Closes Homebrew#13174. Signed-off-by: Charlie Sharpsteen <source@sharpsteen.net>
Fixes a buglet discovered in Homebrew#13050.
Netcdf when built with `--enable-fortran` using the Intel Fortran compiler, ifort, does accept the `--force-load` option, causing a build error where libnetcdff.dylib is missing all the f90 symbols. The solution is in a FAQ on their website: Set lt_cv_ld_force_load=no http://www.unidata.ucar.edu/software/netcdf/docs/known_problems.html#intel-fortran-macosx Fixes Homebrew#13050. Closes Homebrew#13174. Signed-off-by: Charlie Sharpsteen <source@sharpsteen.net>
Fixes a buglet discovered in Homebrew#13050.
Netcdf when built with `--enable-fortran` using the Intel Fortran compiler, ifort, does accept the `--force-load` option, causing a build error where libnetcdff.dylib is missing all the f90 symbols. The solution is in a FAQ on their website: Set lt_cv_ld_force_load=no http://www.unidata.ucar.edu/software/netcdf/docs/known_problems.html#intel-fortran-macosx Fixes Homebrew#13050. Closes Homebrew#13174. Signed-off-by: Charlie Sharpsteen <source@sharpsteen.net>
I used
ifort
to compile NETCDF:The compilation was successful, but when I built my codes, "ifort" complained:
So I checked the symbols in
/usr/local/lib/libnetcdff.5.dylib
bynm
, there is no_netcdf_mp_nf90_...
symbols, but/usr/local/lib/libnetcdff.a
has. What is wrong?The text was updated successfully, but these errors were encountered: