FVCOM-GitHub / FVCOM

Other
48 stars 31 forks source link

Build failure: mod_par.f90:(.text+0xc23): undefined reference to `partition_' #17

Open Candles opened 1 year ago

Candles commented 1 year ago

Building fails with the following on the final build step:

ld: mod_par.o: in function `mod_par_mp_domdec_':
mod_par.f90:(.text+0xc23): undefined reference to `partition_'
ld: mod_par.o: in function `mod_par_mp_domdec_dam_':
mod_par.f90:(.text+0x362e): undefined reference to `partition_'
make: *** [makefile:137: fvcom] Error 1

It looks like the error is with lines 118 through 122 of the makefile:

ifdef FLAG_411
  COBJS = func_pointer.c partition.c
else
  COBJS = func_pointer.c
endif

FLAG_411 is defined in the make.inc file, but the include is at the end of the makefile. Since the ifdef is evaluated before the include file, FLAG_411 is always undefined at this point.

bsahoo-umes commented 7 months ago

Building fails with this even after the code is changed as suggested.

ifort: error #10236: File not found: 'partition.o' make: *** [makefile:131: fvcom] Error 1

fodo9 commented 5 months ago

I encountered the same problem.Have you solved it?

bsahoo-umes commented 5 months ago

Hello

I used the old makefile where

COBJS = func_pointer.c partition.c

On Thu, May 30, 2024 at 7:16 AM fodo9 @.***> wrote:

I encountered the same problem.Have you solved it?

— Reply to this email directly, view it on GitHub https://github.com/FVCOM-GitHub/FVCOM/issues/17#issuecomment-2139330644, or unsubscribe https://github.com/notifications/unsubscribe-auth/BCISXPY5X2GIVTNT7XCL7YLZE4DARAVCNFSM6AAAAAA3S5JOSGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMZZGMZTANRUGQ . You are receiving this because you commented.Message ID: @.***>

fodo9 commented 5 months ago

Hi,I have successfully compiled the code using your suggestion, thanks.

markyoder commented 3 months ago

I too, eventually, got this to compile, but what an effort!

I ran into the COBJS issue and ended up hard-code defining COBJS in both make.inc and makefile. It is not clear if I really needed to do this, but I think defining it in makefile took care of the compile part (partition.c -> partition.o), then defining it in make.inc handled the linking.

I also changed the C-compile rule to build objects, eg:

-- .c.o:
--        $(CC) -c $(CFLAGS) $(INCS) $*.c
++ .c.o:
++        $(CC) -c $(CFLAGS) $(INCS) $*.c -o $*.o