UW-Hydro / VIC

The Variable Infiltration Capacity (VIC) Macroscale Hydrologic Model
http://vic.readthedocs.io
MIT License
260 stars 383 forks source link

Compilation error with VIC5.1.0: "collect2: error: ld returned 1 exit status" #940

Open bijoychandraAU opened 8 months ago

bijoychandraAU commented 8 months ago

Compilation of VIC 5.1.0 in cluster/ubuntu having GCC 12.2.0 has an error "collect2: error: ld returned 1 exit status". However, the same system compiles successfully with earlier versions such as VIC4.2.d. Please let me know how I can fix it.

Thank you

dwoodson-usbr commented 8 months ago

Are you trying to compile the classic or image driver?

bijoychandraAU commented 8 months ago

@dwoodson-usbr I am using a classic driver.

dwoodson-usbr commented 8 months ago

@bijoychandraAU Did you make any changes in the makefile? Are there any other error messages to indicate which line in the makefile failed? You may need to point explicitly to where gcc is installed. Also, if you are running a conda base environment, sometimes that can interfere with non-conda dependencies, so deactivate it.

If you haven't already, try editing the makefile for your compiler:

# Set CC = your compiler here
ifndef CC
CC=gcc
endif

To something like:

# Set CC = your compiler here
ifndef CC
CC=/usr/bin/gcc
endif

You can find where gcc is installed on your system with:

locate -br "^gcc$"