Hi, Andrew. I just went through a Log4Cxx rebuild myself with setting up a new
build server last week, so I can appreciate the hurdle that can be.
I would recommend use the Ant build procedure, and checking out from the SVN
trunk. That procedure seemed to work out best for me. Also, completely abandon
doing anything with the VS projects themselves. That, IMHO, is just a time-suck
and I haven’t gotten it to reliably work for various VS versions or
architectures. One thing of note – I found the trunk wouldn’t compile/link
complete with the current version of APR and APR-Util. I had to use APR 1.5.1
and APR-Util 1.5.3 for Windows. There are some undefined references in the
Win32 build of one of those. I don’t remember which. Thorsten, have you or any
of the contributors seen something similar? If you see similar things, I have
copies of the win32 src archives for those versions. I can probably get those
to you somehow – I didn’t see them on the Apache site. Just email me directly.
Here are some snippets of my vendors build batch script. Hopefully you’ll get
some value out of it:
rem ## copy the apr and apr-util packages here
xcopy /Y ..\apr\apr-1.5.1-win32-src.zip .
7z x apr-1.5.1-win32-src.zip > nul
rename apr-1.5.1 apr
xcopy /Y ..\apr-util\apr-util-1.5.3-win32-src.zip .
7z x apr-util-1.5.3-win32-src.zip > nul
rename apr-util-1.5.3 apr-util
IF NOT DEFINED VisualStudioVersion call
"%VS110COMNTOOLS%\..\..\VC\vcvarsall.bat" AMD64
rem go to the trunk checkout – defined/checked out above
cd %_log4cxx%
ant -lib ..\ant-cp-addons -lib ..\misc-cp-addons -Dfind=false
-Ddebug=true build
ant -lib ..\ant-cp-addons -lib ..\misc-cp-addons -Dfind=false
-Ddebug=false build
xcopy src\main\include\* ..\distbuild\include /E /Y /K /Q /C
del ..\distbuild\include\Makefile*
copy target\debug\shared\log4cxx.dll
..\distbuild\lib\log4cxxd.dll
copy target\debug\shared\log4cxx.exp
..\distbuild\lib\log4cxxd.exp
copy target\debug\shared\log4cxx.lib
..\distbuild\lib\log4cxxd.lib
copy target\release\shared\log4cxx.dll ..\distbuild\lib
copy target\release\shared\log4cxx.exp ..\distbuild\lib
copy target\release\shared\log4cxx.lib ..\distbuild\lib
cd ..\..
The distbuild stuff breaks out into include and lib subdirectories, which allow
easy additions to project files for including the header files, and finding the
import libs.
The VisualStudioVersion line will likely have to be modified to your version of
Visual Studio. We use 2012 (11.0) for our builds, so that will likely be
different for you.
I do have “ant-cp-addons” and “misc-cp-addons” which put some of the needed
jars on the ant classpath. In ant-cp-addons, I have the ant-contrib-1.0b3.jar
and cpptasks.jar files. In misc-cp-addons, I have the Xerces-J jars and
log4j.1.2.17.jar – I’m not certain if these are 100% necessary but kept those
in there from building cpptasks.jar.
Hopefully that is helpful. I use the above stuff to build a X64 version on both
Win32 and Win64 systems. Please let me know if you have any questions.
Regards,
Dana Irvin (Dirv) | Sr Software Engineer | Ingenicomm, Inc. |
<mailto:[email protected]> [email protected]
From: Andrew Leach [mailto:[email protected]]
Sent: Monday, October 12, 2015 10:08 AM
To: Log4CXX User
Subject: Re: Help with first C++ program to do logging
Thanks for you email.
I've tried for several hours to build the package but find it to be an
impossible task.
Maven fails with these errors:
[INFO] ------------------------------------------------------------------------
[INFO] Building Apache log4cxx (Incubating) 0.11.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-antrun-plugin:1.7:run (compile) @ apache-log4cxx ---
[WARNING] Error injecting: org.apache.maven.plugin.antrun.AntRunMojo
java.lang.NoClassDefFoundError: org/apache/tools/ant/BuildException
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2585)
at java.lang.Class.getDeclaredConstructors(Class.java:1906)
at com.google.inject.spi.InjectionPoint.forConstructorOf(InjectionPoint.
java:245)
at com.google.inject.internal.ConstructorBindingImpl.create(ConstructorB
indingImpl.java:99)
at com.google.inject.internal.InjectorImpl.createUninitializedBinding(In
jectorImpl.java:657)
at com.google.inject.internal.InjectorImpl.createJustInTimeBinding(Injec
torImpl.java:875)
at com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecurs
ive(InjectorImpl.java:798)
at com.google.inject.internal.InjectorImpl.getJustInTimeBinding(Injector
Impl.java:281)
at com.google.inject.internal.InjectorImpl.getBindingOrThrow(InjectorImp
l.java:213)
at com.google.inject.internal.InjectorImpl.getProviderOrThrow(InjectorIm
pl.java:998)
at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java
:1031)
at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java
:994)
at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java
:1044)
at org.eclipse.sisu.space.AbstractDeferredClass.get(AbstractDeferredClas
s.java:48)
at com.google.inject.internal.ProviderInternalFactory.provision(Provider
InternalFactory.java:86)
at com.google.inject.internal.InternalFactoryToInitializableAdapter.prov
ision(InternalFactoryToInitializableAdapter.java:54)
at com.google.inject.internal.ProviderInternalFactory$1.call(ProviderInt
ernalFactory.java:70)
at com.google.inject.internal.ProvisionListenerStackCallback$Provision.p
rovision(ProvisionListenerStackCallback.java:115)
at org.eclipse.sisu.bean.BeanScheduler$Activator.onProvision(BeanSchedul
er.java:176)
at com.google.inject.internal.ProvisionListenerStackCallback$Provision.p
rovision(ProvisionListenerStackCallback.java:126)
at com.google.inject.internal.ProvisionListenerStackCallback.provision(P
rovisionListenerStackCallback.java:68)
at com.google.inject.internal.ProviderInternalFactory.circularGet(Provid
erInternalFactory.java:68)
at com.google.inject.internal.InternalFactoryToInitializableAdapter.get(
InternalFactoryToInitializableAdapter.java:46)
at com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.java:10
09)
at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.ja
va:1059)
at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1005)
at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:3
6)
at org.eclipse.sisu.inject.LazyBeanEntry.getValue(LazyBeanEntry.java:81)
at org.eclipse.sisu.plexus.LazyPlexusBean.getValue(LazyPlexusBean.java:5
1)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContai
ner.java:263)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContai
ner.java:255)
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfigu
redMojo(DefaultMavenPluginManager.java:546)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(Default
BuildPluginManager.java:121)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:208)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
ct(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
ct(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThre
adedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(Lifecycl
eStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Laun
cher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav
a:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La
uncher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:
356)
Caused by: java.lang.ClassNotFoundException: org.apache.tools.ant.BuildException
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(
SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadCl
ass(ClassRealm.java:271)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm
.java:247)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm
.java:239)
... 55 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.079 s
[INFO] Finished at: 2015-10-12T17:57:40+02:00
[INFO] Final Memory: 8M/115M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:
run (compile) on project apache-log4cxx: Execution compile of goal org.apache.ma
ven.plugins:maven-antrun-plugin:1.7:run failed: A required class was missing whi
le executing org.apache.maven.plugins:maven-antrun-plugin:1.7:run: org/apache/to
ols/ant/BuildException
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.apache.maven.plugins:maven-antrun-plugin:1.7
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/C:/Users/ypx7647/.m2/repository/org/apache/maven/plugins
/maven-antrun-plugin/1.7/maven-antrun-plugin-1.7.jar
[ERROR] urls[1] = file:/C:/Users/ypx7647/.m2/repository/org/apache/ant/ant/1.9.3
/ant-1.9.3.jar
[ERROR] urls[2] = file:/C:/Users/ypx7647/.m2/repository/org/apache/ant/ant-launc
her/1.9.3/ant-launcher-1.9.3.jar
[ERROR] urls[3] = file:/C:/Users/ypx7647/.m2/repository/ant-contrib/ant-contrib/
1.0b2/ant-contrib-1.0b2.jar
[ERROR] urls[4] = file:/C:/Users/ypx7647/.m2/repository/ant/ant/1.5/ant-1.5.jar
[ERROR] urls[5] = file:/C:/Users/ypx7647/.m2/repository/ant-contrib/cpptasks/1.0
b5/cpptasks-1.0b5.jar
[ERROR] urls[6] = file:/C:/Users/ypx7647/.m2/repository/xerces/xercesImpl/2.8.1/
xercesImpl-2.8.1.jar
[ERROR] urls[7] = file:/C:/Users/ypx7647/.m2/repository/xml-apis/xml-apis/1.3.03
/xml-apis-1.3.03.jar
[ERROR] urls[8] = file:/C:/Users/ypx7647/.m2/repository/org/codehaus/plexus/plex
us-interpolation/1.1/plexus-interpolation-1.1.jar
[ERROR] urls[9] = file:/C:/Users/ypx7647/.m2/repository/junit/junit/3.8.1/junit-
3.8.1.jar
[ERROR] urls[10] = file:/C:/Users/ypx7647/.m2/repository/org/codehaus/plexus/ple
xus-utils/2.0.5/plexus-utils-2.0.5.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]]
[ERROR]
[ERROR] -----------------------------------------------------: org.apache.tools.
ant.BuildException
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContaine
rException
And Ant fails with these errors:
C:\Users\ypx7647\Downloads\apache-log4cxx>ant -Dfind=false
Buildfile: C:\Users\ypx7647\Downloads\apache-log4cxx\build.xml
[taskdef] Could not load definitions from resource net/sf/antcontrib/antcontri
b.properties. It could not be found.
BUILD FAILED
C:\Users\ypx7647\Downloads\apache-log4cxx\build.xml:184: Problem: failed to crea
te task or type propertyregex
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.
Total time: 0 seconds
And the projects directory doesn't exist in the SVN checkout!
I'm completely stuck.
Could someone help out please?
Thanks,
Andrew
-------
Internet communications are not secure and therefore Andrew Leach does not
accept legal responsibility for the contents of this message. The information
contained in this email is private, personal and confidential and may be
legally privileged. It is intended solely for the addressee. If you are not
the intended recipient, any disclosure, copying, distribution or any action
taken or omitted to be taken in reliance on it, is prohibited and may be
unlawful. This email and any attachments have been automatically scanned for
viruses prior to dispatch, but we make no warranty that they are free from
computer viruses. You are advised to check all emails and attachments using
your own anti virus software before opening or executing them.
On 12 October 2015 at 15:35, Thorsten Schöning <[email protected]> wrote:
Guten Tag Andrew Leach,
am Montag, 12. Oktober 2015 um 15:05 schrieben Sie:
> I believe I've correctly configured the include directory for
> log4cxx into VS2013 as the include's aren't showing up any errors.
You need to setup log4cxx properly as well.
> c:\apache-log4cxx-0.10.0\apache-log4cxx-0.10.0\[...]
You shouldn't start with log4cxx 0.10.0 anymore, checkout a current
trunk using SVN or download it using your browser. While not
officially released yet, the current trunk contains a lot of bug
fixes.
https://logging.apache.org/log4cxx/source-repository.html
> Error 1 error C1083: Cannot open include file:
> 'log4cxx/log4cxx.h': No such file or directory
This is most likely the root cause, log4cxx can't work properly
without that header. You haven't setup your building environment for
log4cxx properly and should first read the docs on how to build the
lib. If your already done so, you either made something wrong or the
instructions are not clear enough or whatever, so feel free to tell us
and we might fix things.
https://logging.apache.org/log4cxx/building/index.html
https://logging.apache.org/log4cxx/usage.html
Mit freundlichen Grüßen,
Thorsten Schöning
--
Thorsten Schöning E-Mail: [email protected]
AM-SoFT IT-Systeme http://www.AM-SoFT.de/
Telefon...........05151- 9468- 55
Fax...............05151- 9468- 88
Mobil..............0178-8 9468- 04
AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow
_____
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2015.0.6172 / Virus Database: 4435/10782 - Release Date: 10/08/15