Project

General

Profile

Actions

Bug #516

closed

build failed on linking phase

Added by Anonymous over 13 years ago. Updated over 13 years ago.

Status:
Closed
Priority:
Urgent
Assignee:
Target version:
-
Start date:
09/15/2010
Due date:
% Done:

100%

Estimated time:

Description

Hi Koen,

I have tryied to build the new version of wt(Wt 3.1.5) and the build is failed on linking phase like showed in file attached.

Can you help me?

Thank you.

lebatoto


Files

wt_3_1_5_og_build_fail (7.73 KB) wt_3_1_5_og_build_fail Anonymous, 09/15/2010 09:49 AM
Actions #1

Updated by Koen Deforche over 13 years ago

  • Status changed from New to InProgress
  • Assignee changed from Koen Deforche to Wim Dumon

Wim,

This is a mingw problem, you need to link against a networking library (winsock) ?

Regards,

koen

Actions #2

Updated by Wim Dumon over 13 years ago

Correct. Add ws2_32.lib to the linker command.

What MingW installation are you using?

Regards,

Wim.

Actions #3

Updated by le batoto over 13 years ago

Hi Wim,

I use gcc version 4.4.1 (TDM-2 mingw32) but I didn't have a problème like this with wt 3.1.4 during compilation. I use the same compilator.

Regards,

Lebatoto

Actions #4

Updated by Wim Dumon over 13 years ago

  • % Done changed from 0 to 20

I'll take a look at it

Actions #5

Updated by Wim Dumon over 13 years ago

  • % Done changed from 20 to 50

Hey,

Thanks for the TDM pointer. I identified two problems while building on MinGW, for which the patches are below (will be in public git soon, and in the next release).

However, I still have problems with boost.thread (v1.44.0). For some unclear reason, symbols like imp__ZN5boost6threadD1Ev are undefined. I'm linking to a static boost.thread library, so I don't think that imp prefix is correct. Are you doing something special to get this right?

@@ -287,11 +287,15 @@ PROPERTIES
   VERSION ${VERSION_SERIES}.${VERSION_MAJOR}.${VERSION_MINOR}
   SOVERSION ${WT_SOVERSION}
   DEBUG_POSTFIX "d"
 )

+IF(WIN32)
+  TARGET_LINK_LIBRARIES(wt ws2_32)
+ENDIF(WIN32)
+
 IF(MSVC)
   SET_TARGET_PROPERTIES(wt PROPERTIES COMPILE_FLAGS "/wd4251 /wd4275 /wd4355 /wd4800 /wd4996 /wd4101")
-  TARGET_LINK_LIBRARIES(wt winmm wsock32)
+  TARGET_LINK_LIBRARIES(wt winmm)
 ENDIF(MSVC)

 SUBDIRS(isapi fcgi http)

@@ -166,11 +166,11 @@ void WLogger::setStream(std::ostream& o)
 void WLogger::setFile(const std::string& path)
 {
   if (ownStream_)
     delete o_;

-#ifdef WIN32
+#ifdef _MSC_VER
   FILE *file = _fsopen(path.c_str(), "at", _SH_DENYNO);
   if (file) {
     o_ = new std::ofstream(file);
   } else {
     o_ = new std::ofstream(path.c_str(), std::ios_base::out | std::ios_base::ate);
Actions #6

Updated by Tomasz Kalicki over 13 years ago

There is a problem with boost.thread.

Reason:

Default on Windows bjam builds only static multithreaded libraries in debug and release modes, using shared runtime.

But Wt is trying to link boost.thread as shared library due to bug in boost/thread/detail/config.hpp

Fix for that file:

--- oldconfig.hpp   2010-07-09 20:13:09.000000000 +0200
+++ config.hpp  2010-09-16 11:11:48.000000000 +0200
@@ -37,7 +37,7 @@
 #elif defined(BOOST_THREAD_USE_LIB)   //Use lib
 #else //Use default
 #   if defined(BOOST_THREAD_PLATFORM_WIN32)
-#       if defined(BOOST_MSVC) || defined(BOOST_INTEL_WIN)
+#       if defined(BOOST_MSVC) || defined(BOOST_INTEL_WIN) || defined(__MINGW32__)
             //For compilers supporting auto-tss cleanup
             //with Boost.Threads lib, use Boost.Threads lib
 #           define BOOST_THREAD_USE_LIB

Or we can define BOOST_THREAD_USE_LIB without changing any boost stuff

Similar problem to:

https://svn.boost.org/trac/boost/ticket/4614

Actions #7

Updated by le batoto over 13 years ago

Hi Wim.

I use Boost library version 1.43.0 and I have builded all with the same TDM-GCC-4.4.1_2 compilator.

I have used the void WLogger::setFile(const std::string& path) in the wt version 3.1.3 instead.

I have made your poposition and i have added -lws2_32 and -lwsock32 within the file link.txt in the directory test/CMakeFiles/test.dir but I have another problem during buld when it's time to compile SocketNotifier.C in the directory wt-3.1.5\examples\feature\socketnotifier. The compilator don't find the définition of getaddrinfo(...) and freeaddrinfo(...) functions. The build phase is made about 99% when it's happen.

I have many problems too when -lws2_32, -lwsock32 and -lmswsock aren't placed on the last of the list of libraries within link.txt. I don't understand why!

I want to try with loaden mingw32-4.4.3-4 but I don't have a time. I'll make it in future.

I would to suggest you to try with tdm-gcc-4.5.1.exe compilator, the last version of tdm-gcc.

Another question Wim, what IDE do you use for the test?(Eclipse, Code::Block, QCreator, ....)

Regards.

Lebatoto

Actions #8

Updated by Wim Dumon over 13 years ago

Tomas,

Thank you, I suspected that some patch was required or that I did something stupid. I fixed Wt's CMakeLists to include the define too if static libs are used on windows. I also had problems with some _tls symbol which I had to work around.

Lebatoto,

setFile is indeed another issue that I encountered and resolved.

The order in which libraries are specified on the ld command line is indeed important. I guess you'll find more information in the documentation of the gnu binutils.

Never mind the SocketNotifier feature example. MinGW apparantly doesn't support how it does name lookups, but the intention is merely to demonstrate how one Wt class (WSocketNotifier) works. Look at the code if you're interested in this class. Use 'make -k' to avoid that make stops at the first error it encounters. I'll exclude the SocketNotifier example from the MinGW build.

I use Visual Studio on Windows. If I compile with MinGW, I use the command line and vim as editor.

I wrote my installation instructions on the Wiki: http://redmine.webtoolkit.eu/projects/wt/wiki/Installing_Wt_on_MinGW

I will also include this patch in the next release (ISAPI does not compile becaue httpext.h is too old):

@@ -164,11 +164,13 @@ SET(WTHTTP_CONFIGURATION ${CONFIGDIR}/wthttpd CACHE PATH "Path for the wthttpd c

 SET(WEBUSER apache CACHE STRING "Webserver username (e.g. apache or www)")
 SET(WEBGROUP apache CACHE STRING "Webserver groupname (e.g. apache or www or users)")
 IF(WIN32)
   SET(CONNECTOR_FCGI FALSE)
-  OPTION(CONNECTOR_ISAPI "Compile in ISAPI connector (libwtisapi) ?" ON)
+  IF(NOT MINGW)
+    OPTION(CONNECTOR_ISAPI "Compile in ISAPI connector (libwtisapi) ?" ON)
+  ENDIF(NOT MINGW)
 ELSE(WIN32)
   OPTION(CONNECTOR_FCGI "Compile in FCGI connector (libwtfcgi) ?" ON)
   SET(CONNECTOR_ISAPI OFF)
 ENDIF(WIN32)
 OPTION(CONNECTOR_HTTP "Compile in stand-alone httpd connector (libwthttp) ?" ON)
@@ -244,10 +246,14 @@ FIND_PACKAGE(Doxygen)
 INCLUDE_DIRECTORIES(${BOOST_INCLUDE_DIRS})
 LINK_DIRECTORIES(${BOOST_LIB_DIRS})
 IF(WIN32)
   IF(BOOST_DYNAMIC)
     ADD_DEFINITIONS(-DBOOST_ALL_DYN_LINK)
+  ELSE(BOOST_DYNAMIC)
+    # You could expect that this is the default when BOOST_ALL_DYN_LINK
+    # is not set, but this is problematic for cygwin
+    ADD_DEFINITIONS(-DBOOST_THREAD_USE_LIB)
   ENDIF(BOOST_DYNAMIC)
   ADD_DEFINITIONS(
       -D_CRT_SECURE_NO_WARNINGS
       -Dinline=__inline
       -D_SCL_SECURE_NO_WARNINGS
Actions #9

Updated by Wim Dumon over 13 years ago

  • Status changed from InProgress to Resolved
  • % Done changed from 50 to 100
Actions #10

Updated by Koen Deforche over 13 years ago

  • Status changed from Resolved to Closed

Fixed in 3.1.6

Actions

Also available in: Atom PDF