[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#457075: Salomé packaging



Hello Adam,
> 
> First, some great news: Salomé was accepted into unstable!  Now we can
> file multiple independent bugs and track all of these issues separately.
Excellent! I am really glad to hear it.
> 
> > I feel really sorry for the wrong patch that I sent you, the reason
> > is that I forgot to add the CXXFLAGS="-g" in the configure command, I was
> > building VISU without optimizations. I hope that I did not make you
> > loose too much time.
> 
> Aha!  That makes a lot of sense.  Don't worry, it didn't take me a lot
> of time to rebuild the package a couple of times.
> 
> But this suggests that it might be best to compile only that file using
> -g so the rest of VISU can still be optimized.  What do you think?
In fact g++ can be controlled on function inlining.
> 
> > Since my last successful build, I have looked
> > deeper into the problem and I found that g++ inline small template
> > function with -O2. Here I imitate the GetIDMapper definition found in
> > src/CONVERTOR/VISU_MergeFilterUtilities.cxx:705:
...
> 
> Very interesting!  It sounds like with a lot of hard work you've found
> an important g++ optimization bug...
I am not sure if it is a bug. I guess that template function inlining
should be controlled when optimizing. I have enclosed you a tested patch
for removing template function inlining of GetIDMapper but it should be
applied after the commit:

    f57b74db488c91754eadbca263c065ff2022ac71
    Thu May 27 21:56:53 2010 -0400
    Timestamp the changelog

It means that the last commit should be reverted. I made a successful
build of Salome with VISU by using the corresponding Debian rules 
(that I have enclosed in case you would like to check) but you will
see that VISU is configured in the for loop like others modules.

Finally I have sent my patch to bug 584172 where a better solution
has already been suggested by Denis but requires a new complete build.
Now I will try to improve the package organizations and wait for 
your Salome bug entries on which I can help.

> 
> > By the way, is the 'git-builpackage' command that exports CXXFLAGS
> > to '-O2 -g'? I could not yet understand that step.
> 
> I believe dpkg-buildpackage sets those flags.  But it should be possible
> to set them locally within debian/rules or Makefile.am.
Thank you for the explanation, I have just discovered dpkg-buildflags
used by dpkg-buildpackage:

    $ dpkg-buildflags --get CXXFLAGS
    -g -O2

Best regards,

André
commit 73f793cb0076b6847fc17750a5e1511af502e06c
Author: André Espaze <andre.espaze@logilab.fr>
Date:   Tue Jun 1 16:53:53 2010 +0200

    No GetIDMapper inlining when building VISU
    
    The template function GetIDMapper should not be inlined by g++ when
    compiling with optimizations (the Debian build system used -O2) because
    the VISUConvertor command needs to link with the resulting symbol
    contained in libVisuConvertor.so. The patch is provided in:
    	debian/patches/visu-no-template-inline.patch
    and will be applied by quilt thanks to the list:
    	debian/patches/series

diff --git a/debian/patches/series b/debian/patches/series
index 524b45d..d280ec5 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -26,6 +26,7 @@ med-fix-clean.patch
 visu-hdf5-needs-mpi.patch
 visu-build-in-tree.patch
 visu-flags-typo.patch
+visu-no-template-inline.patch
 visu-fix-clean.patch
 smesh-hdf5-needs-mpi.patch
 smesh-use-gui-check.patch
diff --git a/debian/patches/visu-no-template-inline.patch b/debian/patches/visu-no-template-inline.patch
new file mode 100644
index 0000000..ead1d55
--- /dev/null
+++ b/debian/patches/visu-no-template-inline.patch
@@ -0,0 +1,28 @@
+The template function GetIDMapper should not be inlined by g++ when
+compiling with optimizations (the Debian build system used -O2) because
+the VISUConvertor command needs to link with the resulting symbol
+contained in libVisuConvertor.so.
+
+diff --git a/VISU_SRC_5.1.3/src/CONVERTOR/VISU_MergeFilterUtilities.hxx b/VISU_SRC_5.1.3/src/CONVERTOR/VISU_MergeFilterUtilities.hxx
+index 52f7440..e4f63ae 100755
+--- a/VISU_SRC_5.1.3/src/CONVERTOR/VISU_MergeFilterUtilities.hxx
++++ b/VISU_SRC_5.1.3/src/CONVERTOR/VISU_MergeFilterUtilities.hxx
+@@ -93,12 +93,18 @@ namespace VISU
+                                 TObjectId2TupleGaussIdMap& theObjectId2TupleGaussIdMap);
+   
+   template<class TGetFieldData>
++#if (__GNUG__ && __OPTIMIZE__)
++  __attribute__((noinline))
++#endif
+   vtkIntArray*
+   GetIDMapper(VISU::TFieldList* theFieldList,
+ 	      TGetFieldData theGetFieldData,
+ 	      const char* theFieldName);
+ 
+   template<class TGetFieldData>
++#if (__GNUG__ && __OPTIMIZE__)
++  __attribute__((noinline))
++#endif
+   vtkIntArray*
+   GetIDMapper(vtkDataSet* theIDMapperDataSet,
+ 	      TGetFieldData theGetFieldData,
#!/usr/bin/make -f
# Made with the aid of debmake, by Christoph Lameter,
# based on the sample debian/rules file for GNU hello by Ian Jackson.

package=salome
SALOME_VERSION=5.1.3

# Support multiple makes at once
ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
NJOBS := $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
else
NJOBS := 1
endif

# These are the modules which require build_configure to build.  They are
# ordered by priority and then dependency: KERNEL through NETGENPLUGIN are
# core; MULTIPR through SIERPINSKY are optional
# modules; LIGHT and PYLIGHT are alternate non-CORBA interface shells;
# HELLO through PYCALCULATOR are module examples; HXX2SALOME 
# and XDATA are module development tools.  In terms of dependency, KERNEL and
# HXX2SALOME are at the bottom, GUI depends on KERNEL, GEOM and MED also depend
# on GUI, VISU on MED and GUI, SMESH on GEOM MED and GUI, etc.
# Notes:
# - See ChangeLog regarding VISU, NETGENPLUGIN and SIERPINSKY modules.
# - XDATA is not a normal module, it needs special treatment.
# - BLSURFPLUGIN, GHS3D[PRL]PLUGIN and HexoticPLUGIN require non-free
#   libraries, and will not be part of the Debian package.
SALOME_MODULES = KERNEL_SRC_$(SALOME_VERSION) \
  GUI_SRC_$(SALOME_VERSION) \
  GEOM_SRC_$(SALOME_VERSION) \
  MED_SRC_$(SALOME_VERSION) \
  VISU_SRC_$(SALOME_VERSION) \
  SMESH_SRC_$(SALOME_VERSION) \
  YACS_SRC_$(SALOME_VERSION) \
  MULTIPR_SRC_$(SALOME_VERSION) \
  COMPONENT_SRC_$(SALOME_VERSION) \
  RANDOMIZER_SRC_$(SALOME_VERSION) \
  LIGHT_SRC_$(SALOME_VERSION) \
  PYLIGHT_SRC_$(SALOME_VERSION) \
  HELLO_SRC_$(SALOME_VERSION) \
  PYHELLO_SRC_$(SALOME_VERSION) \
  CALCULATOR_SRC_$(SALOME_VERSION) \
  PYCALCULATOR_SRC_$(SALOME_VERSION) \
  HXX2SALOME_SRC_$(SALOME_VERSION)
# XDATA_SRC_$(SALOME_VERSION) \
  BLSURFPLUGIN_SRC_$(SALOME_VERSION) \
  GHS3DPLUGIN_SRC_$(SALOME_VERSION) \
  GHS3DPRLPLUGIN_SRC_$(SALOME_VERSION) \
  HexoticPLUGIN_SRC_$(SALOME_VERSION)

clean:
	dh_testdir
	for skipfile in GEOM_SRC_$(SALOME_VERSION)/src/PARTITION/Makefile.in \
	    KERNEL_SRC_$(SALOME_VERSION)/DEPRECATED/Makefile.in; do \
	  mv $$skipfile $$skipfile.skip; \
	done
	for salomodule in $(SALOME_MODULES); do \
	  if [ -e $$salomodule/Makefile ]; then \
	    $(MAKE) -C $$salomodule maintainer-clean; \
	  fi; \
	  rm -f `find $$salomodule -name Makefile.in -print`; \
	done
	if [ -e XDATA_SRC_$(SALOME_VERSION)/Makefile ]; then \
	  make -C XDATA_SRC_$(SALOME_VERSION) maintainer-clean; \
	fi
	for skipfile in GEOM_SRC_$(SALOME_VERSION)/src/PARTITION/Makefile.in \
	    KERNEL_SRC_$(SALOME_VERSION)/DEPRECATED/Makefile.in; do \
	  mv $$skipfile.skip $$skipfile; \
	done

#	Remove new .in files
	rm -f KERNEL_SRC_$(SALOME_VERSION)/bin/runSalome.in \
	  KERNEL_SRC_$(SALOME_VERSION)/bin/killSalome.in \
	  KERNEL_SRC_$(SALOME_VERSION)/bin/appliskel/env.d/envProducts.sh.in
#	Restore obsolete files
	for obsoletefile in `find . -name \*.obs -print`; do \
	  mv -f $$obsoletefile `echo $$obsoletefile | sed s/.obs//`; \
	done
	if [ -d .pc ]; then \
	  QUILT_PATCHES=debian/patches quilt pop -a; \
	  rm -rf .pc; \
	fi
	rm -f *-stamp
	dh_clean

configure-stamp:
	dh_testdir
#	Move aside obsolete files
	for obsoletefile in KERNEL_SRC_$(SALOME_VERSION)/bin/runSalome \
	  KERNEL_SRC_$(SALOME_VERSION)/bin/appliskel/env.d/envProducts.sh \
	  YACS_SRC_$(SALOME_VERSION)/doc/Doxyfile \
	  XDATA_SRC_$(SALOME_VERSION)/aclocal.m4 \
	  XDATA_SRC_$(SALOME_VERSION)/configure \
	  `find XDATA_SRC_$(SALOME_VERSION) -name Makefile.in -print`; do \
	  if [ ! -e $$obsoletefile.obs ]; then \
	    mv $$obsoletefile $$obsoletefile.obs; \
	  fi; \
	done
#	Install new .in files
	cp -fp debian/runSalome.in debian/killSalome.in KERNEL_SRC_$(SALOME_VERSION)/bin/
	cp -fp debian/envProducts.sh.in KERNEL_SRC_$(SALOME_VERSION)/bin/appliskel/env.d/

	for salomodule in $(SALOME_MODULES); do \
	  echo; echo CONFIGURING SALOME MODULE $$salomodule; echo; \
	  (cd $$salomodule && \
	   KERNEL_ROOT_DIR=$(CURDIR)/KERNEL_SRC_$(SALOME_VERSION) \
	     GUI_ROOT_DIR=$(CURDIR)/GUI_SRC_$(SALOME_VERSION) \
	     MED_ROOT_DIR=$(CURDIR)/MED_SRC_$(SALOME_VERSION) \
	     GEOM_ROOT_DIR=$(CURDIR)/GEOM_SRC_$(SALOME_VERSION) \
	     RANDOMIZER_ROOT_DIR=$(CURDIR)/RANDOMIZER_SRC_$(SALOME_VERSION) \
	     COMPONENT_ROOT_DIR=$(CURDIR)/COMPONENT_SRC_$(SALOME_VERSION) \
	     CALCULATOR_ROOT_DIR=$(CURDIR)/CALCULATOR_SRC_$(SALOME_VERSION) \
	     PYCALCULATOR_ROOT_DIR=$(CURDIR)/PYCALCULATOR_SRC_$(SALOME_VERSION) \
	     SMESH_ROOT_DIR=$(CURDIR)/SMESH_SRC_$(SALOME_VERSION) \
	     SIERPINSKY_ROOT_DIR=$(CURDIR)/SMESH_SRC_$(SALOME_VERSION) \
	     ./build_configure && \
	   ./configure --prefix=/usr CASROOT=/usr VTKSUFFIX=-5.4 \
	     NETGENHOME=/usr \
	     --with-mpi=/usr --with-mpi_include=/usr/include/mpi \
	     KERNEL_ROOT_DIR=$(CURDIR)/KERNEL_SRC_$(SALOME_VERSION) \
	     GUI_ROOT_DIR=$(CURDIR)/GUI_SRC_$(SALOME_VERSION) \
	     MED_ROOT_DIR=$(CURDIR)/MED_SRC_$(SALOME_VERSION) \
	     GEOM_ROOT_DIR=$(CURDIR)/GEOM_SRC_$(SALOME_VERSION) \
	     RANDOMIZER_ROOT_DIR=$(CURDIR)/RANDOMIZER_SRC_$(SALOME_VERSION) \
	     COMPONENT_ROOT_DIR=$(CURDIR)/COMPONENT_SRC_$(SALOME_VERSION) \
	     CALCULATOR_ROOT_DIR=$(CURDIR)/CALCULATOR_SRC_$(SALOME_VERSION) \
	     PYCALCULATOR_ROOT_DIR=$(CURDIR)/PYCALCULATOR_SRC_$(SALOME_VERSION) \
	     SMESH_ROOT_DIR=$(CURDIR)/SMESH_SRC_$(SALOME_VERSION) \
	     SIERPINSKY_ROOT_DIR=$(CURDIR)/SMESH_SRC_$(SALOME_VERSION)); \
	done
#	Restore these when the XDATA clean target actually works
#	echo; echo CONFIGURING SALOME MODULE XDATA; echo
#	(cd XDATA_SRC_$(SALOME_VERSION) && \
	 aclocal -I adm/unix/config_files && autoconf && automake && \
	 ./configure --prefix=/usr VTKSUFFIX=-5.4 \
	   KERNEL_ROOT_DIR=$(CURDIR)/KERNEL_SRC_$(SALOME_VERSION))
	touch $@

build: build-arch build-indep
build-arch: build-arch-stamp
build-arch-stamp: configure-stamp
#	Add XDATA to list below when its clean target actually works
	for salomodule in $(SALOME_MODULES); do \
	  echo; echo COMPILING SALOME MODULE $$salomodule; echo; \
	  $(MAKE) -C $$salomodule -j $(NJOBS) bindir=/usr/bin libdir=/usr/lib docdir=/usr/share/doc/salome-doc; \
	done
	touch $@

build-indep: build-indep-stamp
build-indep-stamp: configure-stamp
	echo; echo GENERATING DOCUMENTATION IN MODULE KERNEL; echo
	make -C KERNEL_SRC_$(SALOME_VERSION)/doc usr_docs dev_docs -j $(NJOBS) DESTDIR=$(CURDIR)/debian/tmp bindir=/usr/bin libdir=/usr/lib docdir=/usr/share/doc/salome-doc
	echo; echo GENERATING DOCUMENTATION IN MODULE GUI; echo
	make -C GUI_SRC_$(SALOME_VERSION)/doc usr_docs dev_docs -j $(NJOBS) DESTDIR=$(CURDIR)/debian/tmp bindir=/usr/bin libdir=/usr/lib docdir=/usr/share/doc/salome-doc
	echo; echo GENERATING DOCUMENTATION IN MODULE GEOM; echo
	make -C GEOM_SRC_$(SALOME_VERSION)/doc usr_docs dev_docs -j $(NJOBS) DESTDIR=$(CURDIR)/debian/tmp bindir=/usr/bin libdir=/usr/lib docdir=/usr/share/doc/salome-doc
	echo; echo GENERATING DOCUMENTATION IN MODULE MED; echo
	make -C MED_SRC_$(SALOME_VERSION)/doc dev_docs -j $(NJOBS) DESTDIR=$(CURDIR)/debian/tmp bindir=/usr/bin libdir=/usr/lib docdir=/usr/share/doc/salome-doc
	echo; echo GENERATING DOCUMENTATION IN MODULE VISU; echo
	make -C VISU_SRC_$(SALOME_VERSION)/doc usr_docs dev_docs -j $(NJOBS) DESTDIR=$(CURDIR)/debian/tmp bindir=/usr/bin libdir=/usr/lib docdir=/usr/share/doc/salome-doc
	echo; echo GENERATING DOCUMENTATION IN MODULE HELLO; echo
	make -C HELLO_SRC_$(SALOME_VERSION)/doc usr_docs -j $(NJOBS) DESTDIR=$(CURDIR)/debian/tmp bindir=/usr/bin libdir=/usr/lib docdir=/usr/share/doc/salome-doc
	echo; echo GENERATING DOCUMENTATION IN MODULE PYHELLO; echo
	make -C PYHELLO_SRC_$(SALOME_VERSION)/doc usr_docs -j $(NJOBS) DESTDIR=$(CURDIR)/debian/tmp bindir=/usr/bin libdir=/usr/lib docdir=/usr/share/doc/salome-doc
	echo; echo GENERATING DOCUMENTATION IN MODULE PYCALCULATOR; echo
	make -C PYCALCULATOR_SRC_$(SALOME_VERSION)/doc dev_docs -j $(NJOBS) DESTDIR=$(CURDIR)/debian/tmp bindir=/usr/bin libdir=/usr/lib docdir=/usr/share/doc/salome-doc
	echo; echo GENERATING DOCUMENTATION IN MODULE SMESH; echo
	make -C SMESH_SRC_$(SALOME_VERSION)/doc usr_docs dev_docs -j $(NJOBS) DESTDIR=$(CURDIR)/debian/tmp bindir=/usr/bin libdir=/usr/lib docdir=/usr/share/doc/salome-doc
	echo; echo GENERATING DOCUMENTATION IN MODULE YACS; echo
	make -C YACS_SRC_$(SALOME_VERSION)/doc dev_docs -j $(NJOBS) DESTDIR=$(CURDIR)/debian/tmp bindir=/usr/bin libdir=/usr/lib docdir=/usr/share/doc/salome-doc
	touch $@

install: build install-stamp

install-arch: build-arch install-stamp

install-indep: install-indep-stamp

# Later maybe make this run make install only in the doc directories, so it
# doesn't try to build everything else
install-indep-stamp: build-indep install-stamp
	touch $@

# This installs everything, so it's not really install-arch-stamp
install-stamp:
	dh_testdir
#	Add XDATA to list below when its clean target actually works
	for salomodule in $(SALOME_MODULES); do \
	  echo; echo INSTALLING SALOME MODULE $$salomodule; echo; \
	  $(MAKE) -C $$salomodule install DESTDIR=$(CURDIR)/debian/tmp bindir=/usr/bin libdir=/usr/lib docdir=/usr/share/doc/salome-doc; \
	done
	mv debian/tmp/usr/idl debian/tmp/usr/share/
	install -d debian/tmp/usr/share/aclocal
	mv debian/tmp/usr/salome_adm/unix/config_files/check_Kernel.m4 debian/tmp/usr/share/aclocal/salome.m4
	for m4file in check_GUI.m4 check_GEOM.m4 check_Med.m4 check_RANDOMIZER.m4 check_SMESH.m4; do \
	  cat debian/tmp/usr/adm_local/unix/config_files/$$m4file >> debian/tmp/usr/share/aclocal/salome.m4; \
	done
#	Temporary kludge until there's a more permanent way to install this
	cp KERNEL_SRC_$(SALOME_VERSION)/bin/killSalome debian/tmp/usr/bin/
	chmod +x debian/tmp/usr/bin/killSalome
	install -d debian/tmp/usr/share/applications
	cp -a debian/salome.desktop debian/tmp/usr/share/applications/
	rm -f debian/tmp/usr/bin/appliskel/env.d/*.in \
	  debian/tmp/usr/bin/appliskel/env.d/*.obs
	mv debian/tmp/usr/lib/SalomePyQt.so debian/tmp/usr/lib/SalomePyQt.so.0
	ln -s SalomePyQt.so.0 debian/tmp/usr/lib/SalomePyQt.so
	mv debian/tmp/usr/Tests debian/tmp/usr/share/salome/
	rm -rf debian/tmp/usr/lib64
	rm -rf debian/tmp/usr/doc
	rm -rf debian/tmp/usr/bin/appliskel
	rm -rf debian/tmp/usr/bin/styles
	rm -rf debian/tmp/usr/bin/HXX2SALOME_GENERIC_CLASS*
	rm -f debian/tmp/usr/bin/*.pyo debian/tmp/usr/bin/*.pyc
	rm -f debian/tmp/usr/bin/*.csh debian/tmp/usr/bin/*.ksh debian/tmp/usr/bin/*.bat
	for shscript in `ls debian/tmp/usr/bin/*.sh`; do \
	  shbase=`basename $$shscript .sh`; \
	  mv debian/tmp/usr/bin/$$shbase.sh debian/tmp/usr/bin/$$shbase; \
	done
	mv debian/tmp/usr/bin/*.xml debian/tmp/usr/bin/VERSION \
	  debian/tmp/usr/bin/*.tgz debian/tmp/usr/bin/*.awk \
	  debian/tmp/usr/share/salome/
	mv debian/tmp/usr/bin/SALOME_ContainerPy.py debian/tmp/usr/bin/SALOME_Container
	mv debian/tmp/usr/bin/*.py debian/tmp/usr/lib/python2.5/*-packages/salome/
	chmod -x debian/tmp/usr/lib/python2.5/*-packages/salome/*
	install -d debian/python2.5-salome/usr/bin
	for pyscript in avs2med med2sauv salomeloader sauv2med SALOME_Container; do \
	  mv debian/tmp/usr/bin/$$pyscript debian/python2.5-salome/usr/bin/; \
	done
	(cd debian/tmp/usr/share/salome && \
	  chmod -x resources/*/*.xml *.awk *.tgz)
	install -d debian/salome-examples/usr/share/salome/examples
	cp -a SAMPLES_SRC_$(SALOME_VERSION)/* debian/salome-examples/usr/share/salome/examples/
	chmod -x `find debian/salome-examples/usr/share/salome/examples -type f`

# This installs everything that install-indep-stamp is supposed to install
	touch install-indep-stamp
	touch $@

binary-indep: install-indep
	dh_testdir -i
	dh_testroot -i
	dh_installdirs -i
	dh_movefiles -i
	dh_installdocs -i
	dh_installchangelogs -i
	dh_compress -i
	dh_fixperms -i
	dh_installdeb -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i

binary-arch: install-arch
	dh_testdir -a
	dh_testroot -a
	dh_installdirs -a
	dh_movefiles -a
	dh_installdocs -a
	dh_installchangelogs -a
	dh_installmenu -a
	dh_strip -a
	dh_makeshlibs -a
	dh_compress -a
	dh_pycentral -ppython2.5-salome
	dh_fixperms -a
	dh_installdeb -a
	dh_shlibdeps -a
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

binary: binary-arch binary-indep

.PHONY: binary binary-arch binary-indep clean install install-arch install-indep build build-arch build-indep

Reply to: