gdl icon indicating copy to clipboard operation
gdl copied to clipboard

1.0 RC: build failure on ARM 32 bit

Open olebole opened this issue 5 years ago • 15 comments
trafficstars

On Debian's "armhf"/"armel" platforms (ARM processor, 32 bit), I get the following build error when linking the shared library, which looks a bit mystic to me:

[ 97%] Linking CXX shared library libgnudatalanguage.so
cd "/<<PKGBUILDDIR>>/obj-arm-linux-gnueabihf/src" && /usr/bin/cmake -E cmake_link_script CMakeFiles/gnudatalanguage.dir/link.txt --verbose=1
/usr/bin/c++ -fPIC -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -DBUILD_DATE="\"Dec  4 2019\"" -std=gnu++11 -Wdate-time -D_FORTIFY_SOURCE=2 -Wl,-z,relro -Wl,-z,now -shared -Wl,-soname,libgnudatalanguage.so.0 -o libgnudatalanguage.so.0 CMakeFiles/gnudatalanguage.dir/CFMTLexer.cpp.o CMakeFiles/gnudatalanguage.dir/FMTIn.cpp.o CMakeFiles/gnudatalanguage.dir/FMTLexer.cpp.o CMakeFiles/gnudatalanguage.dir/FMTOut.cpp.o CMakeFiles/gnudatalanguage.dir/FMTParser.cpp.o CMakeFiles/gnudatalanguage.dir/GDLInterpreter.cpp.o CMakeFiles/gnudatalanguage.dir/GDLLexer.cpp.o CMakeFiles/gnudatalanguage.dir/GDLParser.cpp.o CMakeFiles/gnudatalanguage.dir/GDLTreeParser.cpp.o CMakeFiles/gnudatalanguage.dir/datatypes.cpp.o CMakeFiles/gnudatalanguage.dir/convol.cpp.o CMakeFiles/gnudatalanguage.dir/convol2.cpp.o CMakeFiles/gnudatalanguage.dir/smooth.cpp.o CMakeFiles/gnudatalanguage.dir/basic_op.cpp.o CMakeFiles/gnudatalanguage.dir/basic_op_new.cpp.o CMakeFiles/gnudatalanguage.dir/getas.cpp.o CMakeFiles/gnudatalanguage.dir/basic_op_add.cpp.o CMakeFiles/gnudatalanguage.dir/basic_op_sub.cpp.o CMakeFiles/gnudatalanguage.dir/basic_op_mult.cpp.o CMakeFiles/gnudatalanguage.dir/basic_op_div.cpp.o CMakeFiles/gnudatalanguage.dir/default_io.cpp.o CMakeFiles/gnudatalanguage.dir/ifmt.cpp.o CMakeFiles/gnudatalanguage.dir/ofmt.cpp.o CMakeFiles/gnudatalanguage.dir/datatypes_minmax.cpp.o CMakeFiles/gnudatalanguage.dir/allix.cpp.o CMakeFiles/gnudatalanguage.dir/arrayindex.cpp.o CMakeFiles/gnudatalanguage.dir/assocdata.cpp.o CMakeFiles/gnudatalanguage.dir/basegdl.cpp.o CMakeFiles/gnudatalanguage.dir/basic_fun.cpp.o CMakeFiles/gnudatalanguage.dir/basic_fun_cl.cpp.o CMakeFiles/gnudatalanguage.dir/basic_fun_jmg.cpp.o CMakeFiles/gnudatalanguage.dir/calendar.cpp.o CMakeFiles/gnudatalanguage.dir/color.cpp.o CMakeFiles/gnudatalanguage.dir/convert2.cpp.o CMakeFiles/gnudatalanguage.dir/dcommon.cpp.o CMakeFiles/gnudatalanguage.dir/dcompiler.cpp.o CMakeFiles/gnudatalanguage.dir/dialog.cpp.o CMakeFiles/gnudatalanguage.dir/dinterpreter.cpp.o CMakeFiles/gnudatalanguage.dir/dnode.cpp.o CMakeFiles/gnudatalanguage.dir/dpro.cpp.o CMakeFiles/gnudatalanguage.dir/dstructdesc.cpp.o CMakeFiles/gnudatalanguage.dir/dstructfactory.cxx.o CMakeFiles/gnudatalanguage.dir/dstructgdl.cpp.o CMakeFiles/gnudatalanguage.dir/dvar.cpp.o CMakeFiles/gnudatalanguage.dir/envt.cpp.o CMakeFiles/gnudatalanguage.dir/extrat.cpp.o CMakeFiles/gnudatalanguage.dir/exists_fun.cpp.o CMakeFiles/gnudatalanguage.dir/fftw.cpp.o CMakeFiles/gnudatalanguage.dir/file.cpp.o CMakeFiles/gnudatalanguage.dir/fmtnode.cpp.o CMakeFiles/gnudatalanguage.dir/gdleventhandler.cpp.o CMakeFiles/gnudatalanguage.dir/gdlexception.cpp.o CMakeFiles/gnudatalanguage.dir/gdlgstream.cpp.o CMakeFiles/gnudatalanguage.dir/dSFMT/dSFMT.c.o CMakeFiles/gnudatalanguage.dir/gdlxstream.cpp.o CMakeFiles/gnudatalanguage.dir/gdljournal.cpp.o CMakeFiles/gnudatalanguage.dir/gdlhelp.cpp.o CMakeFiles/gnudatalanguage.dir/gdlpsstream.cpp.o CMakeFiles/gnudatalanguage.dir/gdlsvgstream.cpp.o CMakeFiles/gnudatalanguage.dir/gdlwidget.cpp.o CMakeFiles/gnudatalanguage.dir/gdlwidgeteventhandler.cpp.o CMakeFiles/gnudatalanguage.dir/gdlwxstream.cpp.o CMakeFiles/gnudatalanguage.dir/gdlzstream.cpp.o CMakeFiles/gnudatalanguage.dir/getfmtast.cpp.o CMakeFiles/gnudatalanguage.dir/graphicsdevice.cpp.o CMakeFiles/gnudatalanguage.dir/basic_pro.cpp.o CMakeFiles/gnudatalanguage.dir/basic_pro_jmg.cpp.o CMakeFiles/gnudatalanguage.dir/brent.cpp.o CMakeFiles/gnudatalanguage.dir/grib.cpp.o CMakeFiles/gnudatalanguage.dir/gsl_fun.cpp.o CMakeFiles/gnudatalanguage.dir/gsl_matrix.cpp.o CMakeFiles/gnudatalanguage.dir/hash.cpp.o CMakeFiles/gnudatalanguage.dir/hdf5_fun.cpp.o CMakeFiles/gnudatalanguage.dir/hdf_fun.cpp.o CMakeFiles/gnudatalanguage.dir/hdf_pro.cpp.o CMakeFiles/gnudatalanguage.dir/image.cpp.o CMakeFiles/gnudatalanguage.dir/initct.cpp.o CMakeFiles/gnudatalanguage.dir/initsysvar.cpp.o CMakeFiles/gnudatalanguage.dir/io.cpp.o CMakeFiles/gnudatalanguage.dir/lapack.cpp.o CMakeFiles/gnudatalanguage.dir/least_squares.cpp.o CMakeFiles/gnudatalanguage.dir/libinit.cpp.o CMakeFiles/gnudatalanguage.dir/libinit_ac.cpp.o CMakeFiles/gnudatalanguage.dir/libinit_cl.cpp.o CMakeFiles/gnudatalanguage.dir/libinit_gm.cpp.o CMakeFiles/gnudatalanguage.dir/libinit_jmg.cpp.o CMakeFiles/gnudatalanguage.dir/libinit_mes.cpp.o CMakeFiles/gnudatalanguage.dir/libinit_ng.cpp.o CMakeFiles/gnudatalanguage.dir/libinit_jp.cpp.o CMakeFiles/gnudatalanguage.dir/libinit_exists.cpp.o CMakeFiles/gnudatalanguage.dir/linearprogramming.cpp.o CMakeFiles/gnudatalanguage.dir/list.cpp.o CMakeFiles/gnudatalanguage.dir/magick_cl.cpp.o CMakeFiles/gnudatalanguage.dir/math_fun.cpp.o CMakeFiles/gnudatalanguage.dir/math_fun_ac.cpp.o CMakeFiles/gnudatalanguage.dir/math_fun_gm.cpp.o CMakeFiles/gnudatalanguage.dir/math_fun_jmg.cpp.o CMakeFiles/gnudatalanguage.dir/math_fun_ng.cpp.o CMakeFiles/gnudatalanguage.dir/math_utl.cpp.o CMakeFiles/gnudatalanguage.dir/matrix_cholesky.cpp.o CMakeFiles/gnudatalanguage.dir/matrix_invert.cpp.o CMakeFiles/gnudatalanguage.dir/mpi.cpp.o CMakeFiles/gnudatalanguage.dir/ncdf_att_cl.cpp.o CMakeFiles/gnudatalanguage.dir/ncdf_cl.cpp.o CMakeFiles/gnudatalanguage.dir/ncdf_dim_cl.cpp.o CMakeFiles/gnudatalanguage.dir/ncdf_var_cl.cpp.o CMakeFiles/gnudatalanguage.dir/ncdf4_group.cpp.o CMakeFiles/gnudatalanguage.dir/newprognode.cpp.o CMakeFiles/gnudatalanguage.dir/nullgdl.cpp.o CMakeFiles/gnudatalanguage.dir/objects.cpp.o CMakeFiles/gnudatalanguage.dir/overload.cpp.o CMakeFiles/gnudatalanguage.dir/plotting_axis.cpp.o CMakeFiles/gnudatalanguage.dir/plotting_contour.cpp.o CMakeFiles/gnudatalanguage.dir/plotting_convert_coord.cpp.o CMakeFiles/gnudatalanguage.dir/plotting_cursor.cpp.o CMakeFiles/gnudatalanguage.dir/plotting_device.cpp.o CMakeFiles/gnudatalanguage.dir/plotting_erase.cpp.o CMakeFiles/gnudatalanguage.dir/plotting_image.cpp.o CMakeFiles/gnudatalanguage.dir/plotting_misc.cpp.o CMakeFiles/gnudatalanguage.dir/plotting_oplot.cpp.o CMakeFiles/gnudatalanguage.dir/plotting_plot.cpp.o CMakeFiles/gnudatalanguage.dir/plotting_plots.cpp.o CMakeFiles/gnudatalanguage.dir/plotting_polyfill.cpp.o CMakeFiles/gnudatalanguage.dir/plotting_shade_surf.cpp.o CMakeFiles/gnudatalanguage.dir/plotting_surface.cpp.o CMakeFiles/gnudatalanguage.dir/plotting_windows.cpp.o CMakeFiles/gnudatalanguage.dir/plotting_xyouts.cpp.o CMakeFiles/gnudatalanguage.dir/plotting.cpp.o CMakeFiles/gnudatalanguage.dir/print.cpp.o CMakeFiles/gnudatalanguage.dir/print_tree.cpp.o CMakeFiles/gnudatalanguage.dir/prognode.cpp.o CMakeFiles/gnudatalanguage.dir/prognode_lexpr.cpp.o CMakeFiles/gnudatalanguage.dir/prognodeexpr.cpp.o CMakeFiles/gnudatalanguage.dir/projections.cpp.o CMakeFiles/gnudatalanguage.dir/randomgenerators.cpp.o CMakeFiles/gnudatalanguage.dir/read.cpp.o CMakeFiles/gnudatalanguage.dir/saverestore.cpp.o CMakeFiles/gnudatalanguage.dir/semshm.cpp.o CMakeFiles/gnudatalanguage.dir/sigfpehandler.cpp.o CMakeFiles/gnudatalanguage.dir/sorting.cpp.o CMakeFiles/gnudatalanguage.dir/str.cpp.o CMakeFiles/gnudatalanguage.dir/terminfo.cpp.o CMakeFiles/gnudatalanguage.dir/tiff.cxx.o CMakeFiles/gnudatalanguage.dir/topython.cpp.o CMakeFiles/gnudatalanguage.dir/triangulation.cpp.o CMakeFiles/gnudatalanguage.dir/typetraits.cpp.o CMakeFiles/gnudatalanguage.dir/where.cpp.o CMakeFiles/gnudatalanguage.dir/widget.cpp.o CMakeFiles/gnudatalanguage.dir/Shapefiles.cpp.o CMakeFiles/gnudatalanguage.dir/sax.cpp.o  -L/usr/lib/arm-linux-gnueabihf/hdf5/serial -lantlr-pic -ldl -lncurses -lform -lreadline -lhistory -lz -lpng -lz -fopenmp -lgsl -lgslcblas -lplplot -lplplotcxx -lGraphicsMagick -lGraphicsMagick++ -L/usr/lib/arm-linux-gnueabihf -pthread -lwx_baseu-3.0 -lwx_gtk3u_core-3.0 -lwx_gtk3u_adv-3.0 -ltiff -lgeotiff -lnetcdf -lhdf5_hl -lhdf5 -lpthread -lsz -lz -ldl -lm -lcurl -lmfhdfalt -ldfalt -lz -ljpeg -lfftw3 -lfftw3f -lproj -lpython3.7m -ludunits2 -lps -leccodes -lglpk -lshp -lexpat -lSM -lICE -lX11 -lXext -ldl -lncurses -lform -lreadline -lhistory -lz -lpng -lgsl -lgslcblas -lplplot -lplplotcxx -lGraphicsMagick -lGraphicsMagick++ -lwx_baseu-3.0 -lwx_gtk3u_core-3.0 -lwx_gtk3u_adv-3.0 -ltiff -lgeotiff -lnetcdf -lhdf5_hl -lhdf5 -lpthread -lsz -lm -lcurl -lmfhdfalt -ldfalt -ljpeg -lfftw3 -lfftw3f -lproj -lpython3.7m -ludunits2 -lps -leccodes -lglpk -lshp -lexpat -lSM -lICE -lX11 -lXext 
/usr/bin/ld: CMakeFiles/gnudatalanguage.dir/basic_op.cpp.o:(.rodata+0x18): multiple definition of `typeinfo name for Data_<SpDByte>'; CMakeFiles/gnudatalanguage.dir/datatypes.cpp.o:(.rodata+0x60): first defined here
/usr/bin/ld: CMakeFiles/gnudatalanguage.dir/basic_op.cpp.o:(.data.rel.ro+0x0): multiple definition of `typeinfo for Data_<SpDByte>'; CMakeFiles/gnudatalanguage.dir/datatypes.cpp.o:(.data.rel.ro+0x0): first defined here
/usr/bin/ld: CMakeFiles/gnudatalanguage.dir/basic_op.cpp.o:(.rodata+0x2c): multiple definition of `typeinfo name for Data_<SpDObj>'; CMakeFiles/gnudatalanguage.dir/datatypes.cpp.o:(.rodata+0x74): first defined here
/usr/bin/ld: CMakeFiles/gnudatalanguage.dir/basic_op.cpp.o:(.data.rel.ro+0xc): multiple definition of `typeinfo for Data_<SpDObj>'; CMakeFiles/gnudatalanguage.dir/datatypes.cpp.o:(.data.rel.ro+0xc): first defined here

[… more "muliple definition of `typeinfo name for Data_<…>'" errors follow …]

collect2: error: ld returned 1 exit status
make[3]: *** [src/CMakeFiles/gnudatalanguage.dir/build.make:2385: src/libgnudatalanguage.so.0] Error 1

Full build log here. I have no idea what this is about.

olebole avatar Dec 04 '19 14:12 olebole

Hi @olebole , hmmm looks like an aftermath of the source-splitting edition of datatypes.cpp that was so huge it would take forever to compile. Strange that this does not pass on the arm when it's ok on all the other platforms. Indeed, 9 other source files (basic_op.cpp, ifmt.cpp, ofmt.cpp, defaul_io.cpp, basic_op_mult.cpp, basic_op_div.cpp,basic_op_add.cpp, basic_op_sub.cpp,basic_op_new.cpp) 'refine' the basic GDL objects (Bytes, Ints etc). I suppose the arm compiler does not like to see the objects "augmented" in a separate file but certainly there should be a compiler option to do that?

Of course there is always a solution by including these .cpp files as includes in datatypes.cpp, provided a lot of #ifdefs all over the place...

GillesDuvert avatar Dec 23 '19 16:12 GillesDuvert

Seeing the same on Fedora - https://kojipkgs.fedoraproject.org//work/tasks/4157/41324157/build.log

opoplawski avatar Feb 02 '20 03:02 opoplawski

This happens with 1.0.o~rc2 as well.

olebole avatar May 21 '20 11:05 olebole

I do not see any way out except reverting to the earlier version where the compilation time was x 4. Or, would we have a better result by allowing C++17 ?

GillesDuvert avatar May 21 '20 11:05 GillesDuvert

@GillesDuvert (from https://github.com/gnudatalanguage/gdl/issues/761#issuecomment-632099244)

@olebole how is it that compiling problem #677 appears on armel and not on arm64? different gcc versions?

The software environment is basically the same on armhf as on the other platforms (amd64, arm64, i386 etc.). Specifically, I compared the output of cmake between armhf and arm64, without any differences. The C compiler is of version 9.3.0:

-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0

olebole avatar May 21 '20 18:05 olebole

I am hitting that bug too, and this is not a new story. More details can be found here: https://github.com/mamedev/mame/issues/3639

The short story is: C++ standards are violated and we get what we deserved; this shows up only on ARM v7 because the ABI is stricter for various reasons that you can find in the mame thread. The fix is to do it the long way, instantiate only once the symbol... Cheers, Chris.

eatdust avatar Jul 11 '20 20:07 eatdust

To give an update here: this remains a problem with version 1.0.0, on ARM 32 bit. It works on ARM 64 bit and on x86 32 bit.

olebole avatar Aug 19 '21 20:08 olebole

Another Debian Developer (@AdrianBunk) just proposed as a workaround to add -Wl,--allow-multiple-definition to LDFLAGS. On Debian, this works. @eatdust, this may help you as well.

olebole avatar Aug 24 '21 12:08 olebole

I love you olebole, and send my kisses to AdrianBunk :) That works perfectly. GDL-1.0.0 landing on Mageia Cauldron as well.

Thanks!

eatdust avatar Aug 24 '21 21:08 eatdust

Would it then make sense to add it to GDL CMake default linker flags?

slayoo avatar Aug 25 '21 04:08 slayoo

As a workaround on ARM, this would probably be useful.

olebole avatar Aug 25 '21 06:08 olebole

Adding it (for the linkers that support it (?)) seems necessary. The symbols 'code' are repeated in the different .o files, but it is the same code, so no risk.

GillesDuvert avatar Aug 25 '21 09:08 GillesDuvert

Did somebody do it?

GillesDuvert avatar Sep 03 '21 08:09 GillesDuvert

@GillesDuvert you mean whether somebody tested it? I already uploaded a gnudatalanguage package to Debian with that change, and it compiled.

olebole avatar Sep 03 '21 12:09 olebole

I meant, add -Wl,--allow-multiple-definition to wherever it shoudl be in the CMake thingies (I suspect it is not allowed for all compilers...)

GillesDuvert avatar Sep 03 '21 12:09 GillesDuvert