Scheduled Downtime
On Friday 21 April 2023 @ 5pm MT, this website will be down for maintenance and expected to return online the morning of 24 April 2023 at the latest

WRF compile error by "undefined reference"

Asahi

New member
Hi all,

I'm trying to compile WRF, but it's failing due to some errors.
In the log.compile, there are always sentences of "undefined reference" around the error, so I think that is the cause, but I don't know how to deal with it.
This is one of them:

ddispatch.c:(.text+0x39e): undefined reference to `curl_global_init'
/usr/bin/ld: /path_to_directory/Build_WRF/LIBRARIES/netcdf/lib/libnetcdf.a(libdispatch_la-ddispatch.o): in function `NCDISPATCH_finalize':
ddispatch.c:(.text+0x3f0): undefined reference to `curl_global_cleanup'
/usr/bin/ld: /path_to_directory/Build_WRF/LIBRARIES/netcdf/lib/libnetcdf.a(libdispatch_la-dhttp.o): in function `nc_http_init_verbose':
dhttp.c:(.text+0x6c): undefined reference to `curl_easy_init'
/usr/bin/ld: dhttp.c:(.text+0xcd): undefined reference to `curl_easy_setopt'
/usr/bin/ld: dhttp.c:(.text+0x10f): undefined reference to `curl_easy_setopt'
/usr/bin/ld: /path_to_directory/Build_WRF/LIBRARIES/netcdf/lib/libnetcdf.a(libdispatch_la-dhttp.o): in function `nc_http_close':
dhttp.c:(.text+0x1b6): undefined reference to `curl_easy_cleanup'
/usr/bin/ld: /path_to_directory/Build_WRF/LIBRARIES/netcdf/lib/libnetcdf.a(libdispatch_la-dhttp.o): in function `nc_http_reset':
dhttp.c:(.text+0x26e): undefined reference to `curl_easy_setopt'
/usr/bin/ld: dhttp.c:(.text+0x2b1): undefined reference to `curl_easy_setopt'
/usr/bin/ld: dhttp.c:(.text+0x2f4): undefined reference to `curl_easy_setopt'
/usr/bin/ld: dhttp.c:(.text+0x337): undefined reference to `curl_easy_setopt'
/usr/bin/ld: dhttp.c:(.text+0x36c): undefined reference to `curl_easy_setopt'
/usr/bin/ld: /path_to_directory/Build_WRF/LIBRARIES/netcdf/lib/libnetcdf.a(libdispatch_la-dhttp.o):dhttp.c:(.text+0x3aa): more undefined references to `curl_easy_setopt' follow
/usr/bin/ld: /path_to_directory/Build_WRF/LIBRARIES/netcdf/lib/libnetcdf.a(libdispatch_la-dhttp.o): in function `execute':
dhttp.c:(.text+0x1534): undefined reference to `curl_easy_perform'
/usr/bin/ld: dhttp.c:(.text+0x156e): undefined reference to `curl_easy_getinfo'
/usr/bin/ld: /path_to_directory/Build_WRF/LIBRARIES/netcdf/lib/libnetcdf.a(libdispatch_la-dhttp.o): in function `headerson':
dhttp.c:(.text+0x167d): undefined reference to `curl_easy_setopt'
/usr/bin/ld: dhttp.c:(.text+0x16b3): undefined reference to `curl_easy_setopt'
/usr/bin/ld: /path_to_directory/Build_WRF/LIBRARIES/netcdf/lib/libnetcdf.a(libdispatch_la-dhttp.o): in function `headersoff':
dhttp.c:(.text+0x172b): undefined reference to `curl_easy_setopt'
/usr/bin/ld: dhttp.c:(.text+0x1759): undefined reference to `curl_easy_setopt'
/usr/bin/ld: /path_to_directory/Build_WRF/LIBRARIES/netcdf/lib/libnetcdf.a(libdispatch_la-dhttp.o): in function `showerrors':
dhttp.c:(.text+0x1876): undefined reference to `curl_easy_setopt'
/usr/bin/ld: /path_to_directory/Build_WRF/LIBRARIES/netcdf/lib/libnetcdf.a(libdispatch_la-dhttp.o): in function `reporterror':
dhttp.c:(.text+0x18a5): undefined reference to `curl_easy_strerror'
collect2: error: ld returned 1 exit status
Command exited with non-zero status 1
0.05user 0.02system 0:00.08elapsed 85%CPU (0avgtext+0avgdata 20900maxresident)k
2768inputs+3400outputs (1major+6577minor)pagefaults 0swaps
make[2]: [makefile:45: diffwrf] Error 1 (ignored)
make[2]: Leaving directory '/home/vboxuser/WRF/external/io_netcdf'
Could you please tell me what to do?
I also attach the full version log file.

I'm sorry that I don't have much knowledge about computers and my English is bad.
Thank you.
 

Attachments

  • log_compile.txt
    831.5 KB · Views: 3
Hi all,

I'm trying to compile WRF, but it's failing due to some errors.
In the log.compile, there are always sentences of "undefined reference" around the error, so I think that is the cause, but I don't know how to deal with it.
This is one of them:


Could you please tell me what to do?
I also attach the full version log file.

I'm sorry that I don't have much knowledge about computers and my English is bad.
Thank you.
Hi Asahi!

It seems that ld is missing a function contained in libcurl that is referenced by the netcdf library when it binds.

You might try setting the same environment variables as when you built the netcdf library, such as LD_LIBRARY_PATH.

Sincerely yours
 
Thank you KiyoTom!

After reinstalling netcdf, I tried compiling WRF again with the same environments, but the same error occurred.
I tried with two patterns, no LD_LIBRARY_PATH and "export LD_LIBRARY_PATH=/path_to_directory/Build_WRF/LIBRARIES/netcdf/lib:$LD_LIBRARY_PATH", but an error occurred on both.
Please let me know if you have other solutions.

Thank you.
 
Last edited:
Thank you KiyoTom!

After reinstalling netcdf, I tried compiling WRF again with the same environments, but the same error occurred.
I tried with two patterns, no LD_LIBRARY_PATH and "export LD_LIBRARY_PATH=/path_to_directory/Build_WRF/LIBRARIES/netcdf/lib:$LD_LIBRARY_PATH", but an error occurred on both.
Please let me know if you have other solutions.

Thank you.
Hi Asahi

If you installed netcdf from source code, you will find an executable called ncdump under "/path_to_directory/Build_WRF/LIBRARIES/netcdf/bin".

Go to "/path_to_directory/Build_WRF/LIBRARIES/netcdf/bin" and run "ldd . /ncdump |grep libcurl" and if you find libcurl, you should be set up for compilation.

Would it be the same if you used the netcdf dynamic library instead of the static library?

Sincerely
 
Thank you KiyoTom!

Using netcdf without "--enable-shared", I successfully compiled WRF!
Thanks for your kindness!
 
Top