Skip to content
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

LOGCXX-494: windows cmake build for log4cxx against apr-2 #3

Closed
wants to merge 1 commit into from

Conversation

jeking3
Copy link

@jeking3 jeking3 commented Jan 10, 2018

https://issues.apache.org/jira/browse/LOGCXX-494

I've used log4cxx for quite some time and I was surprised to find there are no project or cmake files for windows builds in the trunk. In the past I have cobbled together various sources and made visual studio projects to wrap apr, apr-util, and log4cxx into a single build.

Today, I spent the day making a cmake build environment that leverages the latest apr-2 development trunk.

When you build apr-2 with cmake on Windows you get a static and a shared library in the prefix output directory. The static library is named apr-2.lib and the dynamic link library is libapr-2.{dll,lib}. I accounted for this in the cmake, expecting folks to set -DBUILD_SHARED_LIBS={ON|OFF}. There are a number of build warnings when building dynamic, and it looks like some dllexport declarations are missing. This PR does not correct those shortcomings.

I pulled some concepts from cmake files in the Apache Thrift project.

Here is an example configuration run and the output for configuring a Static, Release, VS2010 build. The out-of-tree build directory is c:\Temp\log4cxx-build\Static\Release. The source tree is c:\temp\logging-log4cxx. Files will be installed into C:\temp\log4cxx-install\Static\Release.

In the build directory you get a full Visual Studio project that you can use if you want.

c:\Temp\log4cxx-build\Static\Release>cmake -G"Visual Studio 10 2010 Win64" c:\temp\logging-log4cxx -DCMAKE_INSTALL_PREFIX=C:\temp\log4cxx-install\Static\Release -DAPR2_ROOT_DIR=C:\Build\org.apache\apr\install\Static\Release
-- Configuring build environment for log4cxx version 0.11.1
-- The C compiler identification is MSVC 16.0.40219.1
-- The CXX compiler identification is MSVC 16.0.40219.1
-- Check for working C compiler: c:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/x86_amd64/cl.exe
-- Check for working C compiler: c:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/x86_amd64/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: c:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/x86_amd64/cl.exe
-- Check for working CXX compiler: c:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/x86_amd64/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found APR2: C:/build/org.apache/apr/install/Static/Release/include
--
-- Configuration Summary for log4cxx:
--
--   APR2_FOUND           TRUE
--   APR2_INCLUDE_DIRS    C:/build/org.apache/apr/install/Static/Release/include
--   APR2_LIBRARIES       C:/build/org.apache/apr/install/Static/Release/lib/libapr-2.lib
--
--   PROJECT_DESCRIPTION  Apache Logging Framework for C++
--   PROJECT_NAME         log4cxx
--   PROJECT_LICENSE      Apache Software License 2.0
--   PROJECT_LICURL       http://www.apache.org/licenses/LICENSE-2.0
--   PROJECT_URL          http://logging.apache.org/log4cxx/
--   PROJECT_VERSION      0.11.1
--
--   Install Prefix       C:/Temp/log4cxx-install/Static/Release
--   Language Level       c++98 [compiler must support it]
--   Link Strategy        Shared with shared runtime
--
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Temp/log4cxx-build/Static/Release

It can then be built with:

c:\Temp\log4cxx-build\Static\Release>cmake --build . --target install --config Release

@ams-tschoening
Copy link
Contributor

ams-tschoening commented Jan 11, 2018

Just some notes: While it has been discussed in the past to move to CMAKE already, keep in mind that the current build based on Autotools and/or Maven and/or Ant deals with things like projetc files generation, website generation, development iteration incl. version numbers etc. as well. So it's not only about adding CMAKE support, but one needs to ultimately decide which parts of the current build tools are kept and all that.

@jeking3
Copy link
Author

jeking3 commented Jan 11, 2018

Not recommending a change in the overall build system.

Following the Apache apr project, autotools is used on unix, and either cmake or a provided project is used on windows. I think that will work here; we do something similar in Apache Thrift for windows support.

The complete lack of windows build support at all in the project trunk is what worries me the most.
The instructions on the web site tell people to go to a directory that does not exist and use a project file that is not there. See: https://logging.apache.org/log4cxx/latest_stable/building/vstudio.html

Version 0.10.0 eliminated all visual studio project files from the project, leaving folks to cobble their own solution together, so this is an attempt at remedying it.

@jeking3 jeking3 changed the title windows cmake build for log4cxx against apr-2 LOGCXX-494: windows cmake build for log4cxx against apr-2 Jan 11, 2018
@jeking3
Copy link
Author

jeking3 commented Apr 2, 2018

Any update on this? It's almost 3 months old now and no updates from the log4cxx team.

@ams-tschoening
Copy link
Contributor

Any update on this? It's almost 3 months old now and no updates from the log4cxx team.

Because I responded on the mailing list:

http://mail-archives.apache.org/mod_mbox/logging-dev/201801.mbox/<1913119533.20180111172120%40am-soft.de>

At least I don't have any plans to deal with such a major change in the build currently, I simply don't have the time to do so.

Not recommending a change in the overall build system.

It's either about the addition of CMAKE to what is already there or the replacement of something which is already there, both are major changes from my understanding. And we already have Autotools, Maven, Shell Scripts, ANT and none of those is properly integrated with each other to support everything which is needed, like development iteration, version number updates, release date updates, site generation etc.

The complete lack of windows build support at all in the project trunk is what worries me the most.

Build support in trunk was/is available using ANT and cpptasks and at least for some recent versions of Visual Studio this worked:

https://logging.apache.org/log4cxx/latest_stable/building/index.html

The instructions on the web site tell people to go to a directory that does not exist and use a project file that is not there.

Because those instructions addressed a release.

Version 0.10.0 eliminated all visual studio project files from the project[...]

I'm somewhat sure they have never been in trunk, but only in the release package and have been generated during the release process. If you look at the following packages, some generated projects are still available:

https://dist.apache.org/repos/dist/dev/logging/log4cxx/

@ams-tschoening
Copy link
Contributor

It currently looks like #14 gets merged, so am closing here for now.

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

Successfully merging this pull request may close these issues.

2 participants