Thread: [Log4cplus-devel] Fixes for CMake build files.
Logging Framework for C++
Brought to you by:
wilx
From: Chernyshev V. <ast...@ro...> - 2012-09-12 23:24:07
|
Hello. After various unsuccessful attempts to compile log4cplus on OS X from provided autotools-generated configure file using Clang compiler I've decided to try CMake build. And it turned out that some configure defines are simply missing. Here are the fixes that I've made. All paths are relative to project's root directory. 1. ./CMakeLists.txt https://gist.github.com/3710553 - added WITH_ICONV option that sets LOG4CPLUS_WITH_ICONV, the same is done when --with-iconv option is provided to configure system. 2. ./ConfigureChecks.cmake https://gist.github.com/3710633 - added very simple check to find system-provided iconv library, it may be required to use iconv* functions on some systems; - added checks for functions mbstowcs, wcstombs, nanosleep; - added check for __func__ symbol; - iconv* functions will now be checked only when LOG4CPLUS_WITH_ICONV is defined, it mimics behaviour of autotools build system; - added proper checks for DECLSPEC_EXPORT/IMPORT/PRIVATE, taken from autotools files; - added thread-local support detection; - added C++11 atomics detection. 3. ./src/CMakeLists.txt https://gist.github.com/3710658 - link iconv library if it is required to use iconv* functions and iconv support was requested. 4. ./include/log4cplus/config/defines.hxx.cmake.in https://gist.github.com/3710667 - added missing defines to make it on par with defines.hxx.in. There are additional things to tweak in CMake files, but it can be discussed later. |
From: Václav Z. <vha...@gm...> - 2012-09-13 05:55:18
Attachments:
signature.asc
|
On 09/13/2012 01:23 AM, Chernyshev Vyacheslav wrote: > Hello. > > After various unsuccessful attempts to compile log4cplus on OS X from > provided autotools-generated configure file using Clang compiler I've I wonder what difficulties you have had with the Autotools build system on MacOS X. I am keen on fixing those as well. > decided to try CMake build. And it turned out that some configure > defines are simply missing. Here are the fixes that I've made. All paths > are relative to project's root directory. I have just recently added a TODO item just for that. :) > > 1. ./CMakeLists.txt https://gist.github.com/3710553 > - added WITH_ICONV option that sets LOG4CPLUS_WITH_ICONV, the same > is done when --with-iconv option is provided to configure system. > 2. ./ConfigureChecks.cmake https://gist.github.com/3710633 > - added very simple check to find system-provided iconv library, it > may be required to use iconv* functions on some systems; > - added checks for functions mbstowcs, wcstombs, nanosleep; > - added check for __func__ symbol; > - iconv* functions will now be checked only when LOG4CPLUS_WITH_ICONV > is defined, it mimics behaviour of autotools build system; > - added proper checks for DECLSPEC_EXPORT/IMPORT/PRIVATE, taken from > autotools files; > - added thread-local support detection; > - added C++11 atomics detection. > 3. ./src/CMakeLists.txt https://gist.github.com/3710658 > - link iconv library if it is required to use iconv* functions and > iconv support was requested. > 4. ./include/log4cplus/config/defines.hxx.cmake.in > https://gist.github.com/3710667 > - added missing defines to make it on par with defines.hxx.in. I have applied all of the patches to both trunk and 1.1.x branch. > > There are additional things to tweak in CMake files, but it can be > discussed later. Feel free to send more patches to improve MacOS X support. I have no way of testing log4cplus for it. -- VZ |
From: Chernyshev V. <ast...@ro...> - 2012-09-13 10:44:51
|
13.09.12, 9:55, Václav Zeman wrote: > I wonder what difficulties you have had with the Autotools build system > on MacOS X. I am keen on fixing those as well. There are some link problems when C++11 mode and Clang's libc++ is requested. Configure is done with something like that: ../configure --prefix=/opt/log4cplus_clang --with-iconv CC=/usr/bin/clang CXX=/usr/bin/clang++ CXXFLAGS="-std=gnu++11 -stdlib=libc++ -O3 -march=native -DNDEBUG" CFLAGS="-std=gnu99 -O3 -march=native -DNDEBUG" LDFLAGS="-stdlib=libc++" Link failures appear after this line in output: libtool: link: /usr/bin/clang++ -dynamiclib -o .libs/liblog4cplus-1.1.4.dylib <skipped object files list> -liconv -O3 -march=native -O2 -install_name /opt/log4cplus_cmake/lib/liblog4cplus-1.1.4.dylib -compatibility_version 5 -current_version 5.0 -Wl,-single_module I think that the problem is that CXXFLAGS and/or LDFLAGS are not properly passed to final link command. Without "-std=gnu++11 -stdlib=libc++" a default c++ runtime library is linked to log4cplus and it results in undefined references. As a side note, probably user-provided CXXFLAGS should be appended to the end of the list, otherwise default -O2 overrides user's decision. |
From: Václav Z. <vha...@gm...> - 2012-09-13 10:52:01
|
On 13 September 2012 12:44, Chernyshev Vyacheslav wrote: > 13.09.12, 9:55, Václav Zeman wrote: >> I wonder what difficulties you have had with the Autotools build system >> on MacOS X. I am keen on fixing those as well. > > There are some link problems when C++11 mode and Clang's libc++ is > requested. Configure is done with something like that: > ../configure > --prefix=/opt/log4cplus_clang > --with-iconv > CC=/usr/bin/clang > CXX=/usr/bin/clang++ > CXXFLAGS="-std=gnu++11 -stdlib=libc++ -O3 -march=native -DNDEBUG" > CFLAGS="-std=gnu99 -O3 -march=native -DNDEBUG" > LDFLAGS="-stdlib=libc++" > > Link failures appear after this line in output: > libtool: link: /usr/bin/clang++ > -dynamiclib -o .libs/liblog4cplus-1.1.4.dylib > <skipped object files list> > -liconv -O3 -march=native -O2 > -install_name /opt/log4cplus_cmake/lib/liblog4cplus-1.1.4.dylib > -compatibility_version 5 > -current_version 5.0 > -Wl,-single_module > > I think that the problem is that CXXFLAGS and/or LDFLAGS are not > properly passed to final link command. Without "-std=gnu++11 > -stdlib=libc++" a default c++ runtime library is linked to log4cplus and > it results in undefined references. This sounds like this might a be a Libtool or Automake problem. I am afraid that I can hardly help with this. But I am willing to apply any reasonable patches that fix this, if this is actually log4cplus problem. > As a side note, probably > user-provided CXXFLAGS should be appended to the end of the list, > otherwise default -O2 overrides user's decision. I guess I should omit adding -O2 in case any other -O option is present there. -- VZ |