Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to "verify" your details, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.
 Entire forum ➜ PennMUSH ➜ Compiling the server ➜ Compiling with PCRE on Windows

Compiling with PCRE on Windows

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Daniel P   USA  (97 posts)  Bio
Date Thu 17 Nov 2011 04:14 PM (UTC)

Amended on Thu 17 Nov 2011 04:21 PM (UTC) by Daniel P

Message
So I figured since MUSHClient is always being updated with the latest PCRE libraries and it runs primarily on Windows, ya'll might be able to help me out here.

Currently PennMUSH is undergoing a nice big revamp in terms of forcing users to compile with separately-downloaded libraries which for whatever reason become outdated over time (PCRE and OpenSSL namely). I've gotten Penn to compile with OpenSSL on Windows but I'm still having a bit of trouble with the PCRE one.

What is the technique you use for MUSHClient (and other Windows-based applications), since PCRE isn't native to Windows (it WOULD be easier to just apt-get install libpcre3 libpcre3-dev, but alas...)? I don't know if these big 1000+ compile errors are because the Visual Studio project can't find the library or I'm defining it wrong, or whatever, but it's really rather annoying.

Thanks.
-Daniel

P.S. I have tried appending C:\PCRE\include, C:\PCRE\lib and pcre.lib to the Includes, Libraries and Linker/Input/Additional Dependencies respectively. Still getting all the errors. Of course, the version they were using before was extremely outdated.
Top

Posted by Nick Gammon   Australia  (23,057 posts)  Bio   Forum Administrator
Date Reply #1 on Thu 17 Nov 2011 06:33 PM (UTC)
Message
Thousands of errors, huh? Helps to show at least a few of them.

These are my notes to myself for how to update PCRE when a new release comes out:

https://github.com/nickgammon/mushclient/tree/master/pcre

I think config.h is taken from config.h.in, maybe with a change or two.

My version is on GitHub in that directory too.

So basically add those files to your project (to avoid clutter put them in a "project folder"). Then it should compile OK. Hopefully.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Daniel P   USA  (97 posts)  Bio
Date Reply #2 on Thu 17 Nov 2011 07:16 PM (UTC)
Message
Mostly it's giving stuff like:

1>C:\PennMUSH\Source_Copy\hdrs\externs.h(760): error C2143: syntax error : missing ')' before '*'
1>C:\PennMUSH\Source_Copy\hdrs\externs.h(760): error C2143: syntax error : missing '{' before '*'
1>C:\PennMUSH\Source_Copy\hdrs\externs.h(760): error C2059: syntax error : 'type'
1>C:\PennMUSH\Source_Copy\hdrs\externs.h(760): error C2059: syntax error : ')'
1>C:\PennMUSH\Source_Copy\hdrs\access.h(20): error C2061: syntax error : identifier 'pcre'
1>C:\PennMUSH\Source_Copy\hdrs\access.h(22): error C2059: syntax error : '}'

for every src file that includes them.

However there are a few cases where some src files return a lot more errors:


1>..\..\src\access.c(150): error C2037: left of 'who' specifies undefined struct/union 'access'
1>..\..\src\access.c(151): error C2037: left of 'can' specifies undefined struct/union 'access'
1>..\..\src\access.c(152): error C2037: left of 'cant' specifies undefined struct/union 'access'
1>..\..\src\access.c(153): error C2037: left of 'host' specifies undefined struct/union 'access'
1>..\..\src\access.c(155): error C2037: left of 'comment' specifies undefined struct/union 'access'
1>..\..\src\access.c(157): error C2037: left of 'comment' specifies undefined struct/union 'access'
1>..\..\src\access.c(158): error C2037: left of 'next' specifies undefined struct/union 'access'
1>..\..\src\access.c(162): error C2037: left of 're' specifies undefined struct/union 'access'
1>..\..\src\access.c(163): error C2037: left of 're' specifies undefined struct/union 'access'
1>..\..\src\access.c(168): error C2037: left of 're' specifies undefined struct/union 'access'
1>..\..\src\access.c(188): error C2037: left of 'next' specifies undefined struct/union 'access'
1>..\..\src\access.c(189): error C2037: left of 'next' specifies undefined struct/union 'access'
1>..\..\src\access.c(190): error C2037: left of 'next' specifies undefined struct/union 'access'
1>..\..\src\access.c(289): error C2037: left of 'next' specifies undefined struct/union 'access'
1>..\..\src\access.c(290): error C2037: left of 'host' specifies undefined struct/union 'access'
1>..\..\src\access.c(290): error C2168: 'strcmp' : too few actual parameters for intrinsic function
1>..\..\src\access.c(294): error C2037: left of 'host' specifies undefined struct/union 'access'

just to name a few.

But I know that this new library and include thing is the only problem in that I can undo the revision, pull in the old source code and header and it will compile fine (they took out pcre.c and rerouted the include "pcre.h" to include <pcre.h> so the library could be easily updated and the server recompiled in Linux). Details here: http://code.google.com/p/pennmush/source/detail?r=1258.

But I'll look into pulling your repo directly into the src directory and working them in that way.
Top

Posted by Daniel P   USA  (97 posts)  Bio
Date Reply #3 on Thu 17 Nov 2011 08:09 PM (UTC)

Amended on Thu 17 Nov 2011 08:26 PM (UTC) by Daniel P

Message
Alright. I found where the problem was.

Penn's mypcre.h header reads as follows:


/** 
 * \file mypcre.h
 * \brief Wrapper for pcre.h
 */
#ifndef _MYPCRE_H
#define _MYPCRE_H

#define PENN_MATCH_LIMIT 100000
struct pcre_extra;
void set_match_limit(struct pcre_extra *);
struct pcre_extra *default_match_limit(void);

#ifdef HAVE_PCRE

#ifdef HAVE_PCRE_H
#include <pcre.h>
#else
#error "You appear to have a system PCRE library but not the pcre.h header."
#endif

#endif                          /* !HAVE_PCRE */
#endif                          /* End of pcre.h */


But there was nowhere in the Windows-specific config.h or anywhere else where HAVE_PCRE and HAVE_PCRE_H was defined.

Moved all the source and header files out of the directory and back into their own where they can be easily updated.

Did follow your readme there to the letter. Thank you for that. And it seemed to work through all source files just fine.

Only one problem now though: I am receiving a bunch of linker errors due to missing or undefined libraries. I tried compiling PCRE by itself using BCC and the built-in batch file, but I'm getting a few wacky errors there (BCC 5.5 for some reason doesn't come with stdint). So for now I can just use the precompiled libraries found at http://gnuwin32.sourceforge.net/packages/pcre.htm. Worked these specific directories (source, includes and libraries) into the project additional directories as well as the two specific libraries into the linker and it went through without a hitch.

Any advice on either remedying or bypassing those linker errors so that I can use the latest greatest without relying on GnuWin's outdated stuff?

1>game.obj : error LNK2001: unresolved external symbol __imp__pcre_compile
1>parse.obj : error LNK2001: unresolved external symbol __imp__pcre_compile
1>predicat.obj : error LNK2001: unresolved external symbol __imp__pcre_compile
1>wild.obj : error LNK2001: unresolved external symbol __imp__pcre_compile
1>access.obj : error LNK2019: unresolved external symbol __imp__pcre_compile referenced in function _sitelock_alloc
1>atr_tab.obj : error LNK2001: unresolved external symbol __imp__pcre_compile
1>funlist.obj : error LNK2001: unresolved external symbol __imp__pcre_compile
1>funmisc.obj : error LNK2001: unresolved external symbol __imp__pcre_compile
1>parse.obj : error LNK2001: unresolved external symbol __imp__pcre_exec
1>predicat.obj : error LNK2001: unresolved external symbol __imp__pcre_exec
1>wild.obj : error LNK2001: unresolved external symbol __imp__pcre_exec
1>atr_tab.obj : error LNK2019: unresolved external symbol __imp__pcre_exec referenced in function _check_attr_value
1>funlist.obj : error LNK2001: unresolved external symbol __imp__pcre_exec
1>funmisc.obj : error LNK2001: unresolved external symbol __imp__pcre_exec
1>game.obj : error LNK2001: unresolved external symbol __imp__pcre_exec
1>bsd.obj : error LNK2019: unresolved external symbol __imp__pcre_maketables referenced in function _mainthread
1>funlist.obj : error LNK2019: unresolved external symbol __imp__pcre_study referenced in function _fun_regreplace
1>predicat.obj : error LNK2001: unresolved external symbol __imp__pcre_study
1>game.obj : error LNK2019: unresolved external symbol __imp__pcre_copy_substring referenced in function _passwd_filter
1>parse.obj : error LNK2001: unresolved external symbol __imp__pcre_copy_substring
1>wild.obj : error LNK2001: unresolved external symbol __imp__pcre_copy_substring
1>markup.obj : error LNK2019: unresolved external symbol __imp__pcre_get_stringnumber referenced in 
  function _ansi_pcre_copy_named_substring
1>parse.obj : error LNK2019: unresolved external symbol __imp__pcre_fullinfo referenced in function 
  _pe_regs_set_rx_context
1>..\..\game\pennmush.exe : fatal error LNK1120: 7 unresolved externals
Top

Posted by Nick Gammon   Australia  (23,057 posts)  Bio   Forum Administrator
Date Reply #4 on Thu 17 Nov 2011 11:52 PM (UTC)
Message
What's all the "imp__" stuff? The function is pcre_compile not imp__pcre_compile.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Daniel P   USA  (97 posts)  Bio
Date Reply #5 on Fri 18 Nov 2011 12:05 AM (UTC)
Message
I'm uncertain. All I did is pull the latest zip file (8.20) from the FTP site, and then added C:\PCRE\pcre-8.20 to both the Additional Include Directories and Additional Source Directories in the VC++ Directories listing in the Project properties and did a straight build from there.

Though I did find on the FTP site, the Visual Studio project for building PCRE by itself and tried that out. I now have a NEW lib file which I was able to include in the project's linker settings and it went through beautifully.
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


24,205 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.