8000 Undefined References · Issue #828 · CGNS/CGNS · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Undefined References #828

8000
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
JamesOogway opened this issue Jan 31, 2025 · 13 comments
Open

Undefined References #828

JamesOogway opened this issue Jan 31, 2025 · 13 comments

Comments

@JamesOogway
Copy link
JamesOogway commented Jan 31, 2025

I'm trying to configure FUN3D with CGNS and have the following error when I build:

ent_core -levent_pthreads -L/home/.../FUN3D/nvidia/x86_64/v100/lib -lfluda -L/usr/local/pkg/cuda/cuda-12.6/lib64 -lcudart -lstdc++ -lm -Wl,-rpath -Wl,/usr/local/pkg/openmpi/4.1.5_ucx1170/lib -Wl,-rpath -Wl,/usr/local/pkg/openmpi/4.1.5_ucx1170/lib
/usr/bin/ld: aflr3_to_cgns.o: in function 'MAIN__':
/home/.../FUN3D/fun3d_intg-14.1-6e82beb/build-v101/fun3d/utils/../../../fun3d/utils/aflr3_to_cgns.f90:352: undefined reference to `cg_open_f'

/usr/bin/ld: /home/.../FUN3D/fun3d_intg-14.1-6e82beb/build-v101/fun3d/utils/../../../fun3d/utils/aflr3_to_cgns.f90:361: undefined reference to `cg_base_write_f'

/usr/bin/ld: /home/.../FUN3D/fun3d_intg-14.1-6e82beb/build-v101/fun3d/utils/../../../fun3d/utils/aflr3_to_cgns.f90:371: undefined reference to `cg_zone_write_f'

collect2: error: ld returned 1 exit status
make[6]: *** [Makefile:1565: aflr3_to_cgns] Error 1
make[6]: Leaving directory '/home/.../FUN3D/fun3d_intg-14.1-6e82beb/_build-v101/fun3d/utils'
make[5]: *** [Makefile:1870: all-recursive] Error 1
make[5]: Leaving directory '/home/.../FUN3D/fun3d_intg-14.1-6e82beb/_build-v101/fun3d/utils'
make[4]: *** [Makefile:1423: all] Error 2

All I've dealt with previously is that I had changed some variables from UserDefined and NULL to CG_UserDefined and CG_NULL with the following command:
find . -type f -name "*.F90" -exec sed -i 's/\bUserDefined\b/CG_UserDefined/g; s/\bNULL\b/CG_NULL/g' {} +

I'm not sure which step to take next -- thank you.

@brtnfld
Copy link
Member
brtnfld commented Jan 31, 2025

I don't see where you've linked in the cgns library. What build system is FUN3d using?

I would look at the Makefiles/CMakefile in the examples/tests to see how linking/including is done and do the same in FUN3D. Otherwise, you should be able to build CGNS with verbose on to get the include/libraries specified on the compile line from the tests and examples.

@JamesOogway
Copy link
Author

I am linking to CGNS using a --with-cgns= flag in my configure script for FUN3D. The build system is a configure script followed by a make and make install if that's what you're asking.

Can provide more details tonight. I do have the CGNS installed in my .local folder and it has its files in the lib and include directories.

@brtnfld
Copy link
Member
brtnfld commented Feb 1, 2025

For example, you should have -I, and lib/libcgns.a and a link to libhdf5.so, and maybe some compression libraries, depending on how hdf5 was built. I've not built FUN3D, so I'm unsure why it does not link the libraries correctly.

This is my command for building a fortran example:

mpif90 -I../../../ -g -g -fPIC -Wno-c-binding-type -fallow-argument-mismatch -o cgread cgread.F90 ../../../lib/libcgns.a /home/brtnfld/packages/hdf5.brtnfld/build/hdf5/lib64/libhdf5.so -lm -ldl -lz -L/home/brtnfld/packages/szip-2.1.1/szip/lib64 -lsz -lpthread -lz

@JamesOogway
Copy link
Author

I'm not sure what you mean by linking the CGNS library, but here's what I'm doing before I run the configure script with the --with-cgns link:

export CXX=icpx
export CFLAGS="-fPIC"
export CXXFLAGS="-fPIC"
export FCFLAGS="-fPIC "
export LDFLAGS="-fPIC -L/state/partition1/pkg/matlabr2024a/sys/os/glnxa64 -lirc -limf -lsvml -I/home/gridsan/alan/.local/include -L/home/gridsan/alan/.local/lib -lcgns"

I tried putting an include directory under FCFLAGS that went to the lcgns but it didn't seem to work.

@JamesOogway
Copy link
Author

Also just tried implementing something similar to what you described and it didn't appear to work. HDF5 for me is installed by default on my cluster and doesn't have parallel support I believe.

Would you suggest incorporating the -lm, -ldl, -lz flags?

@brtnfld
Copy link
Member
brtnfld commented Feb 3, 2025

Did it have the same error as before? Can you give the full compile line that fails? Can you list the contents of your lib directory?

When you installed cgns, did you use the system HDF5? I assume you want to do parallel IO, so you might need to compile HDF5.

@JamesOogway
Copy link
Author
JamesOogway commented Feb 3, 2025

Yes -- here is the full compile line:
Making all in BLAYER_EXTRACTION_TOOLS
make[6]: Entering directory '/home/gridsan/alan/FUN3D/fun3d_intg-14.1-6e82beb/_build-v101/fun3d/utils/BLAYER_EXTRACTION_TOOLS'
make all-am
make[7]: Entering directory '/home/gridsan/alan/FUN3D/fun3d_intg-14.1-6e82beb/_build-v101/fun3d/utils/BLAYER_EXTRACTION_TOOLS'
make[7]: Nothing to be done for 'all-am'.
make[7]: Leaving directory '/home/gridsan/alan/FUN3D/fun3d_intg-14.1-6e82beb/_build-v101/fun3d/utils/BLAYER_EXTRACTION_TOOLS'
make[6]: Leaving directory '/home/gridsan/alan/FUN3D/fun3d_intg-14.1-6e82beb/_build-v101/fun3d/utils/BLAYER_EXTRACTION_TOOLS'
Making all in Rotorcraft
make[6]: Entering directory '/home/gridsan/alan/FUN3D/fun3d_intg-14.1-6e82beb/_build-v101/fun3d/utils/Rotorcraft'
make all-am
make[7]: Entering directory '/home/gridsan/alan/FUN3D/fun3d_intg-14.1-6e82beb/_build-v101/fun3d/utils/Rotorcraft'
make[7]: Nothing to be done for 'all-am'.
make[7]: Leaving directory '/home/gridsan/alan/FUN3D/fun3d_intg-14.1-6e82beb/_build-v101/fun3d/utils/Rotorcraft'
make[6]: Leaving directory '/home/gridsan/alan/FUN3D/fun3d_intg-14.1-6e82beb/_build-v101/fun3d/utils/Rotorcraft'
make[6]: Entering directory '/home/gridsan/alan/FUN3D/fun3d_intg-14.1-6e82beb/_build-v101/fun3d/utils'
/bin/bash ../libtool --tag=FC --mode=link /usr/local/pkg/openmpi/4.1.5_ucx1170/bin/mpif90 -I/home/gridsan/alan/FUN3D/fun3d_intg-14.1-6e82beb/_build-v101/libcore/src -I../libdefs -I../LibF90 -I../libinit -I../../../fun3d/utils/../FuncLib90 -I../libturb -I/home/gridsan/alan/.local/include -ffast-math -funroll-loops -O3 -ffree-line-length-none -g -fPIC -I/home/gridsan/alan/.local/include -fPIC -L/state/partition1/pkg/matlabr2024a/sys/os/glnxa64 -lirc -limf -lsvml -I/home/gridsan/alan/.local/include -L/home/gridsan/alan/.local/lib -lcgns -o aflr3_to_cgns aflr3_to_cgns.o -L/home/gridsan/alan/.local/lib -lcgns /home/gridsan/alan/FUN3D/fun3d_intg-14.1-6e82beb/_build-v101/libcore/src/libcore.la -L/home/gridsan/alan/FUN3D/nvidia/x86_64/v100/lib -lfluda -L/usr/local/pkg/cuda/cuda-12.6/lib64 -lcudart -lstdc++ -lm
libtool: link: /usr/local/pkg/openmpi/4.1.5_ucx1170/bin/mpif90 -I/home/gridsan/alan/FUN3D/fun3d_intg-14.1-6e82beb/_build-v101/libcore/src -I../libdefs -I../LibF90 -I../libinit -I../../../fun3d/utils/../FuncLib90 -I../libturb -I/home/gridsan/alan/.local/include -ffast-math -funroll-loops -O3 -ffree-line-length-none -g -fPIC -I/home/gridsan/alan/.local/include -fPIC -I/home/gridsan/alan/.local/include -o aflr3_to_cgns aflr3_to_cgns.o -L/state/partition1/pkg/matlabr2024a/sys/os/glnxa64 -L/home/gridsan/alan/.local/lib /home/gridsan/alan/FUN3D/fun3d_intg-14.1-6e82beb/build-v101/libcore/src/.libs/libcore.a -lirc -limf -lsvml -lcgns /usr/local/pkg/openmpi/4.1.5_ucx1170/lib/libmpi_usempif08.so /usr/local/pkg/openmpi/4.1.5_ucx1170/lib/libmpi_usempi_ignore_tkr.so /usr/local/pkg/openmpi/4.1.5_ucx1170/lib/libmpi_mpifh.so -L/usr/lib/x86_64-linux-gnu /usr/local/pkg/openmpi/4.1.5_ucx1170/lib/libmpi.so /usr/local/pkg/openmpi/4.1.5_ucx1170/lib/libopen-rte.so /usr/local/pkg/openmpi/4.1.5_ucx1170/lib/libopen-pal.so -lz -lhwloc -levent_core -levent_pthreads -L/home/gridsan/alan/FUN3D/nvidia/x86_64/v100/lib -lfluda -L/usr/local/pkg/cuda/cuda-12.6/lib64 -lcudart -lstdc++ -lm -Wl,-rpath -Wl,/usr/local/pkg/openmpi/4.1.5_ucx1170/lib -Wl,-rpath -Wl,/usr/local/pkg/openmpi/4.1.5_ucx1170/lib
/usr/bin/ld: aflr3_to_cgns.o: in function MAIN__': /home/gridsan/alan/FUN3D/fun3d_intg-14.1-6e82beb/_build-v101/fun3d/utils/../../../fun3d/utils/aflr3_to_cgns.f90:352: undefined reference to cg_open_f
'
/usr/bin/ld: /home/gridsan/alan/FUN3D/fun3d_intg-14.1-6e82beb/build-v101/fun3d/utils/../../../fun3d/utils/aflr3_to_cgns.f90:361: undefined reference to cg_base_write_f_' /usr/bin/ld: /home/gridsan/alan/FUN3D/fun3d_intg-14.1-6e82beb/_build-v101/fun3d/utils/../../../fun3d/utils/aflr3_to_cgns.f90:371: undefined reference to cg_zone_write_f'
collect2: error: ld returned 1 exit status
make[6]: *** [Makefile:1565: aflr3_to_cgns] Error 1
make[6]: Leaving directory '/home/gridsan/alan/FUN3D/fun3d_intg-14.1-6e82beb/_build-v101/fun3d/utils'
make[5]: *** [Makefile:1870: all-recursive] Error 1
make[5]: Leaving directory '/home/gridsan/alan/FUN3D/fun3d_intg-14.1-6e82beb/_build-v101/fun3d/utils'
make[4]: *** [Makefile:1423: all] Error 2
make[4]: Leaving directory '/home/gridsan/alan/FUN3D/fun3d_intg-14.1-6e82beb/_build-v101/fun3d/utils'
make[3]: *** [Makefile:667: all-recursive] Error 1
make[3]: Leaving directory '/home/gridsan/alan/FUN3D/fun3d_intg-14.1-6e82beb/_build-v101/fun3d'
make[2]: *** [Makefile:599: all] Error 2
make[2]: Leaving directory '/home/gridsan/alan/FUN3D/fun3d_intg-14.1-6e82beb/_build-v101/fun3d'
make[1]: *** [Makefile:439: all-recursive] Error 1
make[1]: Leaving directory '/home/gridsan/alan/FUN3D/fun3d_intg-14.1-6e82beb/_build-v101'
make: *** [Makefile:371: all] Error 2

And here are the contents of the lib directory:
:~/.local/lib$ ls
cmake libGKlib.a libcgns.a libcgns.so libcgns.so.4.6 libmetis.so libparmetis.a libzoltan.a python3.8 python3.9

I did indeed build using the system HDF5. Could it be the fact HDF5 wasn't parallel that caused this? Is there a way to compile HDF5 that overrides whats on my HPC? I don't have admin privileges on it.

@brtnfld
Copy link
Member
brtnfld commented Feb 4, 2025

I did indeed build using the system HDF5. Could it be the fact HDF5 wasn't parallel that caused this? Is there a way to compile HDF5 that overrides whats on my HPC? I don't have admin privileges on it.

Since it is using cg_open, it is not using the CGNS parallel routines, so it is ok that HDF5 does not have parallel enabled. Did you disable parallel when building CGNS? If you do nm, does cg_open_f show up?

You should also use the same Fortran compiler to build CGNS and your application. Did you run a make test for your CGNS install?

Otherwise, it is unclear what the issue is since you are linking in the CGNS library.

@JamesOogway
Copy link
Author

I'm not sure what you mean by doing nm but I did this command:

~/Dependencies/CGNS-develop$ nm
nm: 'a.out': No such file

When I run make I get this:

/Dependencies/CGNS-develop/src/build2$ make
[ 2%] Built target cgns_f2c
Consolidate compiler generated dependencies of target cgns_static
[ 28%] Built target cgns_static
Consolidate compiler generated dependencies of target cgns_shared
[ 54%] Built target cgns_shared
Consolidate compiler generated dependencies of target cgnsnames
[ 61%] Built target cgnsnames
Consolidate compiler generated dependencies of target cgnscheck
[ 73%] Built target cgnscheck
Consolidate compiler generated dependencies of target cgnsconvert
[ 80%] Built target cgnsconvert
Consolidate compiler generated dependencies of target cgnsdiff
[ 88%] Built target cgnsdiff
Consolidate compiler generated dependencies of target cgnslist
[ 95%] Built target cgnslist
Consolidate compiler generated dependencies of target cgnscompress
[100%] Built target cgnscompress

@JamesOogway
Copy link
Author

I did some more digging and found that cg_open_f does exist in my library:
/Dependencies/CGNS-develop/src/build2$ nm -g /home/gridsan/aha/.local/lib/libcgns.a | grep -i "cg_open_f"
0000000000005eb0 T __cgns_MOD_cg_open_f

This leaves it to be some sort of syncing issue I'd presume. Is there a way to test CGNS like you described? I tried make test and ctest in my build folder but neither seem to work.

@brtnfld
Copy link
Member
brtnfld commented Feb 5, 2025

What errors are you seeing for the CGNS tests when you do ctest -VV .

@JamesOogway
Copy link
Author

Where can I find the tests? I'm trying to run it in a few different places in my build folder and get:
Dependencies/CGNS-develop/src/build2$ ctest -VV
UpdateCTestConfiguration from :/home/gridsan/alan/Dependencies/CGNS-develop/src/build2/DartConfiguration.tcl
UpdateCTestConfiguration from :/home/gridsan/alan/Dependencies/CGNS-develop/src/build2/DartConfiguration.tcl
Test project /home/gridsan/alan/Dependencies/CGNS-develop/src/build2
Constructing a list of tests
Updating test list for fixtures
Added 0 tests to meet fixture requirements
Checking test dependency graph...
Checking test dependency graph end
No tests were found!!!

@brtnfld
Copy link
Member
brtnfld commented Feb 6, 2025

Did you use build option -D CGNS_ENABLE_TESTS:BOOL=ON

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0