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

bufrdc lib from ECMWF intstalled and works, but configure won't run #2

Closed
steffo-th opened this issue May 3, 2016 · 6 comments
Closed

Comments

@steffo-th
Copy link

Hi,

I have tried to install your bufr2synop on both Centos 7 (64 bit) and Ubuntu 15.04 (64 bit), but fail when running the configure script (from bash or from c-shell).

The script stops stating: "configure: error: "You must install ECMWF bufrdc library"

I have installed the ECMWF bufrdc_000405 library and that is working perfectly well both for ECMWF's own software and for the Norwegian Met. Office's software that both uses the bufrdc library.

Can you please give some hint?

Thanks,
Steffo S.
Thailand

@gbvalor
Copy link
Owner

gbvalor commented May 9, 2016

Hi,

Actually lastest releases do not need bufrdc library except their bufrtable directory.

Anyway I am wandering why autotools scripts do not detect bufr library. Is package bufrdc installed in standard directories like /usr/lib , /usr/lib64 , /usr/local/lib or /usr/local/lib64 ?. May be it will search in a wrong place

If bufrdc is not installed in standard directories you could try configure with LDFLAGS option, i.e

./configure LDFLAGS=-L/path_to_where_libbufr_is_installed

If you can configure and make then remember that you should include the path to 'bufrtables' directory when calling to 'bufrtotac' or 'bufr2synop' with the aid of -t option

Please, tell me if you can build.

Guillermo

@TomasZamecnik
Copy link

Hi!
In the first place: thanks to Guillermo for work on bufr2synop!
To the issue: I have experienced the same problem on Ubuntu 14.04 and found solution.
To be precise, there were more problems:

  1. ECMWF library bufrdc is by default built without option -DUNDERSCORE. The problem occurs when you try to link it with c library. It happens during searching for bufrdc when configuring bufr2synop and results to error message "You must install ECMWF bufrdc library".
    Solution: Rebuild bufrdc with -DUNDERSCORE flag.
    How to do it: During installation bufrdc according to ECMWF manual, after running ./build_library, edit file config/config.linux_gfortranA64. Add -DUNDERSCORE option to gcc command. Then run: make clean, make, sudo ./install.
    Now go to bufr2synop and try to run ./configure again.

  2. If you pass ./configure step and go ahead to make you possibly encounter following link errors:

/bin/bash ../../libtool  --tag=CC   --mode=link cc -W -Wall -g -O2   -o bufr2synop bufr2synop.o bufr2synop_io.o ../../src/libraries/libbufr2tac.la -lbufr -lgfortran -lm -lbufr 
libtool: link: cc -W -Wall -g -O2 -o .libs/bufr2synop bufr2synop.o bufr2synop_io.o  ../../src/libraries/.libs/libbufr2tac.so -lgfortran -lm -lbufr
/usr/bin/ld: //usr/local/lib/libbufr.a(buprt.o): undefined reference to symbol 'lround@@GLIBC_2.2.5'
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libm.so: error adding symbols: DSO missing from command line

This is caused by ill ordering of linked libraries: -lbufr -lgfortran -lm -lbufr
In this command line snippet are two bugs:
First bug: -lbufr is added twice. Second occurence dissapears in cc (probably thanks to some deduplication mechanism), but the first occurence remains and problem is that bufr depends on gfortran and m. So the ordering of libraries is mentioned second bug.
Solution:

  1. Remove AC_CHECK_LIB([bufr], [bufrread], , [AC_MSG_ERROR("You must install ECMWF bufrdc library")]) from configure.ac, because this check in the end adds the second -lbufr in linking process. This also can solve the original ./configure bug.
  2. Change ordering of linking from -lm -lgfortran -lbufr to -lbufr -lgfortran -lm. I found occurences of such ordering in following files: src/apps/Makefile.am, bufr2synop.kdevelop

Tomas

@gbvalor
Copy link
Owner

gbvalor commented May 20, 2016

Thanks a lot Tomas!!
I fixed it removing bufrdc check and changing the libraries order as you suggested.
Just now I've released version 0.7.8.
Best regards.

Guillermo

@TomasZamecnik
Copy link

Hi Guillermo,
thank you for bug fixing! There is still issue with the library order.
It should be -lbufr -lgfortran -lm
In the current version it is -lgfortran -lbufr -lm, which causes that bufr "does not see" fortran.
bufr library should be linked first and then its dependencies (i.e. fortran and m).
It is not very intuitive, but it is the way how GNU linker works.
Explanation from ld manual page:

The linker will search an archive only once, at the location where it is specified on the command line. If the archive defines a symbol which was undefined in some object which appeared before the archive on the command line, the linker will include the appropriate file(s) from the archive. However, an undefined symbol in an object appearing later on the command line will not cause the linker to search the archive again. 

Another explanation:
http://www.linuxtopia.org/online_books/an_introduction_to_gcc/gccintro_18.html

Kind regards
Tomas
Windyty, SE

@gbvalor
Copy link
Owner

gbvalor commented May 23, 2016

Thanks again Tomas!

I've just updated and pushed the fix to github repo.

Best regards.

Guillermo

2016-05-23 9:55 GMT+00:00 TomasZamecnik notifications@github.com:

Hi Guillermo,
thank you for bug fixing! There is still issue with the library order.
It should be -lbufr -lgfortran -lm
In the current version it is -lgfortran -lbufr -lm, which causes that bufr
"does not see" fortran.
bufr library should be linked first and then its dependencies (i.e.
fortran and m).
It is not very intuitive, but it is the way how GNU linker works.
Explanation from ld manual page:

The linker will search an archive only once, at the location where it is specified on the command line. If the archive defines a symbol which was undefined in some object which appeared before the archive on the command line, the linker will include the appropriate file(s) from the archive. However, an undefined symbol in an object appearing later on the command line will not cause the linker to search the archive again.

Another explanation:

http://www.linuxtopia.org/online_books/an_introduction_to_gcc/gccintro_18.html

Kind regards
Tomas
Windyty, SE


You are receiving this because you commented.
Reply to this email directly or view it on GitHub
#2 (comment)

Guillermo Ballester Valor
Developer, mantainer and webmaster of
www.ogimet.com
Ogijares (Granada), Spain

@gbvalor
Copy link
Owner

gbvalor commented Aug 9, 2022

The use of ECMWF bufrdc library is deprecated

@gbvalor gbvalor closed this as completed Aug 9, 2022
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

3 participants