Anope IRC Services

Please login or register.

Login with username, password and session length
Advanced search  

News:

Pages: [1]   Go Down

Author Topic: Trouble compiling my module  (Read 8327 times)

0 Members and 1 Guest are viewing this topic.

James

  • Anope User
  • Offline Offline
  • Posts: 9
Trouble compiling my module
« on: October 25, 2012, 02:50:06 AM »

I am trying to compile my own module on my Windows 7 machine using Visual Studio 2012 Express. I already have a stable precompiled anope 1.8.7 on my other machine so all I want is to compile the module I made. I tried to follow the steps on here as best as I could.

I get the following error(s) from the VC2012 dev console.

Code: [Select]
C:\SHARED\anope-1.8.7\src\modules>nmake -f makefile.win32

Microsoft (R) Program Maintenance Utility Version 11.00.50727.1
Copyright (C) Microsoft Corporation.  All rights reserved.

        cl /LD /MD /D MODULE_COMPILE /nologo   /O2 /MD /I"../include" /I"../../i
nclude"  cs_appendtopic.c ..\mod_version.c /link ../anope.lib wsock32.lib wsock3
2.lib advapi32.lib /NODEFAULTLIB:libcmtd.lib   /export:AnopeInit /export:AnopeFi
ni
cs_appendtopic.c
mod_version.c
..\mod_version.c(21) : warning C4273: 'getAnopeBuildVersion' : inconsistent dll
linkage
        ..\mod_version.c(16) : see previous definition of 'getAnopeBuildVersion'

..\mod_version.c(25) : warning C4273: 'getAnopeMajorVersion' : inconsistent dll
linkage
        ..\mod_version.c(17) : see previous definition of 'getAnopeMajorVersion'

..\mod_version.c(29) : warning C4273: 'getAnopeMinorVersion' : inconsistent dll
linkage
        ..\mod_version.c(18) : see previous definition of 'getAnopeMinorVersion'

..\mod_version.c(33) : warning C4273: 'getAnopePatchVersion' : inconsistent dll
linkage
        ..\mod_version.c(19) : see previous definition of 'getAnopePatchVersion'

Generating Code...
LINK : fatal error LNK1181: cannot open input file '../anope.lib'
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 11.0
\VC\BIN\cl.EXE"' : return code '0x2'
Stop.

I'm not sure how to set the "set" options I saw in some of the threads I googled. Here is the set option on mine. I replaced my user name with "User"
Code: [Select]
C:\SHARED\anope-1.8.7\src\modules>set
ALLUSERSPROFILE=C:\ProgramData
APPDATA=C:\Users\User\AppData\Roaming
CommonProgramFiles=C:\Program Files\Common Files
CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
CommonProgramW6432=C:\Program Files\Common Files
COMPUTERNAME=User-PC
ComSpec=C:\Windows\system32\cmd.exe
DevEnvDir=C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\
ExtensionSdkDir=C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0\ExtensionSDKs

FP_NO_HOST_CHECK=NO
Framework35Version=v3.5
FrameworkDir=C:\Windows\Microsoft.NET\Framework\
FrameworkDIR32=C:\Windows\Microsoft.NET\Framework\
FrameworkVersion=v4.0.30319
FrameworkVersion32=v4.0.30319
HOMEDRIVE=C:
HOMEPATH=\Users\User
INCLUDE=C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE;C:\Progra
m Files (x86)\Windows Kits\8.0\include\shared;C:\Program Files (x86)\Windows Kit
s\8.0\include\um;C:\Program Files (x86)\Windows Kits\8.0\include\winrt;
LIB=C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\LIB;C:\Program Files
(x86)\Windows Kits\8.0\lib\win8\um\x86;
LIBPATH=C:\Windows\Microsoft.NET\Framework\v4.0.30319;C:\Windows\Microsoft.NET\F
ramework\v3.5;C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\LIB;C:\Prog
ram Files (x86)\Windows Kits\8.0\References\CommonConfiguration\Neutral;C:\Progr
am Files (x86)\Microsoft SDKs\Windows\v8.0\ExtensionSDKs\Microsoft.VCLibs\11.0\R
eferences\CommonConfiguration\neutral;
LOCALAPPDATA=C:\Users\User\AppData\Local
LOGONSERVER=\\User-PC
MOZ_PLUGIN_PATH=C:\Program Files (x86)\Foxit Software\Foxit Reader\plugins\
NUMBER_OF_PROCESSORS=4
OS=Windows_NT
Path=C:\MinGW\bin;C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\ID
E\CommonExtensions\Microsoft\TestWindow;C:\Program Files (x86)\Microsoft Visual
Studio 11.0\Common7\IDE\;C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\
BIN;C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools;C:\Windows
\Microsoft.NET\Framework\v4.0.30319;C:\Windows\Microsoft.NET\Framework\v3.5;C:\P
rogram Files (x86)\Microsoft Visual Studio 11.0\VC\VCPackages;C:\Program Files (
x86)\Microsoft Visual Studio 11.0\Team Tools\Performance Tools;C:\Program Files
(x86)\Windows Kits\8.0\bin\x86;C:\Program Files (x86)\Microsoft SDKs\Windows\v8.
0A\bin\NETFX 4.0 Tools;;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C
:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\Windo
wsPowerShell\v1.0\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
PROCESSOR_ARCHITECTURE=AMD64
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 23 Stepping 7, GenuineIntel
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=1707
ProgramData=C:\ProgramData
ProgramFiles=C:\Program Files
ProgramFiles(x86)=C:\Program Files (x86)
ProgramW6432=C:\Program Files
PROMPT=$P$G
PSModulePath=C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
PUBLIC=C:\Users\Public
SESSIONNAME=Console
set PATH=C:\MinGW\bin;C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common
7\IDE\CommonExtensions\Microsoft\TestWindow;C:\Program Files (x86)\Microsoft Vis
ual Studio 11.0\Common7\IDE\;C:\Program Files (x86)\Microsoft Visual Studio 11.0
\VC\BIN;C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools;C:\Win
dows\Microsoft.NET\Framework\v4.0.30319;C:\Windows\Microsoft.NET\Framework\v3.5;
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\VCPackages;C:\Program Fil
es (x86)\Microsoft Visual Studio 11.0\Team Tools\Performance Tools;C:\Program Fi
les (x86)\Windows Kits\8.0\bin\x86;C:\Program Files (x86)\Microsoft SDKs\Windows
\v8.0A\bin\NETFX 4.0 Tools;;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Comm
on;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\W
indowsPowerShell\v1.0\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\
SystemDrive=C:
SystemRoot=C:\Windows
TEMP=C:\Users\User~1\AppData\Local\Temp
TMP=C:\Users\User~1\AppData\Local\Temp
USERDOMAIN=User-PC
USERNAME=User
USERPROFILE=C:\Users\User
VBOX_INSTALL_PATH=C:\Program Files\Oracle\VirtualBox\
VCINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\
VS110COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools
\
VSINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio 11.0\
windir=C:\Windows
WindowsSdkDir=C:\Program Files (x86)\Windows Kits\8.0\
WindowsSdkDir_old=C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\
windows_tracing_flags=3
windows_tracing_logfile=C:\BVTBin\Tests\installpackage\csilogfile.log

I tried using my windows xp VM and got the same error with visual studio 2005, Windows Server 2003 SP1 Platform SDK (could not find one for xp), and a copy of my module and anope 1.8.7 files. Here is the set option for the xp machine.
Code: [Select]
C:\Documents and Settings\User\Desktop\anope-1.8.7>set
ALLUSERSPROFILE=C:\Documents and Settings\All Users
APPDATA=C:\Documents and Settings\User\Application Data
Basemake=C:\Program Files\Microsoft Platform SDK\Include\BKOffice.Mak
Bkoffice=C:\Program Files\Microsoft Platform SDK\.
CommonProgramFiles=C:\Program Files\Common Files
COMPUTERNAME=WINXP
ComSpec=C:\WINDOWS\system32\cmd.exe
DevEnvDir=C:\Program Files\Microsoft Visual Studio 8\Common7\IDE
FP_NO_HOST_CHECK=NO
FrameworkDir=C:\WINDOWS\Microsoft.NET\Framework
FrameworkSDKDir=C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0
FrameworkVersion=v2.0.50727
HOMEDRIVE=C:
HOMEPATH=\Documents and Settings\User
INCLUDE=C:\Program Files\Microsoft Visual Studio 8\VC\INCLUDE;C:\Program Files\M
icrosoft Platform SDK\Include\.
INETSDK=C:\Program Files\Microsoft Platform SDK\.
LIB=C:\Program Files\Microsoft Visual Studio 8\VC\LIB;C:\Program Files\Microsoft
 Visual Studio 8\SDK\v2.0\lib;C:\Program Files\Microsoft Platform SDK\Lib\.
LIBPATH=C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727
LOGONSERVER=\\SERVER1
MSSdk=C:\Program Files\Microsoft Platform SDK\.
Mstools=C:\Program Files\Microsoft Platform SDK\.
NUMBER_OF_PROCESSORS=1
OS=Windows_NT
Path=C:\Program Files\Microsoft Visual Studio 8\Common7\IDE;C:\Program Files\Mic
rosoft Visual Studio 8\VC\BIN;C:\Program Files\Microsoft Visual Studio 8\Common7
\Tools;C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\bin;C:\WINDOWS\Micros
oft.NET\Framework\v2.0.50727;C:\Program Files\Microsoft Visual Studio 8\VC\VCPac
kages;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\M
icrosoft Platform SDK\Bin\.;C:\Program Files\Microsoft Platform SDK\Bin\WinNT\.;
C:\Program Files\Microsoft Platform SDK\Bin\.;C:\Program Files\Microsoft Platfor
m SDK\Bin\WinNT\.
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
PROCESSOR_ARCHITECTURE=x86
PROCESSOR_IDENTIFIER=x86 Family 6 Model 23 Stepping 7, GenuineIntel
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=1707
ProgramFiles=C:\Program Files
PROMPT=$P$G
SESSIONNAME=Console
SystemDrive=C:
SystemRoot=C:\WINDOWS
TEMP=C:\DOCUME~1\User\LOCALS~1\Temp
TMP=C:\DOCUME~1\User\LOCALS~1\Temp
USERDNSDOMAIN=WAT.COM
USERDOMAIN=WAT
USERNAME=User
USERPROFILE=C:\Documents and Settings\User
VCINSTALLDIR=C:\Program Files\Microsoft Visual Studio 8\VC
VS80COMNTOOLS=C:\Program Files\Microsoft Visual Studio 8\Common7\Tools\
VSINSTALLDIR=C:\Program Files\Microsoft Visual Studio 8
windir=C:\WINDOWS
Logged

Thomas Edwards

  • Anope User
  • Offline Offline
  • Posts: 23
    • Ilkotech Technology and Entertainment
Re: Trouble compiling my module
« Reply #1 on: October 25, 2012, 02:56:43 AM »

Off the top of my head.. I've not compiled any windows modules in a couple of months.

A. Is the copy of anope you're using been compiled before trying to make the module?
B. Are all files extracted correctly the the compile directory?

Thanks,
Thomas Edwards
Logged

James

  • Anope User
  • Offline Offline
  • Posts: 9
Re: Trouble compiling my module
« Reply #2 on: October 25, 2012, 03:29:16 AM »

oops I have not compiled anope. When I tried on my 7 machine, it didn't find any compiler since it only goes up to 2010. On the xp machine, it gave me:

Code: [Select]
Press Enter to Begin...


Do you want to compile Anope with MySQL Support?
NOTE: You will need to have installed MySQL 3.23 or Above

Available Options: yes, no
Default Answer: no

Enable MySQL Support?
no


Looking for a suitable compiler...

Looking for: Microsoft Visual Studio 2010 (64bit)...
ERROR: Cannot find MSVCRT.lib - This version is probably not installed...

Looking for: Microsoft Visual Studio 2010...
ERROR: Cannot find MSVCRT.lib - This version is probably not installed...

Looking for: Microsoft Visual Studio 2008...
ERROR: Cannot find MSVCRT.lib - This version is probably not installed...

Looking for: Microsoft Visual Studio 2008 (64bit)...
ERROR: Cannot find MSVCRT.lib - This version is probably not installed...

Looking for: Microsoft Visual Studio 2005...
ERROR: Cannot find wsock32.lib - Probably missing PlatformSDK...

Looking for: Microsoft Visual Studio 2005 (Old PSDK)...
SUCCESS: Microsoft Visual Studio 2005 (Old PSDK) was found, and is complete!

Build tools were found successfully!


Anope will be compiled with the following options:

        MySQL DB Support:               [NO]
        Compiler Version:               Microsoft Visual Studio 2005 (Old PSDK)
        MySQLDB Version:                Not Enabled
        Anope Version:                  1.8.7.3089

To continue, please press Enter...

C:\Documents and Settings\User\Desktop\anope-1.8.7\install.js(582, 17) Microsof
t JScript runtime error: File not found
Logged

Adam

  • Team
  • *
  • Offline Offline
  • Posts: 462
Re: Trouble compiling my module
« Reply #3 on: October 25, 2012, 03:31:16 AM »

You need to be running make from the root of the source and build the entire thing, which will build your modules in the process. The configure script does not detect vs 2012 currently so you will have to use a previous version or modify it to be able to detect it.
Logged

James

  • Anope User
  • Offline Offline
  • Posts: 9
Re: Trouble compiling my module
« Reply #4 on: October 25, 2012, 03:54:32 AM »

Hmm it configure properly (on xp) this time but when I tried to finish it:

Code: [Select]
Build tools were found successfully!


Anope will be compiled with the following options:

        MySQL DB Support:               [NO]
        Compiler Version:               Microsoft Visual Studio 2005 (Old PSDK)
        MySQLDB Version:                Not Enabled
        Anope Version:                  1.8.7.3089

To continue, please press Enter...


Configuration Complete!
-----------------------

Anope has been configured to your system. To compile, simply type:
nmake -f Makefile.win32

If you update Anope, you should run this script again to ensure
all available options are set.

C:\Documents and Settings\User\Desktop\anope-1.8.7>nmake -f Makefile.win32

Microsoft (R) Program Maintenance Utility Version 8.00.50727.42
Copyright (C) Microsoft Corporation.  All rights reserved.

        cd src\core && nmake -f Makefile.win32 && cd ..\..

Microsoft (R) Program Maintenance Utility Version 8.00.50727.42
Copyright (C) Microsoft Corporation.  All rights reserved.

        cl /LD /MD /D MODULE_COMPILE /nologo  /w /O2 /MD /I "C:\Program Files\Mi
crosoft Visual Studio 8\VC\Include" /I "C:\Program Files\Microsoft Platform SDK\
Include" /I"../include" /I"../../include" bs_act.c ..\mod_version.c /link ../ano
pe.lib wsock32.lib wsock32.lib advapi32.lib /NODEFAULTLIB:libcmtd.lib /LIBPATH:"
C:\Program Files\Microsoft Visual Studio 8\VC\Lib" /LIBPATH:"C:\Program Files\Mi
crosoft Platform SDK\Lib"  /export:AnopeInit /export:AnopeFini /VERSION:1.8.7.30
89
bs_act.c
mod_version.c
Generating Code...
LINK : fatal error LNK1181: cannot open input file '../anope.lib'
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 8\VC\BIN\c
l.EXE"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.

Logged

Adam

  • Team
  • *
  • Offline Offline
  • Posts: 462
Re: Trouble compiling my module
« Reply #5 on: October 25, 2012, 03:56:41 AM »

Delete and re extract Anope, start from a clean working dir.
Logged

James

  • Anope User
  • Offline Offline
  • Posts: 9
Re: Trouble compiling my module
« Reply #6 on: October 25, 2012, 04:34:06 AM »

hmm okay it compiled properly. When I tried to do it to the mod:
Code: [Select]
---
Anope has been installed successfully!
See docs\INSTALL for details on how to configure Anope for use.
---

C:\Documents and Settings\User\Desktop\neweranope\anope-1.8.7>cd src\modules

C:\Documents and Settings\User\Desktop\neweranope\anope-1.8.7\src\modules>nmake
 -f Makefile.win32

Microsoft (R) Program Maintenance Utility Version 8.00.50727.42
Copyright (C) Microsoft Corporation.  All rights reserved.

NMAKE : fatal error U1073: don't know how to make 'os_my_module.dll'
Stop.

C:\Documents and Settings\User\Desktop\neweranope\anope-1.8.7\src\modules>

It would not surprise me if I have a syntax error in my code. Whats the best way for checking the code for syntax errors?
Logged

Adam

  • Team
  • *
  • Offline Offline
  • Posts: 462
Re: Trouble compiling my module
« Reply #7 on: October 25, 2012, 04:35:40 AM »

As I said before...

You need to be running make from the root of the source and build the entire thing, which will build your modules in the process.

You shouldn't be running make at all from src\modules. You must edit the makefile as the wiki says before doing the initial make.
Logged

Thomas Edwards

  • Anope User
  • Offline Offline
  • Posts: 23
    • Ilkotech Technology and Entertainment
Re: Trouble compiling my module
« Reply #8 on: October 25, 2012, 04:45:55 AM »

It seems as per http://wiki.anope.org/index.php/1.8:Windows:Modules
He's doing it by the instructions.

"Using the Visual Studio command prompt, change directory to the same directory as where you put your modules and editted Makefile.inc.win32 (eg. C:\Program Files\Anope\src\modules)
Issue nmake -f Makefile.win32"

Maybe the instructions are wrong?
Logged

James

  • Anope User
  • Offline Offline
  • Posts: 9
Re: Trouble compiling my module
« Reply #9 on: October 25, 2012, 04:58:33 AM »

No it was my mistake. I put my .c file in src instead of src/modules.

Now when I tried to install the dll to my server running anope, it gave me an error asking for msvcr80.dll. I don't have vc2005 on my server. Should I install it?
Logged

Thomas Edwards

  • Anope User
  • Offline Offline
  • Posts: 23
    • Ilkotech Technology and Entertainment
Re: Trouble compiling my module
« Reply #10 on: October 25, 2012, 05:02:17 AM »

Yup, It says about it on http://wiki.anope.org/index.php/Windows:1.8 :P
And as Adam said it only supports 2005, You'd need to make changes to use anything newer.
Logged

Adam

  • Team
  • *
  • Offline Offline
  • Posts: 462
Re: Trouble compiling my module
« Reply #11 on: October 25, 2012, 05:04:29 AM »

Use
mt -manifest modname.dll.manifest -outputresource:modname.dll;2
Logged

James

  • Anope User
  • Offline Offline
  • Posts: 9
Re: Trouble compiling my module
« Reply #12 on: October 25, 2012, 05:10:47 AM »

Use
mt -manifest modname.dll.manifest -outputresource:modname.dll;2

Thanks. So if I have to make a change, I first "nmake -f Makefile.win32" and then that every time?
Logged

Adam

  • Team
  • *
  • Offline Offline
  • Posts: 462
Re: Trouble compiling my module
« Reply #13 on: October 25, 2012, 05:12:30 AM »

yes
Logged
Pages: [1]   Go Up