Skip to content
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

on new install, build breaks for newer jasper library #236

Closed
edwardhartnett opened this issue Apr 13, 2022 · 6 comments · Fixed by #291
Closed

on new install, build breaks for newer jasper library #236

edwardhartnett opened this issue Apr 13, 2022 · 6 comments · Fixed by #291
Assignees
Labels
build Building software can be complicated

Comments

@edwardhartnett
Copy link
Contributor

Recently my hard drive failed and I had to replace it.

This means I am building everything from scratch which is interesting ;-)

I installed jpeg with apt-get, and cmake claims to find what it needs for jpeg:

ed@mikado:~/NCEPLIBS-g2/b$ cmake .. -DCMAKE_PREFIX_PATH="/usr/local/jasper-3.0.3;/usr/local/NCELIBS-bacio"
-- The C compiler identification is GNU 9.4.0
-- The Fortran compiler identification is GNU 9.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working Fortran compiler: /usr/bin/gfortran
-- Check for working Fortran compiler: /usr/bin/gfortran  -- works
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Checking whether /usr/bin/gfortran supports Fortran 90
-- Checking whether /usr/bin/gfortran supports Fortran 90 -- yes
-- Setting build type to 'Release' as none was specified.
-- Found JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so (found version "80") 
-- Found Jasper: /usr/local/jasper-3.0.3/lib/libjasper.so (found suitable version "3.0.3", minimum required is "2.0.25") 
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11") 
-- Found PNG: /usr/lib/x86_64-linux-gnu/libpng.so (found version "1.6.37") 
-- Found bacio: /usr/local/NCELIBS-bacio/lib/libbacio.a (found version "2.5.0")
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ed/NCEPLIBS-g2/b

Yet when I try to build, it fails on the JPEG library:

Scanning dependencies of target g2_4_c
[ 73%] Building C object src/CMakeFiles/g2_4_c.dir/dec_jpeg2000.c.o
[ 73%] Building C object src/CMakeFiles/g2_4_c.dir/dec_png.c.o
[ 74%] Building C object src/CMakeFiles/g2_4_c.dir/enc_jpeg2000.c.o
[ 74%] Building C object src/CMakeFiles/g2_4_c.dir/enc_png.c.o
[ 75%] Building C object src/CMakeFiles/g2_4_c.dir/mova2i.c.o
[ 75%] Built target g2_4_c
Scanning dependencies of target g2_4
[ 75%] Linking Fortran static library libg2_4.a
[ 75%] Built target g2_4
Scanning dependencies of target g2_test_lib
[ 75%] Building Fortran object tests/CMakeFiles/g2_test_lib.dir/creategrib.f90.o
[ 76%] Linking Fortran static library libg2_test_lib.a
[ 76%] Built target g2_test_lib
Scanning dependencies of target test_gribcreate
[ 77%] Building Fortran object tests/CMakeFiles/test_gribcreate.dir/test_gribcreate.f90.o
[ 77%] Linking Fortran executable test_gribcreate
/usr/bin/ld: ../src/libg2_4.a(enc_jpeg2000.c.o): in function `enc_jpeg2000_':
/home/ed/NCEPLIBS-g2/src/enc_jpeg2000.c:145: undefined reference to `jpc_encode'
collect2: error: ld returned 1 exit status
make[2]: *** [tests/CMakeFiles/test_gribcreate.dir/build.make:93: tests/test_gribcreate] Error 1
make[1]: *** [CMakeFiles/Makefile2:1137: tests/CMakeFiles/test_gribcreate.dir/all] Error 2
make: *** [Makefile:141: all] Error 2

Seems like this is related to changes in the jasper library. See NOAA-EMC/wgrib2#53.

@edwardhartnett edwardhartnett added the build Building software can be complicated label Apr 13, 2022
@edwardhartnett edwardhartnett self-assigned this Apr 13, 2022
@kgerheiser
Copy link
Contributor

Can you run a make VERBOSE=1 so the link line that failed is visible?

@edwardhartnett
Copy link
Contributor Author

When I build with jasper 2.0.33 I don't get this error. I see on the Jasper page (https://github.com/jasper-software/jasper):

VERY IMPORTANT NOTE:
This release of the JasPer software introduced some changes in the API
and/or behavior of the library relative to earlier releases, which may
necessitate some small changes in code using the library (e.g., to avoid
memory leaks or other problems). Please refer to the "News" section
of the JasPer Reference Manual for more details. For convenience,
this manual is available online (for various JasPer releases) at:
https://jasper-software.github.io/jasper-manual

@edwardhartnett
Copy link
Contributor Author

/usr/bin/gfortran   -O3 -DNDEBUG -O3 CMakeFiles/test_gribcreate.dir/test_gribcreate.f90.o  -o test_gribcreate   -L/usr/local/lib  -Wl,-rpath,/usr/local/lib:/usr/local/jasper-3.0.3/lib libg2_test_lib.a ../src/libg2_4.a /usr/lib/x86_64-linux-gnu/libpng.so /usr/local/NCELIBS-bacio/lib/libbacio.a /usr/lib/x86_64-linux-gnu/libpng.so /usr/lib/x86_64-linux-gnu/libz.so /usr/local/jasper-3.0.3/lib/libjasper.so /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib/x86_64-linux-gnu/libz.so 
/usr/bin/ld: ../src/libg2_4.a(enc_jpeg2000.c.o): in function `enc_jpeg2000_':
/home/ed/NCEPLIBS-g2/src/enc_jpeg2000.c:145: undefined reference to `jpc_encode'
collect2: error: ld returned 1 exit status
make[2]: *** [tests/CMakeFiles/test_gribcreate.dir/build.make:93: tests/test_gribcreate] Error 1
make[2]: Leaving directory '/home/ed/NCEPLIBS-g2/b'
make[1]: *** [CMakeFiles/Makefile2:1137: tests/CMakeFiles/test_gribcreate.dir/all] Error 2
make[1]: Leaving directory '/home/ed/NCEPLIBS-g2/b'
make: *** [Makefile:141: all] Error 2

@edwardhartnett
Copy link
Contributor Author

edwardhartnett commented Apr 13, 2022

Also, since this is happening in C code copied over from the g2c project, I suspect that g2c will experience this same bug. ;-)

Indeed: NOAA-EMC/NCEPLIBS-g2c#245

@kgerheiser
Copy link
Contributor

I was looking in Jasper and the function jpc_encode appears to still be there in v3.0.0.

@edwardhartnett
Copy link
Contributor Author

OK, this was caused because jpc_encode() is an internal function of Jasper that's not exported. I have fixed the C library. I think the answer for g2 is to remove the C code and have it depend on the C library for this code. (See #169).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Building software can be complicated
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants