Bug 214473

Summary: editors/libreoffice: Undefined symbol "__cxa_thread_atexit"
Product: Ports & Packages Reporter: Dušan Vejnovič <freebsd>
Component: Individual Port(s)Assignee: freebsd-office mailing list <office>
Status: Closed FIXED    
Severity: Affects Some People CC: w.schwarzenfeld
Priority: --- Flags: bugzilla: maintainer-feedback? (office)
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
Poudriere build log.
none
replace thread_local with __thread
none
replace thread_local with __thread
none
revert thread_local addition
none
revert thread_local addition none

Description Dušan Vejnovič 2016-11-13 13:11:33 UTC
When start libreoffice it exit with error: /usr/local/lib/libreoffice/program/libvclplug_gtklo.so: Undefined symbol "__cxa_thread_atexit"
Comment 1 Baptiste Daroussin freebsd_committer 2016-11-13 13:31:45 UTC
Which version of freebsd are you building on, what options?
Comment 2 Dušan Vejnovič 2016-11-13 13:49:42 UTC
(In reply to Baptiste Daroussin from comment #1)

FreeBSD Version: 10.2-RELEASE

Libreoffice Version: 5.2.3_1

Libreoffice Options:
	CUPS           : on
	GNOME          : off
	GTK2           : on
	GTK3           : off
	JAVA           : off
	KDE4           : off
	MMEDIA         : off
	PGSQL          : off
	SDK            : off
	SYSTRAY        : off
	TEST           : off
	VERBOSE        : off
	WEBDAV         : off
Comment 3 Baptiste Daroussin freebsd_committer 2016-11-13 13:59:27 UTC
Are you forcing build with gcc?
Comment 4 Dušan Vejnovič 2016-11-13 14:08:59 UTC
No, use default settings.
Also attached build log of libreoffice.
Comment 5 Dušan Vejnovič 2016-11-13 14:09:51 UTC
Created attachment 176955 [details]
Poudriere build log.
Comment 6 Baptiste Daroussin freebsd_committer 2016-11-13 14:13:49 UTC
Is the problem still happening after disabling ccache?
Comment 7 Dušan Vejnovič 2016-11-13 14:16:29 UTC
I will disabling ccache, build libreoffice again and reporting result.
Comment 8 Dušan Vejnovič 2016-11-13 14:54:57 UTC
With disabled ccache, it is the same result.
Comment 9 Baptiste Daroussin freebsd_committer 2016-11-13 15:25:38 UTC
Created attachment 176957 [details]
replace thread_local with __thread
Comment 10 Baptiste Daroussin freebsd_committer 2016-11-13 15:26:00 UTC
Created attachment 176958 [details]
replace thread_local with __thread
Comment 11 Baptiste Daroussin freebsd_committer 2016-11-13 15:26:31 UTC
I have added 2 patches to be added in editors/libreoffice/files can you try them?
Comment 12 Dušan Vejnovič 2016-11-13 15:55:42 UTC
Error build:
---------- snap -----------
[build CXX] connectivity/source/drivers/file/FCatalog.cxx
[build CXX] connectivity/source/drivers/file/FColumns.cxx
[build CXX] connectivity/source/drivers/file/FConnection.cxx
[build CXX] connectivity/source/drivers/file/FDatabaseMetaData.cxx
[build CXX] connectivity/source/drivers/file/FDateFunctions.cxx
[build CXX] connectivity/source/drivers/file/FDriver.cxx
[build CXX] connectivity/source/drivers/file/FNoException.cxx
[build CXX] connectivity/source/drivers/file/FNumericFunctions.cxx
[build CXX] connectivity/source/drivers/file/FPreparedStatement.cxx
[build CXX] connectivity/source/drivers/file/FResultSet.cxx
[build CXX] connectivity/source/drivers/file/FResultSetMetaData.cxx
[build CXX] connectivity/source/drivers/file/FStatement.cxx
[build CXX] connectivity/source/drivers/file/FStringFunctions.cxx
[build CXX] connectivity/source/drivers/file/FTable.cxx
/wrkdirs/usr/ports/editors/libreoffice/work/libreoffice-5.2.3.3/vcl/unx/gtk/gtkinst.cxx:301:49: error: type of thread-local variable has non-trivial destruction
__thread std::stack<sal_uIntPtr> GtkYieldMutex::yieldCounts;
                                                ^
/wrkdirs/usr/ports/editors/libreoffice/work/libreoffice-5.2.3.3/vcl/unx/gtk/gtkinst.cxx:301:49: note: use 'thread_local' to allow this
1 error generated.
gmake[2]: *** [/wrkdirs/usr/ports/editors/libreoffice/work/libreoffice-5.2.3.3/solenv/gbuild/LinkTarget.mk:191: /wrkdirs/usr/ports/editors/libreoffice/work/libreoffice-5.2.3.3/workdir/CxxObject/vcl/unx/gtk/gtkinst.o] Error 1
gmake[2]: *** Waiting for unfinished jobs....
gmake[2]: Leaving directory '/wrkdirs/usr/ports/editors/libreoffice/work/libreoffice-5.2.3.3'
gmake[1]: *** [Makefile:258: build] Error 2
gmake[1]: Leaving directory '/wrkdirs/usr/ports/editors/libreoffice/work/libreoffice-5.2.3.3'
===> Compilation failed unexpectedly.
Comment 13 Baptiste Daroussin freebsd_committer 2016-11-13 20:45:20 UTC
Created attachment 176967 [details]
revert thread_local addition
Comment 14 Baptiste Daroussin freebsd_committer 2016-11-13 20:45:52 UTC
Created attachment 176968 [details]
revert thread_local addition
Comment 15 Baptiste Daroussin freebsd_committer 2016-11-13 20:47:25 UTC
My first approach was wrong. I have reverted (with the 2 new patches) the commit that happen during 5.2 dev which introduced usage of thread_local which makes build require __cxa_thread_atexit

Can you test them? With my testing it seems ok, but I would prefer a double check
Comment 16 Walter Schwarzenfeld freebsd_triage 2016-11-13 22:30:43 UTC
Works on 10.3-RELEASE-amd64. Thanks.
Comment 17 commit-hook freebsd_committer 2016-11-13 22:38:31 UTC
A commit references this bug:

Author: bapt
Date: Sun Nov 13 22:38:16 UTC 2016
New revision: 426069
URL: https://svnweb.freebsd.org/changeset/ports/426069

Log:
  Fix runtime issues related to thread_locale

  __cxa_thread_atexit which is needed when building c++11 program using
  thread_locale is only defined on FreeBSD 11-STABLE and 12-CURRENT

  Backout the change in libreoffice which happened during the 5.2 dev phase adding
  thread_locale

  PR:		214473
  Reported by:	Du?an Vejnovi? <freebsd@dussan.org>
  Tested by:	Du?an Vejnovi? <freebsd@dussan.org>

Changes:
  head/editors/libreoffice/Makefile.common
  head/editors/libreoffice/files/patch-Makefile.in
  head/editors/libreoffice/files/patch-vcl_inc_unx_gtk_gtkinst.hxx
  head/editors/libreoffice/files/patch-vcl_unx_gtk_gtkinst.cxx
Comment 18 commit-hook freebsd_committer 2017-02-08 22:22:29 UTC
A commit references this bug:

Author: jkim
Date: Wed Feb  8 22:22:21 UTC 2017
New revision: 433677
URL: https://svnweb.freebsd.org/changeset/ports/433677

Log:
  Do not apply the kludge for PR214473 on all supported FreeBSD versions.
  These patches actually reintroduced an upstream bug.

  https://gerrit.libreoffice.org/22291

  PR:		214473

Changes:
  head/editors/libreoffice/Makefile
  head/editors/libreoffice/files/extrapatch-vcl_inc_unx_gtk_gtkinst.hxx
  head/editors/libreoffice/files/extrapatch-vcl_unx_gtk_gtkinst.cxx
  head/editors/libreoffice/files/patch-vcl_inc_unx_gtk_gtkinst.hxx
  head/editors/libreoffice/files/patch-vcl_unx_gtk_gtkinst.cxx