| Ticket Hash: | c6cc9e097be16bd328603059e0ac3a73269ef25e | ||
| Title: | MacOS Catalina duplicate symbol _tdomStubsPtr | ||
| Status: | Closed | Type: | Build_Problem |
| Severity: | Critical | Priority: | Immediate |
| Subsystem: | Resolution: | Fixed | |
| Last Modified: |
2020-06-11 00:54:00 5.41 years ago |
Created: |
2020-06-05 07:39:51 5.42 years ago |
| Version Found In: | trunk | ||
| User Comments: | ||||
|
anonymous added on 2020-06-05 07:39:51:
Hi, I cloned the tkdom repo, opened it, and then tried to build it with the following options: ./configure --with-tcl='/usr/local/opt/tcl-tk/lib' --enable-html5 makeand I receive the following error:
gcc -dynamiclib -pipe -Os -DNDEBUG -Wall -fno-common -I/usr/local/opt/tcl-tk/include -I/usr/local/opt/tcl-tk/include -L/usr/local/opt/tcl-tk/lib -L/usr/local/opt/tcl-tk/lib -prebind -headerpad_max_install_names -Wl,-search_paths_first -Wl,-single_module -current_version 0.9.2 -compatibility_version 0.9.2 -o libtdom0.9.2.dylib xmlrole.o xmltok.o xmlparse.o xmlsimple.o dom.o domhtml.o domhtml5.o domjson.o domxpath.o domxslt.o domlock.o tcldom.o nodecmd.o tdominit.o tclexpat.o tclpull.o tdomStubInit.o -L/usr/local/Cellar/gumbo-parser/0.10.1/lib -lgumbo -L/usr/local/Cellar/tcl-tk/8.6.10/lib -ltclstub8.6
ld: warning: option -prebind is obsolete and being ignored
duplicate symbol '_tdomStubsPtr' in:
tdominit.o
tclpull.o
duplicate symbol '_tdomStubsPtr' in:
tdominit.o
tdomStubInit.o
ld: 2 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [libtdom0.9.2.dylib] Error 1
I've experimented with both --disable stubsand removing --enable-html5and receive the same error when building, in the linking step. My system: MacOS Catalina 10.15.5My clang version: Apple clang version 11.0.3 (clang-1103.0.32.62) Target: x86_64-apple-darwin19.5.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/binMy tcl version: tcl-tk: stable 8.6.10Thanks meff rolf added on 2020-06-05 11:04:26: Thanks for reporting. Unfortunately I haven't an OS X box at hand atm to reproduce the problem. Is this about trunk or the state of the latest release (tag tdom-0-9-1)? Both trunk and the lastest release build for me on linux with gcc and clang (I've clang version 3.8.1-24 - is this in fact that much older than yours as the version nummers suggest?) without problems (or even warnings, at least for trunk) and it builds for me on windows (w/ mingw). From the reported error msg and looking at the sources nothing obvious strikes me. I'm in need for your help, to track this down. anonymous added on 2020-06-09 22:14:25: Hi de!
I confirm this issue on my box (but I don't know why this would be specific to macOS, or why you don't see the symbol duplicates elsewhere).
Between these two commits
fossil diff --from d4bb0eb147b1671a --to d41caf001d9d4d2a
in tdomDecls.h you dropped "extern" for
-extern const TdomStubs *tdomStubsPtr;
+const TdomStubs *tdomStubsPtr;
This leads to the classic duplicate definition in the compilation units including tdomDecls.h during linking (tdominit.c and tdomStubLib.c, for example).
The below fixes this for me (and aligns the definition in tdominit.c).
-------%<-------
Index: generic/tdomDecls.h
==================================================================
--- generic/tdomDecls.h
+++ generic/tdomDecls.h
@@ -85,11 +85,11 @@
int (*xML_GetIdAttributeIndex) (XML_Parser parser); /* 15 */
domNode * (*tcldom_getNodeFromName) (Tcl_Interp *interp, char *nodeName, char **errMsg); /* 16 */
domDocument * (*tcldom_getDocumentFromName) (Tcl_Interp *interp, char *docName, char **errMsg); /* 17 */
} TdomStubs;
-const TdomStubs *tdomStubsPtr;
+EXTERN const TdomStubs *tdomStubsPtr;
#ifdef __cplusplus
}
#endif
Index: generic/tdominit.c
==================================================================
--- generic/tdominit.c
+++ generic/tdominit.c
@@ -39,11 +39,11 @@
#include <dom.h>
#include <tdom.h>
#include <tcldom.h>
#include <tclpull.h>
-extern TdomStubs tdomStubs;
+const TdomStubs *tdomStubsPtr;
/*
*----------------------------------------------------------------------------
*
* Tdom_Init --
@@ -93,11 +93,11 @@
Tcl_CreateObjCommand(interp, "tdom::pullparser", tDOM_PullParserCmd, NULL, NULL );
#endif
#ifdef USE_TCL_STUBS
Tcl_PkgProvideEx(interp, PACKAGE_NAME, PACKAGE_VERSION,
- (ClientData) &tdomStubs);
+ (ClientData) tdomStubsPtr);
#else
Tcl_PkgProvide(interp, PACKAGE_NAME, PACKAGE_VERSION);
#endif
return TCL_OK;
-------%<-------
HTH, mr_calvin
rolf added on 2020-06-11 00:54:00: Reverted my fix and applied the better one provided by mr_calvin. Thanks. | ||||