Repository: conan-io/conan-center-index

Issue:
[package] wt/4.3.1: duplicate symbols during linking, "multiple definition of `Wt::WServer::~WServer()"
### Package and Environment Details (include every applicable attribute)
  * Package Name/Version: **wt/4.3.1**
  * Operating System+version: **Linux Ubuntu 20.04**
  * Compiler+version: **GCC 9**
  * Docker image: **N/A**
  * Conan version: **conan 1.26.1**
  * Python version: **Python 3.8.2**


### Conan profile (output of `conan profile show default` or `conan profile show <profile>` if custom profile is in use)
```
Configuration for profile default:

[settings]
os=Linux
os_build=Linux
arch=x86_64
arch_build=x86_64
compiler=gcc
compiler.version=7
compiler.libcxx=libstdc++11
build_type=Release
[options]
[build_requires]
[env]
```


### Steps to reproduce (Include if Applicable)
Just trying to upgrade from a local install of 4.3.0 to the conan version 4.3.1. I don't think that wttest lib should be
there. It would also be nice to have a component version of the library.

```
 target_link_libraries(ppb.wt PRIVATE project_options
-                                          Wt::HTTP
-                                          Wt::DboSqlite3
-                                          Wt::Dbo
-                                          Wt::Wt
+                                          CONAN_PKG::wt
+  #                                        Wt::HTTP
+  #                                        Wt::DboSqlite3
+  #                                        Wt::Dbo
+  #                                        Wt::Wt
                                           CONAN_PKG::nlohmann_json
                                           stdc+
```

### Logs (Include/Attach if Applicable)
<details><summary>Click to expand log</summary>

```
[1/1] Linking CXX executable bin/ppb.wt
FAILED: bin/ppb.wt 
: && /usr/bin/c++  -O2 -g -DNDEBUG   ppb/CMakeFiles/ppb.wt.dir/model/cart.cpp.o ppb/CMakeFiles/ppb.wt.dir/ppb_application.cpp.o ppb/CMakeFiles/ppb.wt.dir/db/db_types.cpp.o ppb/CMakeFiles/ppb.wt.dir/db/static_product_database.cpp.o ppb/CMakeFiles/ppb.wt.dir/model/product_session.cpp.o ppb/CMakeFiles/ppb.wt.dir/model/product_database.cpp.o ppb/CMakeFiles/ppb.wt.dir/widget/anchor.cpp.o ppb/CMakeFiles/ppb.wt.dir/widget/text_button_box.cpp.o ppb/CMakeFiles/ppb.wt.dir/view/ppb_view.cpp.o ppb/CMakeFiles/ppb.wt.dir/view/ppb_cart_view.cpp.o ppb/CMakeFiles/ppb.wt.dir/main.cpp.o  -o bin/ppb.wt  -lstdc++fs  /home/ppetraki/.conan/data/wt/4.3.1/_/_/package/2982a0e1e85adfb154853ddea2afc96acdfb5a3d/lib/libwttest.a  /home/ppetraki/.conan/data/wt/4.3.1/_/_/package/2982a0e1e85adfb154853ddea2afc96acdfb5a3d/lib/libwtdbopostgres.a  /home/ppetraki/.conan/data/wt/4.3.1/_/_/package/2982a0e1e85adfb154853ddea2afc96acdfb5a3d/lib/libwtdbosqlite3.a  /home/ppetraki/.conan/data/wt/4.3.1/_/_/package/2982a0e1e85adfb154853ddea2afc96acdfb5a3d/lib/libwtdbomysql.a  /home/ppetraki/.conan/data/wt/4.3.1/_/_/package/2982a0e1e85adfb154853ddea2afc96acdfb5a3d/lib/libwtdbo.a  /home/ppetraki/.conan/data/wt/4.3.1/_/_/package/2982a0e1e85adfb154853ddea2afc96acdfb5a3d/lib/libwthttp.a  /home/ppetraki/.conan/data/wt/4.3.1/_/_/package/2982a0e1e85adfb154853ddea2afc96acdfb5a3d/lib/libwt.a  /home/ppetraki/.conan/data/boost/1.73.0/_/_/package/7e3a27591b41ce17376bfed79a95acf351cb2212/lib/libboost_wave.a  /home/ppetraki/.conan/data/boost/1.73.0/_/_/package/7e3a27591b41ce17376bfed79a95acf351cb2212/lib/libboost_container.a  /home/ppetraki/.conan/data/boost/1.73.0/_/_/package/7e3a27591b41ce17376bfed79a95acf351cb2212/lib/libboost_contract.a  /home/ppetraki/.conan/data/boost/1.73.0/_/_/package/7e3a27591b41ce17376bfed79a95acf351cb2212/lib/libboost_exception.a  /home/ppetraki/.conan/data/boost/1.73.0/_/_/package/7e3a27591b41ce17376bfed79a95acf351cb2212/lib/libboost_graph.a  /home/ppetraki/.conan/data/boost/1.73.0/_/_/package/7e3a27591b41ce17376bfed79a95acf351cb2212/lib/libboost_iostreams.a  /home/ppetraki/.conan/data/boost/1.73.0/_/_/package/7e3a27591b41ce17376bfed79a95acf351cb2212/lib/libboost_locale.a  /home/ppetraki/.conan/data/boost/1.73.0/_/_/package/7e3a27591b41ce17376bfed79a95acf351cb2212/lib/libboost_log.a  /home/ppetraki/.conan/data/boost/1.73.0/_/_/package/7e3a27591b41ce17376bfed79a95acf351cb2212/lib/libboost_program_options.a  /home/ppetraki/.conan/data/boost/1.73.0/_/_/package/7e3a27591b41ce17376bfed79a95acf351cb2212/lib/libboost_random.a  /home/ppetraki/.conan/data/boost/1.73.0/_/_/package/7e3a27591b41ce17376bfed79a95acf351cb2212/lib/libboost_regex.a  /home/ppetraki/.conan/data/boost/1.73.0/_/_/package/7e3a27591b41ce17376bfed79a95acf351cb2212/lib/libboost_serialization.a  /home/ppetraki/.conan/data/boost/1.73.0/_/_/package/7e3a27591b41ce17376bfed79a95acf351cb2212/lib/libboost_wserialization.a  /home/ppetraki/.conan/data/boost/1.73.0/_/_/package/7e3a27591b41ce17376bfed79a95acf351cb2212/lib/libboost_coroutine.a  /home/ppetraki/.conan/data/boost/1.73.0/_/_/package/7e3a27591b41ce17376bfed79a95acf351cb2212/lib/libboost_fiber.a  /home/ppetraki/.conan/data/boost/1.73.0/_/_/package/7e3a27591b41ce17376bfed79a95acf351cb2212/lib/libboost_context.a  /home/ppetraki/.conan/data/boost/1.73.0/_/_/package/7e3a27591b41ce17376bfed79a95acf351cb2212/lib/libboost_timer.a  /home/ppetraki/.conan/data/boost/1.73.0/_/_/package/7e3a27591b41ce17376bfed79a95acf351cb2212/lib/libboost_thread.a  /home/ppetraki/.conan/data/boost/1.73.0/_/_/package/7e3a27591b41ce17376bfed79a95acf351cb2212/lib/libboost_chrono.a  /home/ppetraki/.conan/data/boost/1.73.0/_/_/package/7e3a27591b41ce17376bfed79a95acf351cb2212/lib/libboost_date_time.a  /home/ppetraki/.conan/data/boost/1.73.0/_/_/package/7e3a27591b41ce17376bfed79a95acf351cb2212/lib/libboost_atomic.a  /home/ppetraki/.conan/data/boost/1.73.0/_/_/package/7e3a27591b41ce17376bfed79a95acf351cb2212/lib/libboost_filesystem.a  /home/ppetraki/.conan/data/boost/1.73.0/_/_/package/7e3a27591b41ce17376bfed79a95acf351cb2212/lib/libboost_system.a  /home/ppetraki/.conan/data/boost/1.73.0/_/_/package/7e3a27591b41ce17376bfed79a95acf351cb2212/lib/libboost_type_erasure.a  /home/ppetraki/.conan/data/boost/1.73.0/_/_/package/7e3a27591b41ce17376bfed79a95acf351cb2212/lib/libboost_log_setup.a  /home/ppetraki/.conan/data/boost/1.73.0/_/_/package/7e3a27591b41ce17376bfed79a95acf351cb2212/lib/libboost_math_c99.a  /home/ppetraki/.conan/data/boost/1.73.0/_/_/package/7e3a27591b41ce17376bfed79a95acf351cb2212/lib/libboost_math_c99f.a  /home/ppetraki/.conan/data/boost/1.73.0/_/_/package/7e3a27591b41ce17376bfed79a95acf351cb2212/lib/libboost_math_c99l.a  /home/ppetraki/.conan/data/boost/1.73.0/_/_/package/7e3a27591b41ce17376bfed79a95acf351cb2212/lib/libboost_math_tr1.a  /home/ppetraki/.conan/data/boost/1.73.0/_/_/package/7e3a27591b41ce17376bfed79a95acf351cb2212/lib/libboost_math_tr1f.a  /home/ppetraki/.conan/data/boost/1.73.0/_/_/package/7e3a27591b41ce17376bfed79a95acf351cb2212/lib/libboost_math_tr1l.a  /home/ppetraki/.conan/data/boost/1.73.0/_/_/package/7e3a27591b41ce17376bfed79a95acf351cb2212/lib/libboost_nowide.a  /home/ppetraki/.conan/data/boost/1.73.0/_/_/package/7e3a27591b41ce17376bfed79a95acf351cb2212/lib/libboost_stacktrace_addr2line.a  /home/ppetraki/.conan/data/boost/1.73.0/_/_/package/7e3a27591b41ce17376bfed79a95acf351cb2212/lib/libboost_stacktrace_backtrace.a  /home/ppetraki/.conan/data/boost/1.73.0/_/_/package/7e3a27591b41ce17376bfed79a95acf351cb2212/lib/libboost_stacktrace_basic.a  /home/ppetraki/.conan/data/boost/1.73.0/_/_/package/7e3a27591b41ce17376bfed79a95acf351cb2212/lib/libboost_stacktrace_noop.a  /home/ppetraki/.conan/data/boost/1.73.0/_/_/package/7e3a27591b41ce17376bfed79a95acf351cb2212/lib/libboost_unit_test_framework.a  -lrt  /home/ppetraki/.conan/data/bzip2/1.0.8/_/_/package/ff2ff6bb41ed84283a6634bada252c37f13eb93c/lib/libbz2.a  /home/ppetraki/.conan/data/sqlite3/3.31.1/_/_/package/3227f52e0374b0fd6694f607708d905c74b60866/lib/libsqlite3.a  /home/ppetraki/.conan/data/libmysqlclient/8.0.17/_/_/package/28945b70ae74bb6ebb259ca1f8be9f4b4b86384a/lib/libmysqlclient.a  /home/ppetraki/.conan/data/openssl/1.1.1g/_/_/package/6b7ff26bfd4c2cf2ccba522bfba2d2e7820e40da/lib/libssl.a  /home/ppetraki/.conan/data/openssl/1.1.1g/_/_/package/6b7ff26bfd4c2cf2ccba522bfba2d2e7820e40da/lib/libcrypto.a  -ldl  -lstdc++  -lm  /home/ppetraki/.conan/data/libpq/11.5/_/_/package/37e2cf0ad9b4cbcb2b2a3538a853ba3e45956a8e/lib/libpq.a  /home/ppetraki/.conan/data/libpq/11.5/_/_/package/37e2cf0ad9b4cbcb2b2a3538a853ba3e45956a8e/lib/libpgcommon.a  /home/ppetraki/.conan/data/zlib/1.2.11/_/_/package/6b7ff26bfd4c2cf2ccba522bfba2d2e7820e40da/lib/libz.a  /home/ppetraki/.conan/data/libunwind/1.3.1/_/_/package/f72b33a5a0666d86cece5faa303b85f79aacec62/lib/libunwind.a  /home/ppetraki/.conan/data/libunwind/1.3.1/_/_/package/f72b33a5a0666d86cece5faa303b85f79aacec62/lib/libunwind-coredump.a  /home/ppetraki/.conan/data/libunwind/1.3.1/_/_/package/f72b33a5a0666d86cece5faa303b85f79aacec62/lib/libunwind-generic.a  /home/ppetraki/.conan/data/libunwind/1.3.1/_/_/package/f72b33a5a0666d86cece5faa303b85f79aacec62/lib/libunwind-ptrace.a  /home/ppetraki/.conan/data/libunwind/1.3.1/_/_/package/f72b33a5a0666d86cece5faa303b85f79aacec62/lib/libunwind-setjmp.a  /home/ppetraki/.conan/data/libunwind/1.3.1/_/_/package/f72b33a5a0666d86cece5faa303b85f79aacec62/lib/libunwind-x86_64.a  /home/ppetraki/.conan/data/xz_utils/5.2.4/_/_/package/6b7ff26bfd4c2cf2ccba522bfba2d2e7820e40da/lib/liblzma.a  -lpthread && :
/usr/bin/ld: /home/ppetraki/.conan/data/wt/4.3.1/_/_/package/2982a0e1e85adfb154853ddea2afc96acdfb5a3d/lib/libwthttp.a(WServer.C.o): in function `Wt::WServer::~WServer()':
/home/ppetraki/.conan/data/wt/4.3.1/_/_/build/2982a0e1e85adfb154853ddea2afc96acdfb5a3d/source_subfolder/src/http/WServer.C:104: multiple definition of `Wt::WServer::~WServer()'; /home/ppetraki/.conan/data/wt/4.3.1/_/_/package/2982a0e1e85adfb154853ddea2afc96acdfb5a3d/lib/libwttest.a(WTestEnvironment.C.o):/home/ppetraki/.conan/data/wt/4.3.1/_/_/build/2982a0e1e85adfb154853ddea2afc96acdfb5a3d/source_subfolder/src/Wt/Test/WTestEnvironment.C:33: first defined here
/usr/bin/ld: /home/ppetraki/.conan/data/wt/4.3.1/_/_/package/2982a0e1e85adfb154853ddea2afc96acdfb5a3d/lib/libwthttp.a(WServer.C.o): in function `Wt::WServer::~WServer()':
/home/ppetraki/.conan/data/wt/4.3.1/_/_/build/2982a0e1e85adfb154853ddea2afc96acdfb5a3d/source_subfolder/src/http/WServer.C:104: multiple definition of `Wt::WServer::~WServer()'; /home/ppetraki/.conan/data/wt/4.3.1/_/_/package/2982a0e1e85adfb154853ddea2afc96acdfb5a3d/lib/libwttest.a(WTestEnvironment.C.o):/home/ppetraki/.conan/data/wt/4.3.1/_/_/build/2982a0e1e85adfb154853ddea2afc96acdfb5a3d/source_subfolder/src/Wt/Test/WTestEnvironment.C:33: first defined here
/usr/bin/ld: /home/ppetraki/.conan/data/wt/4.3.1/_/_/package/2982a0e1e85adfb154853ddea2afc96acdfb5a3d/lib/libwthttp.a(WServer.C.o): in function `Wt::WServer::~WServer()':
/home/ppetraki/.conan/data/wt/4.3.1/_/_/build/2982a0e1e85adfb154853ddea2afc96acdfb5a3d/source_subfolder/src/http/WServer.C:104: multiple definition of `Wt::WServer::~WServer()'; /home/ppetraki/.conan/data/wt/4.3.1/_/_/package/2982a0e1e85adfb154853ddea2afc96acdfb5a3d/lib/libwttest.a(WTestEnvironment.C.o):/home/ppetraki/.conan/data/wt/4.3.1/_/_/build/2982a0e1e85adfb154853ddea2afc96acdfb5a3d/source_subfolder/src/Wt/Test/WTestEnvironment.C:33: first defined here
/usr/bin/ld: /home/ppetraki/.conan/data/wt/4.3.1/_/_/package/2982a0e1e85adfb154853ddea2afc96acdfb5a3d/lib/libwthttp.a(WServer.C.o): in function `Wt::WServer::WServer(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
/home/ppetraki/.conan/data/wt/4.3.1/_/_/build/2982a0e1e85adfb154853ddea2afc96acdfb5a3d/source_subfolder/src/http/WServer.C:79: multiple definition of `Wt::WServer::WServer(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'; /home/ppetraki/.conan/data/wt/4.3.1/_/_/package/2982a0e1e85adfb154853ddea2afc96acdfb5a3d/lib/libwttest.a(WTestEnvironment.C.o):/home/ppetraki/.conan/data/wt/4.3.1/_/_/build/2982a0e1e85adfb154853ddea2afc96acdfb5a3d/source_subfolder/src/Wt/Test/WTestEnvironment.C:21: first defined here
/usr/bin/ld: /home/ppetraki/.conan/data/wt/4.3.1/_/_/package/2982a0e1e85adfb154853ddea2afc96acdfb5a3d/lib/libwthttp.a(WServer.C.o): in function `Wt::WServer::WServer(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
/home/ppetraki/.conan/data/wt/4.3.1/_/_/build/2982a0e1e85adfb154853ddea2afc96acdfb5a3d/source_subfolder/src/http/WServer.C:79: multiple definition of `Wt::WServer::WServer(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'; /home/ppetraki/.conan/data/wt/4.3.1/_/_/package/2982a0e1e85adfb154853ddea2afc96acdfb5a3d/lib/libwttest.a(WTestEnvironment.C.o):/home/ppetraki/.conan/data/wt/4.3.1/_/_/build/2982a0e1e85adfb154853ddea2afc96acdfb5a3d/source_subfolder/src/Wt/Test/WTestEnvironment.C:21: first defined here
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
```

</details>



Discussion:
It's definitely the **with_test** build option. That should be off by default. Once I set " wt:with_test=False" I was able to rebuild and run my project successfully.
@ppetraki Thanks for reporting and posting a solution. Could you please open a PR with that fix, if possible? Regards!
@uilianries I'll take a look at creating a PR this weekend. It's needs a failing test case first that actually links to WServer to begin with so we can catch regressions.

There also needs to be a way to export the share/ directory to get access to the bootstrap css and imgs.

Resolving patch:
diff --git a/recipes/wt/all/conanfile.py b/recipes/wt/all/conanfile.py
--- a/recipes/wt/all/conanfile.py
+++ b/recipes/wt/all/conanfile.py
@@ -41,7 +41,7 @@ class WtConan(ConanFile):
         'with_postgres': True,
         'with_mysql': True,
         'with_mssql': False,
-        'with_test': True,
+        'with_test': False,
         'with_dbo': True,
         'with_opengl': False,
         'with_unwind': True,


Test patch:
diff --git a/recipes/wt/all/test_package/conanfile.py b/recipes/wt/all/test_package/conanfile.py
--- a/recipes/wt/all/test_package/conanfile.py
+++ b/recipes/wt/all/test_package/conanfile.py
@@ -15,5 +15,6 @@ def build(self):
     def test(self):
         if not tools.cross_building(self.settings):
             bin_path = os.path.join("bin", "test_package")
-            self.run(bin_path, run_environment=True)
+            args = " --docroot . --http-listen http://127.0.0.1:8080"
+            self.run(bin_path + args, run_environment=True)
 
diff --git a/recipes/wt/all/test_package/test_package.cpp b/recipes/wt/all/test_package/test_package.cpp
--- a/recipes/wt/all/test_package/test_package.cpp
+++ b/recipes/wt/all/test_package/test_package.cpp
@@ -1,6 +1,7 @@
 #include <cstdlib>
 #include <iostream>
 #include <Wt/WLength.h>
+#include <Wt/WServer.h>
 
 #ifdef WITH_DBO
 
@@ -9,12 +10,14 @@
 #endif
 
 
-int main()
+int main(int argc, char** argv)
 {
     Wt::WLength l("10px");
 #ifdef WITH_DBO
     Wt::Dbo::Session session;
 #endif
 
+    Wt::WServer server(argc, argv, WTHTTP_CONFIGURATION);
+
     return EXIT_SUCCESS;
 }