Skip to content

question about "#include "instantiate_templates.hpp" & duplicate symbol #1046

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
alaingdl opened this issue Aug 5, 2021 · 3 comments
Closed

Comments

@alaingdl
Copy link
Contributor

alaingdl commented Aug 5, 2021

On OSX with GCC (gcc-11 & c++-11 provided by Brew) I have a very large number of duplicate symbol and the link fails.

[...]
duplicate symbol __ZTS5Data_I6SpDIntE in:
    CMakeFiles/gdl.dir/datatypes.cpp.o
    CMakeFiles/gdl.dir/basic_op_div.cpp.o
[...]
duplicate symbol __ZTS5Data_I8SpDFloatE in:
    CMakeFiles/gdl.dir/datatypes.cpp.o
    CMakeFiles/gdl.dir/default_io.cpp.o
[...]
  1. It seems that all the files (cpp) concerned are containing #include "instantiate_templates.hpp"
  2. Could someone explains why we do need that, and at the end of those files ?
    (and not at the beginning ?)

List : datatypes.cpp, all files basic_op_*.cpp, objects.cpp, ofmt.cpp, ifmt.cpp ...
(grep -ni instantiate src/*pp)

@GillesDuvert
Copy link
Contributor

see #734
The duplication is indeed due to several .cpp compiling and creating their version of the same symbols. And linkers may or not accept that. We know that these symbols are the same functions, the duplication is, er, harmless. Could yo try to add
--allow-multiple-definition
as a switch to the linker (ld)

@GillesDuvert
Copy link
Contributor

--allow-multiple-definition ... is not supported on gcc à la homebrew (???)

@GillesDuvert
Copy link
Contributor

closed by #1776

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants