[IPOL discuss] Unable to build IPOL demo due to libraries' link order problem in some source codes

Jacques Froment Jacques.Froment at univ-ubs.fr
Fri Sep 12 18:13:42 CEST 2014


Dear all,

I hope I won't be too boring with that first, long and technical post.

While trying to write a IPOL demo, I followed steps in
  https://tools.ipol.im/wiki/doc/demo/tutorial/
but I'm stopped at step
  1.3. Local test
with errors during the
  ./demo.py build

I got link errors during the make of some source codes, for example with the app
  bcm_non_local_means_denoising
The offending line is
  g++ -lpng -lm -fopenmp -L/opt/local/lib/ -L/usr/local/lib/ -fopenmp -lpng -o img_diff_ipol img_diff_ipol.o io_png.o 
libauxiliar.o libdenoising.o mt19937ar.o
In io_png, all png_* functions appear as undefined.
Note that two "-lpng" appear in that line.
If I remove them and put "-lpng" at the very end of the line, that is
  g++ -lm -fopenmp -L/opt/local/lib/ -L/usr/local/lib/ -fopenmp -o img_diff_ipol img_diff_ipol.o io_png.o libauxiliar.o 
libdenoising.o mt19937ar.o -lpng
then the link is done without error.
Thus, there seems to be a libraries' link order problem in some IPOL source codes.
The twisted fact is that such error only appears on some versions of the g++ compiler.
Of course, on purple the g++ version does not complain with that:
  jf at purple:~$ g++ -v
returns
  gcc version 4.4.5 (Debian 4.4.5-8)
Another, newer, version on Debian is OK:
  gcc version 4.7.2 (Debian 4.7.2-5)
But on recent g++ versions distributed with Ubuntu (such the ones on my computers), I get the error.
Examples of g++ versions on which the link error occurs:
  gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) -> Ubuntu 12.04 LTS
  gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1) -> Ubuntu 14.04 LTS
Maybe the point is not in the version number but in the configuration switch during compilation of
g++, but I'm not sure.

I can modify the makefile to make the link working and generate a new dl/nlmeansC.tar.gz,
but that does not solve the build problem with ./demo.py: indeed it seems to download
the source code from the IPOL repository or from another place than dl.
Performing the linking "manually" in src/nlmeansC and then running
  ./demo.py build
does not solve the problem either.

In summary,
- I don't know how to build the demo on my computers without error during linking of some IPOL codes;
- I suspect libraries' link order mistake on some published IPOL codes that may affect other users,
depending on their compiler version number or configuration switch defined by the Linux distribution.

Any help or advice would be appreciated.

Have a nice week-end,
Jacques.

Jacques Froment   (Jacques.Froment at univ-ubs.fr)

Université de Bretagne Sud - LMBA UMR 6205
Centre Y. Coppens, campus de Tohannic
BP 573, F-56017 VANNES, FRANCE
Tél. 0297017138 (+33 297017138)
Fax 0297017175 (+33 297017175)


More information about the discuss mailing list