You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by "Myers, Gary - 43" <ga...@rainhail.com> on 2007/07/09 19:59:08 UTC
Using apr from Mingw
I'm attempting to use APR in a mingw C project that I am working on to
add a layer of abstraction so I can later port in to Linux.
I've compiled the libapr.dll using Visual Studio C++ 2005 Express
edition. (Which may be my problem, I simply may not be able to make it
work using mingw gcc)
When I go to compile the simple little application using
gcc -Wall -std=c99 -g -Ilib -Iinclude -c ./src/RuntimeMain.c
I get many errors. It looks as though I've not included something
correctly in my source. I've placed the source for the offending files
and the errors at the bottom of this message.
Any help would be appreciated.
//RuntimeMain.c
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdlib.h>
//apr includes
#include "apr_errno.h"
#include "apr_general.h"
static void closeapr(void);
int main(int argc, char **argv)
{
openConfiguration("JavaJNI.conf");
if(apr_initialize() == APR_SUCCESS)
{
atexit(closeapr);
}
else
fprintf(stderr, "Unable to initialize APR");
closeConfiguration();
return 0;
}
static void closeapr(void)
{
apr_terminate();
}
Errors:
In file included from ./src/RuntimeMain.c:1:
lib/apr_errno.h:52: error: syntax error before "apr_strerror"
lib/apr_errno.h:53: error: syntax error before "apr_size_t"
lib/apr_errno.h:53: warning: type defaults to `int' in declaration of
`apr_strerror'
lib/apr_errno.h:53: warning: data definition has no type or storage
class
In file included from lib/apr_general.h:29,
from ./src/RuntimeMain.c:2:
lib/apr_pools.h:157: error: syntax error before "apr_pool_initialize"
lib/apr_pools.h:157: warning: type defaults to `int' in declaration of
`apr_pool_initialize'
lib/apr_pools.h:157: warning: data definition has no type or storage
class
lib/apr_pools.h:165: error: syntax error before "apr_pool_terminate"
lib/apr_pools.h:165: warning: type defaults to `int' in declaration of
`apr_pool_terminate'
lib/apr_pools.h:165: warning: data definition has no type or storage
class
In file included from lib/apr_pools.h:172,
from lib/apr_general.h:29,
from ./src/RuntimeMain.c:2:
lib/apr_allocator.h:49: error: syntax error before "apr_uint32_t"
lib/apr_allocator.h:49: warning: no semicolon at end of struct or union
lib/apr_allocator.h:50: warning: type defaults to `int' in declaration
of `free_index'
lib/apr_allocator.h:50: warning: data definition has no type or storage
class
lib/apr_allocator.h:53: error: syntax error before '}' token
lib/apr_allocator.h:66: error: syntax error before
"apr_allocator_create"
lib/apr_allocator.h:66: warning: type defaults to `int' in declaration
of `apr_allocator_creat
lib/apr_allocator.h:66: warning: data definition has no type or storage
class
lib/apr_allocator.h:74: error: syntax error before
"apr_allocator_destroy"
lib/apr_allocator.h:74: warning: type defaults to `int' in declaration
of `apr_allocator_destr
lib/apr_allocator.h:74: warning: data definition has no type or storage
class
lib/apr_allocator.h:82: error: syntax error before "apr_allocator_alloc"
lib/apr_allocator.h:83: error: syntax error before "apr_size_t"
lib/apr_allocator.h:83: warning: type defaults to `int' in declaration
of `apr_allocator_alloc
lib/apr_allocator.h:83: warning: data definition has no type or storage
class
lib/apr_allocator.h:90: error: syntax error before "apr_allocator_free"
lib/apr_allocator.h:91: warning: type defaults to `int' in declaration
of `apr_allocator_free'
lib/apr_allocator.h:91: warning: data definition has no type or storage
class
In file included from lib/apr_pools.h:172,
from lib/apr_general.h:29,
from ./src/RuntimeMain.c:2:
lib/apr_allocator.h:106: error: syntax error before
"apr_allocator_owner_set"
lib/apr_allocator.h:107: warning: type defaults to `int' in declaration
of `apr_allocator_owne
lib/apr_allocator.h:107: warning: data definition has no type or storage
class
lib/apr_allocator.h:110: error: syntax error before
"apr_allocator_set_owner"
lib/apr_allocator.h:111: warning: type defaults to `int' in declaration
of `apr_allocator_set_
lib/apr_allocator.h:111: warning: data definition has no type or storage
class
lib/apr_allocator.h:117: error: syntax error before
"apr_allocator_owner_get"
lib/apr_allocator.h:117: warning: type defaults to `int' in declaration
of `apr_allocator_owne
lib/apr_allocator.h:117: warning: data definition has no type or storage
class
lib/apr_allocator.h:120: error: syntax error before
"apr_allocator_get_owner"
lib/apr_allocator.h:121: warning: type defaults to `int' in declaration
of `apr_allocator_get_
lib/apr_allocator.h:121: warning: data definition has no type or storage
class
lib/apr_allocator.h:129: error: syntax error before
"apr_allocator_max_free_set"
lib/apr_allocator.h:130: error: syntax error before "apr_size_t"
lib/apr_allocator.h:130: warning: type defaults to `int' in declaration
of `apr_allocator_max_
lib/apr_allocator.h:130: warning: data definition has no type or storage
class
lib/apr_allocator.h:133: error: syntax error before
"apr_allocator_set_max_free"
lib/apr_allocator.h:134: error: syntax error before "apr_size_t"
lib/apr_allocator.h:134: warning: type defaults to `int' in declaration
of `apr_allocator_set_
lib/apr_allocator.h:134: warning: data definition has no type or storage
class
In file included from lib/apr_general.h:29,
from ./src/RuntimeMain.c:2:
lib/apr_pools.h:185: error: syntax error before "apr_pool_create_ex"
lib/apr_pools.h:188: warning: type defaults to `int' in declaration of
`apr_pool_create_ex'
lib/apr_pools.h:188: warning: data definition has no type or storage
class
lib/apr_pools.h:206: error: syntax error before
"apr_pool_create_ex_debug"
lib/apr_pools.h:210: warning: type defaults to `int' in declaration of
`apr_pool_create_ex_deb
lib/apr_pools.h:210: warning: data definition has no type or storage
class
lib/apr_pools.h:255: error: syntax error before "apr_pool_allocator_get"
lib/apr_pools.h:255: warning: type defaults to `int' in declaration of
`apr_pool_allocator_get
lib/apr_pools.h:255: warning: data definition has no type or storage
class
lib/apr_pools.h:265: error: syntax error before "apr_pool_clear"
lib/apr_pools.h:265: warning: type defaults to `int' in declaration of
`apr_pool_clear'
lib/apr_pools.h:265: warning: data definition has no type or storage
class
lib/apr_pools.h:280: error: syntax error before "apr_pool_clear_debug"
lib/apr_pools.h:281: warning: type defaults to `int' in declaration of
`apr_pool_clear_debug'
lib/apr_pools.h:281: warning: data definition has no type or storage
class
lib/apr_pools.h:294: error: syntax error before "apr_pool_destroy"
lib/apr_pools.h:294: warning: type defaults to `int' in declaration of
`apr_pool_destroy'
lib/apr_pools.h:294: warning: data definition has no type or storage
class
lib/apr_pools.h:309: error: syntax error before "apr_pool_destroy_debug"
lib/apr_pools.h:310: warning: type defaults to `int' in declaration of
`apr_pool_destroy_debug
lib/apr_pools.h:310: warning: data definition has no type or storage
class
lib/apr_pools.h:328: error: syntax error before "apr_palloc"
lib/apr_pools.h:328: error: syntax error before "apr_size_t"
lib/apr_pools.h:328: warning: type defaults to `int' in declaration of
`apr_palloc'
lib/apr_pools.h:328: warning: data definition has no type or storage
class
lib/apr_pools.h:338: error: syntax error before "apr_palloc_debug"
lib/apr_pools.h:338: error: syntax error before "apr_size_t"
lib/apr_pools.h:339: warning: type defaults to `int' in declaration of
`apr_palloc_debug'
lib/apr_pools.h:339: warning: data definition has no type or storage
class
lib/apr_pools.h:366: error: syntax error before "apr_pcalloc_debug"
lib/apr_pools.h:366: error: syntax error before "apr_size_t"
lib/apr_pools.h:367: warning: type defaults to `int' in declaration of
`apr_pcalloc_debug'
lib/apr_pools.h:367: warning: data definition has no type or storage
class
lib/apr_pools.h:387: error: syntax error before "apr_pool_abort_set"
lib/apr_pools.h:388: warning: type defaults to `int' in declaration of
`apr_pool_abort_set'
lib/apr_pools.h:388: warning: data definition has no type or storage
class
lib/apr_pools.h:391: error: syntax error before "apr_pool_set_abort"
lib/apr_pools.h:392: warning: type defaults to `int' in declaration of
`apr_pool_set_abort'
lib/apr_pools.h:392: warning: data definition has no type or storage
class
lib/apr_pools.h:399: error: syntax error before "apr_pool_abort_get"
lib/apr_pools.h:399: warning: type defaults to `int' in declaration of
`apr_pool_abort_get'
lib/apr_pools.h:399: warning: data definition has no type or storage
class
lib/apr_pools.h:402: error: syntax error before "apr_pool_get_abort"
lib/apr_pools.h:402: warning: type defaults to `int' in declaration of
`apr_pool_get_abort'
lib/apr_pools.h:402: warning: data definition has no type or storage
class
lib/apr_pools.h:409: error: syntax error before "apr_pool_parent_get"
lib/apr_pools.h:409: warning: type defaults to `int' in declaration of
`apr_pool_parent_get'
lib/apr_pools.h:409: warning: data definition has no type or storage
class
lib/apr_pools.h:412: error: syntax error before "apr_pool_get_parent"
lib/apr_pools.h:412: warning: type defaults to `int' in declaration of
`apr_pool_get_parent'
lib/apr_pools.h:412: warning: data definition has no type or storage
class
lib/apr_pools.h:421: error: syntax error before "apr_pool_is_ancestor"
lib/apr_pools.h:421: warning: type defaults to `int' in declaration of
`apr_pool_is_ancestor'
lib/apr_pools.h:421: warning: data definition has no type or storage
class
lib/apr_pools.h:428: error: syntax error before "apr_pool_tag"
lib/apr_pools.h:428: warning: type defaults to `int' in declaration of
`apr_pool_tag'
lib/apr_pools.h:428: warning: data definition has no type or storage
class
lib/apr_pools.h:453: error: syntax error before "apr_pool_userdata_set"
lib/apr_pools.h:457: warning: type defaults to `int' in declaration of
`apr_pool_userdata_set'
lib/apr_pools.h:457: warning: data definition has no type or storage
class
lib/apr_pools.h:478: error: syntax error before "apr_pool_userdata_setn"
lib/apr_pools.h:482: warning: type defaults to `int' in declaration of
`apr_pool_userdata_setn
lib/apr_pools.h:482: warning: data definition has no type or storage
class
lib/apr_pools.h:490: error: syntax error before "apr_pool_userdata_get"
lib/apr_pools.h:491: warning: type defaults to `int' in declaration of
`apr_pool_userdata_get'
lib/apr_pools.h:491: warning: data definition has no type or storage
class
lib/apr_pools.h:510: error: syntax error before
"apr_pool_cleanup_register"
lib/apr_pools.h:514: warning: type defaults to `int' in declaration of
`apr_pool_cleanup_regis
lib/apr_pools.h:514: warning: data definition has no type or storage
class
lib/apr_pools.h:524: error: syntax error before "apr_pool_cleanup_kill"
lib/apr_pools.h:525: warning: type defaults to `int' in declaration of
`apr_pool_cleanup_kill'
lib/apr_pools.h:525: warning: data definition has no type or storage
class
lib/apr_pools.h:534: error: syntax error before
"apr_pool_child_cleanup_set"
lib/apr_pools.h:538: warning: type defaults to `int' in declaration of
`apr_pool_child_cleanup
lib/apr_pools.h:538: warning: data definition has no type or storage
class
lib/apr_pools.h:547: error: syntax error before "apr_pool_cleanup_run"
lib/apr_pools.h:550: warning: type defaults to `int' in declaration of
`apr_pool_cleanup_run'
lib/apr_pools.h:550: warning: data definition has no type or storage
class
lib/apr_pools.h:556: error: syntax error before "apr_pool_cleanup_null"
lib/apr_pools.h:556: warning: type defaults to `int' in declaration of
`apr_pool_cleanup_null'
lib/apr_pools.h:556: warning: data definition has no type or storage
class
lib/apr_pools.h:565: error: syntax error before
"apr_pool_cleanup_for_exec"
lib/apr_pools.h:565: warning: type defaults to `int' in declaration of
`apr_pool_cleanup_for_e
lib/apr_pools.h:565: warning: data definition has no type or storage
class
In file included from ./src/RuntimeMain.c:2:
lib/apr_general.h:132: error: syntax error before "size_t"
lib/apr_general.h:163: error: syntax error before "size_t"
lib/apr_general.h:179: error: syntax error before "apr_initialize"
lib/apr_general.h:179: warning: type defaults to `int' in declaration of
`apr_initialize'
lib/apr_general.h:179: warning: data definition has no type or storage
class
lib/apr_general.h:193: error: syntax error before "apr_app_initialize"
lib/apr_general.h:195: warning: type defaults to `int' in declaration of
`apr_app_initialize'
lib/apr_general.h:195: warning: data definition has no type or storage
class
lib/apr_general.h:206: error: syntax error before "apr_terminate"
lib/apr_general.h:206: warning: type defaults to `int' in declaration of
`apr_terminate'
lib/apr_general.h:206: warning: data definition has no type or storage
class
lib/apr_general.h:217: error: syntax error before "apr_terminate2"
lib/apr_general.h:217: warning: type defaults to `int' in declaration of
`apr_terminate2'
lib/apr_general.h:217: warning: data definition has no type or storage
class
make: *** [RuntimeMain.o] Error 1
RE: Using apr from Mingw
Posted by "Myers, Gary - 43" <ga...@rainhail.com>.
I'm an idiot I forgot the key line of #include <windows.h>
So chalk this up to a Java Programmer trying to live in a C programmers
world
Thanks
Gary Myers
Re: Using apr from Mingw
Posted by Bob Rossi <bo...@cox.net>.
On Mon, Jul 09, 2007 at 03:32:55PM -0500, Myers, Gary - 43 wrote:
> Well that figures that I'm using some oddball configuration. I'll go
> configure MSYS, and give that a try.
>
> Thanks for the answer I appreciate it.
Hi Gary,
Just to be clear, I'm just a user of apr. There may be others that use
it in the configuration you have. If so, I hope they pipe up and let us
know.
Bob Rossi
RE: Using apr from Mingw
Posted by "Myers, Gary - 43" <ga...@rainhail.com>.
Well that figures that I'm using some oddball configuration. I'll go
configure MSYS, and give that a try.
Thanks for the answer I appreciate it.
Gary Myers
-----Original Message-----
From: Bob Rossi [mailto:bob_rossi@cox.net]
Sent: Monday, July 09, 2007 3:14 PM
To: Myers, Gary - 43
Cc: dev@apr.apache.org
Subject: Re: Using apr from Mingw
On Mon, Jul 09, 2007 at 03:01:17PM -0500, Myers, Gary - 43 wrote:
> I already have the dll's built. I just used MSVC to built it since it
> was easier, which I admit was lazy of me. What I am getting is a
> compile time error when I try to compile the C Source file that
includes
> two of the apr header files. My guess is that Mingw treats something
> different that I'm not taking into account. I should add that I'm not
> using the MSYS prompt to do this I'm doing my coding in Eclipse 3.3
with
> the C\C++ plugin, and I'm manually writing the Makefile, because using
> the managed one was a small nightmare, and I was unable to get this
far.
> The result of typing make at the DOS prompt was that long list of
errors
> from my first message. I can get all the other pieces of my project
to
> compile fine, but when I introduce apr into the compilation process it
> won't compile due to an errors that gcc is finding in several header
> files. So I pulled all the other code that I had written, and put in
> the simple C file that I sent in my first post, and the problem
> persists. I don't know where else to turn for an answer
I have never tried this configuration. Sorry. I've only built apr in a
msys window, and compiled my applicatoin there as well. Maybe someone
else has experience in this area...
Bob Rossi
Re: Using apr from Mingw
Posted by Bob Rossi <bo...@cox.net>.
On Mon, Jul 09, 2007 at 03:01:17PM -0500, Myers, Gary - 43 wrote:
> I already have the dll's built. I just used MSVC to built it since it
> was easier, which I admit was lazy of me. What I am getting is a
> compile time error when I try to compile the C Source file that includes
> two of the apr header files. My guess is that Mingw treats something
> different that I'm not taking into account. I should add that I'm not
> using the MSYS prompt to do this I'm doing my coding in Eclipse 3.3 with
> the C\C++ plugin, and I'm manually writing the Makefile, because using
> the managed one was a small nightmare, and I was unable to get this far.
> The result of typing make at the DOS prompt was that long list of errors
> from my first message. I can get all the other pieces of my project to
> compile fine, but when I introduce apr into the compilation process it
> won't compile due to an errors that gcc is finding in several header
> files. So I pulled all the other code that I had written, and put in
> the simple C file that I sent in my first post, and the problem
> persists. I don't know where else to turn for an answer
I have never tried this configuration. Sorry. I've only built apr in a
msys window, and compiled my applicatoin there as well. Maybe someone
else has experience in this area...
Bob Rossi
RE: Using apr from Mingw
Posted by "Myers, Gary - 43" <ga...@rainhail.com>.
I already have the dll's built. I just used MSVC to built it since it
was easier, which I admit was lazy of me. What I am getting is a
compile time error when I try to compile the C Source file that includes
two of the apr header files. My guess is that Mingw treats something
different that I'm not taking into account. I should add that I'm not
using the MSYS prompt to do this I'm doing my coding in Eclipse 3.3 with
the C\C++ plugin, and I'm manually writing the Makefile, because using
the managed one was a small nightmare, and I was unable to get this far.
The result of typing make at the DOS prompt was that long list of errors
from my first message. I can get all the other pieces of my project to
compile fine, but when I introduce apr into the compilation process it
won't compile due to an errors that gcc is finding in several header
files. So I pulled all the other code that I had written, and put in
the simple C file that I sent in my first post, and the problem
persists. I don't know where else to turn for an answer
Thank You
Gary Myers
-----Original Message-----
From: Bob Rossi [mailto:bob_rossi@cox.net]
Sent: Monday, July 09, 2007 1:56 PM
To: Myers, Gary - 43; dev@apr.apache.org
Subject: Re: Using apr from Mingw
On Mon, Jul 09, 2007 at 02:53:17PM -0400, Bob Rossi wrote:
> On Mon, Jul 09, 2007 at 12:59:08PM -0500, Myers, Gary - 43 wrote:
> > I'm attempting to use APR in a mingw C project that I am working on
to
> > add a layer of abstraction so I can later port in to Linux.
> > I've compiled the libapr.dll using Visual Studio C++ 2005 Express
> > edition. (Which may be my problem, I simply may not be able to make
it
> > work using mingw gcc)
>
> Why can't you get it to work with mingw? Take a look at
> http://wiki.apache.org/logging-log4cxx/MSWindowsBuildInstructions
I'm sorry, I mistakenly cc'd g@cox.net somehow. Please remove that from
any replies.
Bob Rossi
Re: Using apr from Mingw
Posted by Bob Rossi <bo...@cox.net>.
On Mon, Jul 09, 2007 at 02:53:17PM -0400, Bob Rossi wrote:
> On Mon, Jul 09, 2007 at 12:59:08PM -0500, Myers, Gary - 43 wrote:
> > I'm attempting to use APR in a mingw C project that I am working on to
> > add a layer of abstraction so I can later port in to Linux.
> > I've compiled the libapr.dll using Visual Studio C++ 2005 Express
> > edition. (Which may be my problem, I simply may not be able to make it
> > work using mingw gcc)
>
> Why can't you get it to work with mingw? Take a look at
> http://wiki.apache.org/logging-log4cxx/MSWindowsBuildInstructions
I'm sorry, I mistakenly cc'd g@cox.net somehow. Please remove that from
any replies.
Bob Rossi
Re: Using apr from Mingw
Posted by Bob Rossi <bo...@cox.net>.
On Mon, Jul 09, 2007 at 12:59:08PM -0500, Myers, Gary - 43 wrote:
> I'm attempting to use APR in a mingw C project that I am working on to
> add a layer of abstraction so I can later port in to Linux.
> I've compiled the libapr.dll using Visual Studio C++ 2005 Express
> edition. (Which may be my problem, I simply may not be able to make it
> work using mingw gcc)
Why can't you get it to work with mingw? Take a look at
http://wiki.apache.org/logging-log4cxx/MSWindowsBuildInstructions
Bob Rossi