Error compiling ZDOOM [all solved]

Discuss anything ZDoom-related that doesn't fall into one of the other categories.
User avatar
FDARI
Posts: 1097
Joined: Tue Nov 03, 2009 9:19 am

Error compiling ZDOOM [all solved]

Post by FDARI »

I have finally installed most packages and set project and system variables so that the solution compiles, almost in its entirety.
My present problem is this:

2>c:\personlig\doom\zdoomsrc\cpproj\src\win32\i_xinput.cpp(127) : error C2065: 'XUSER_MAX_COUNT' : undeclared identifier

Where is XUSER_MAX_COUNT supposed to be defined?
I have searched the entire solution and only found the symbol in i_xinput.cpp, and never as a declaration, so the error message seems to be correct.

Update: I found this, so I'm back to trying on my own: http://flandre.zdoom.org/viewtopic.php? ... 2&start=15
And this, even more to the point: http://forum.zdoom.org/viewtopic.php?f= ... 04#p505108

Now, what can I do about these unresolved external symbols? (Such as 2>LIBCMTD.lib(access.obj) : error LNK2019: unresolved external symbol __imp__GetFileAttributesA@4 referenced in function __access_s). I haven't given up finding it out on my own, but since I have already made this post, I might as well keep track of progress.

First successful build:
There was something about that SDK. The only downloadable SDK I could locate that seemed to be reasonably right was the all-encompassing latest release for Windows 7. x86 libraries were checked on install, but were not actually placed in the lib-directory until I reran the install ("change") and unchecked x64. When both were checked, x86 was omitted. Now I just get a few warnings for lack of debug info, which I don't particularly worry about; at this time, anyway.

Next problem: Run-time error, see subsequent post.
Last edited by FDARI on Sun Oct 10, 2010 8:38 am, edited 2 times in total.
User avatar
FDARI
Posts: 1097
Joined: Tue Nov 03, 2009 9:19 am

Run-time error

Post by FDARI »

Compilation of Zdoom completes now, but I would not call it a complete success, as the program does not behave like the official version. It crashes at the beginning of any map (before the map is displayed, perhaps when display is attempted). The crash is triggered by starting any episode / skill level in the Doom IWAD and by using the console to start a specific map.

Example of crash message:
Unhandled exception at 0x00af475b in zdoomd.exe: 0xC000001D: Illegal Instruction.

Code / debug details:
Current function: R_MapPlane
Failing call: spanfunc()
void (*spanfunc) (void); is defined in r_main.cpp
Its currently assigned function appears to be GLOBAL @R_DrawSpanP_ASM@0 in tmap.asm

I consider learning assembly today, but if anybody happens to have an idea where I've gone wrong, please do share.

Note: The zdoomd.exe debug version crashes, as does the release build zdoom.exe. The official zdoom.exe is the same size as the file I build, but contents differ. Copying the official executable over the build executable works fine (proving that there is a problem specifically with the executable I build).

EDIT: Tested with NASM version 2.0, no difference. By default I use version 2.09.02.
User avatar
FDARI
Posts: 1097
Joined: Tue Nov 03, 2009 9:19 am

Re: Error compiling ZDOOM [all solved]

Post by FDARI »

Correctly assigned all paths in Visual C++ 2005 options (executables, includes and libraries).
Removed any data from environment variables that would duplicate or interfere with file location.
Deleted source and build files, reextracted them and tried a debug run.
No crash, full playability, it looks good so far.

The NASM executable in use is version 2.0
User avatar
Demolisher
Posts: 1749
Joined: Mon Aug 11, 2008 12:59 pm
Graphics Processor: nVidia with Vulkan support
Location: Winchester, VA
Contact:

Re: Error compiling ZDOOM [all solved]

Post by Demolisher »

FDARI wrote:Correctly assigned all paths in Visual C++ 2005 options (executables, includes and libraries).
Removed any data from environment variables that would duplicate or interfere with file location.
Deleted source and build files, reextracted them and tried a debug run.
No crash, full playability, it looks good so far.

The NASM executable in use is version 2.0

This fixed your problem? I am so utterly confused. I have the same problem as you, could you post your include/library/etc config, or some clearer steps? I have a spawnforced patch i would like to test, but I can't.
User avatar
Enjay
 
 
Posts: 26517
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Error compiling ZDOOM [all solved]

Post by Enjay »

FDARI wrote:Removed any data from environment variables...
Can you tell me where to set environment variables in Visual C++ 2005? When I compile GZdoom, it tells me that it can't find the temp directory variable.

Code: Select all

Could not find the temporary path. Make sure the TEMP environment variable is set.
It is set as a computer wide environment variable and the directory does exist. It doesn't seem to affect the builds at all (they work perfectly) and I think VC++ must set the variable itself somehow because a second build in the same session does not complain about the missing variable but if I quit and rebuild the message comes back.

So, just for neatness sake, I'd like to try and stop this.
User avatar
FDARI
Posts: 1097
Joined: Tue Nov 03, 2009 9:19 am

Re: Error compiling ZDOOM [all solved]

Post by FDARI »

As far as I can tell, it should work with regular environment variables. I run Windows XP for the time being, and both TMP and TEMP are defined as user environment variables for me. I modify them through what I think is standard means. (Properties of "My computer", Tab "Advanced", Button "Environment variables").

To test that environment-variables are correctly set in the first place, you could open a command prompt and type "SET TEMP" (without quotes) and check that the output was TEMP=[Some valid folder]. Then try to access this folder, and create & delete a file there. If any of these steps provide unexpected results we have something to work with.

You can use Visual C++ 2005 to verify the environment variables too: The VC++ Project settings include an option to "Show environment in log".

If these tests show that the variable has not been properly assigned, and you have difficulty assigning it, I'll gladly try to help you out.

PS: A typical User-Environment-Variable under Windows XP would read "%USERPROFILE%\Local settings\Temp". The systemwide fallback TEMP would be %SystemRoot%\TEMP (C:\Windows\Temp), which isn't necessarily writable to a restricted user.
User avatar
FDARI
Posts: 1097
Joined: Tue Nov 03, 2009 9:19 am

Re: Error compiling ZDOOM [all solved]

Post by FDARI »

I'll provide as many details of my current setup as I can think of, for any who might need the info. Perhaps some of these things are worth mentioning in the Wiki as well.

Development tool installed: Visual C++ 2005
NASM installed: NASM 2.0 (c:\program files\nasm\2.0) (files merely copied into this location)
Latest SlikSvn installed (c:\Program files\SlikSvn) (exe version 1.6.12.38263)

APIs:
FMOD: C:\Program files\FMOD SoundSystem\FMOD Programmers API Win32 (0.4.26.20; Version info acquired from DLL in latest official ZDOOM release)
(I believe I used this) - Microsoft Windows SDK for Windows 7 and .NET Framework 4:
* I explicitly omited x64-files, and included x86-files.
DirectX SDK as provided on the Wiki

Environment variables:
PATH has no references to any of these components.
There are no specific environment variables I identify as relevant to this in my present system configuration,
except from the automatic systemwide DirectX path: DXSDK_DIR. This will always point to the latest version installed.

Visual C++ 2005 directories (Tools - options):

Directories for Executable files:
Added C:\Program files\SlikSvn\bin
Added C:\Program files\nasm\2.0

Directories for Include files:
First entry = C:\Program files\Microsoft DirectX SDK (February 2010)\Include
Second entry = C:\Program files\FMOD SoundSystem\FMOD Programmers API Win32\api\inc
Third entry = C:\Program files\Microsoft SDKs\Windows\v7.1\Include

Directories for Libraries:
First entry = C:\Program files\Microsoft DirectX SDK (February 2010)\Lib\x86
Second entry = C:\Program files\FMOD SoundSystem\FMOD Programmers API Win32\api\lib
Third entry = C:\Program files\Microsoft SDKs\Windows\v7.1\Lib

The order is important. The Windows 7 SDK (3. entry) will match filenames that also exist in the DirectX SDK. The higher entry (DirectX) has preference. You could (and maybe you should) use the environment variable instead of a version specific path to the DirectX SDK, but I presently prefer this setup, because it worked.

After setting up all this I cleaned up everything and unzipped the code into an empty folder, moved in the PK3, IWAD and FMOD, tested a few compilations, tested a (time consuming) rebuild all and found it all to be executing flawlessly. I did it to be sure I wasn't affected by previous failures. A correct setup might well function without such brutal revertion.
User avatar
Enjay
 
 
Posts: 26517
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Error compiling ZDOOM [all solved]

Post by Enjay »

Sorry, I missed your reply. Thanks very much for the input.
FDARI wrote:As far as I can tell, it should work with regular environment variables. I run Windows XP for the time being, and both TMP and TEMP are defined as user environment variables for me. I modify them through what I think is standard means. (Properties of "My computer", Tab "Advanced", Button "Environment variables").
OK, I checked there and things seem to be set up correctly:

Image

You mentioned that c:\windows\temp might be a problem so I tried changing it (when I did, the dialogue told me that it was indeed set for %SystemRoot%\TEMP). I changed it to c:\temp (and created the directory) but still got the error message in VC++ so I changed it back.
FDARI wrote:To test that environment-variables are correctly set in the first place, you could open a command prompt and type "SET TEMP" (without quotes) and check that the output was TEMP=[Some valid folder]. Then try to access this folder, and create & delete a file there. If any of these steps provide unexpected results we have something to work with.
I'd already tested the variables from the command prompt but, yes, that checks out:

Image

And I can navigate to that directory and create, edit and delete a file from it.
FDARI wrote:PS: A typical User-Environment-Variable under Windows XP would read "%USERPROFILE%\Local settings\Temp". The systemwide fallback TEMP would be %SystemRoot%\TEMP (C:\Windows\Temp), which isn't necessarily writable to a restricted user.
Noted, so I also went to c:\windows\temp and created, edited and then deleted a file. All that worked as expected. The only thing that I was unsure of was that the file icon appeared with a little padlock on it (as do many of the other files in there) but this did not seem to affect my ability to create, work with or delete the file.

Image

FDARI wrote:You can use Visual C++ 2005 to verify the environment variables too: The VC++ Project settings include an option to "Show environment in log".
This is the only step that I have not managed so far. I've searched the menus in VC++ 2005 and can't find where to enter this option. Can you explain exactly where I need to go to do this?
User avatar
FDARI
Posts: 1097
Joined: Tue Nov 03, 2009 9:19 am

Re: Error compiling ZDOOM [all solved]

Post by FDARI »

Windows 7? If so this might explain the lock symbol. It may be an indicator of one of the simplified share statuses (which I hardly ever use); namly "shared with nobody". Files exclusive to your current user, or otherwise restricted, might have such a symbol, especially within your userprofile.

The files could be protected somehow. Numerous issues with later Windows systems are solved by running troubled processes with "administrative privileges" (allowing actions that would otherwise be blocked or require confirmation). Or by running them in "compatibility mode" for XP, which probably also disables most application restrictions (user restrictions still apply, but you appear not to have [m]any). Even full administrators launch applications with restrictions by default. You could run Visual C++ 2005 with elevated privileges just to see if it affects the issue.

Of course, the error message could be misleading; or it could be something akin to the Internet Explorer 8 on Windows Server 2008 print bug... Not likely, but you could always run a .CMD-batch like this (see spoiler) and see if it changes anything. I don't really recommend it, but change it makes is mostly harmless (reduces protection on targeted folder/files).
Spoiler:
View environment variables in C++ (probably redundant):
Spoiler: Step by step text
User avatar
Enjay
 
 
Posts: 26517
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Error compiling ZDOOM [all solved]

Post by Enjay »

Thanks again for your help. Yes, Win7 64 bit ultimate. I should have mentioned that. That link you gave me does indeed explain the lock symbol and what it says is consistent with the behaviour that I observe - ie, running as the administrator (as I do) I have full access to such files.

Thanks for the script, I'll try that later on. Thanks also for the location of that VC++ option. I couldn't see it for looking. Got it now and, interestingly, the log says:

Code: Select all

    TEMP=C:\Users\Nigel\AppData\Local\Temp
    TMP=C:\Users\Nigel\AppData\Local\Temp
So the environment variable is there and being read by VC++

I thought it might be worthwhile showing you exactly where the error message appears. It's pretty near the start, just after the first pk3 gets checked.

Code: Select all

1>------ Build started: Project: wadsrc-lights, Configuration: Release Win32 ------
2>------ Build started: Project: wadsrc-brightmaps, Configuration: Release Win32 ------
3>------ Build started: Project: wadsrc, Configuration: Release Win32 ------
1>Checking lights.pk3...
2>Could not find the temporary path. Make sure the TEMP environment variable is set.
2>
2>Checking brightmaps.pk3...
It only appears once per build, not after every pk3 or anything.

And, as I mentioned before, if I build for a second time without restarting VC++, the message does not appear. I assume that whatever the "problem" is, VC++ sets some kind of temporary variable itself (or perhaps going through the process once is enough for the variable to be read properly). If, however, I quit, start again and build again, the message comes back for the first build in that session.

I'm sure it's not a huge problem in as much as it seems to have no negative impact on the builds themselves. It just bugs me. ;)
User avatar
FDARI
Posts: 1097
Joined: Tue Nov 03, 2009 9:19 am

Re: Error compiling ZDOOM [all solved]

Post by FDARI »

I would not run the script first.

One possible step: Watch the contents of your %TEMP% folder when compiling. See if a subfolder is created during compile. If this happens, see if it is missing again on the next session. (Or if a completely different subfolder is generated)

Apart from that, I would test compatibility mode for XP, and consider "run as administrator". Just to see if it makes a difference. There is little mention of this issue on the web, and all who bring it up seem to be running Windows Vista or newer.

If none of the above gave any further clue what causes the message, the script is an additional possibility.
User avatar
Enjay
 
 
Posts: 26517
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Error compiling ZDOOM [all solved]

Post by Enjay »

Hmmm...

Nope, neither the %appdata% temp directory nor the windows\temp directory get any new files or directories in them when running Visual C++. I cleared both directories out before running so I would spot any additions but nothing appeared.

[edit] Scratch that. I don't know what I did last time but, yes, the %appdata% temp directory gets dozens of files in it when compiling. So obviously VC++ can find the directory. Perhaps one of the tools called to make the pk3/zip files is having the problem?[/edit]

XP Compat mode does not cure the problem.

The script made no difference.

I think we must be running out of possibilities by now. :?

Another thing worth mentioning, it only happens with GZdoom, not Zdoom.
User avatar
FDARI
Posts: 1097
Joined: Tue Nov 03, 2009 9:19 am

Re: Error compiling ZDOOM [all solved]

Post by FDARI »

If we really care, we now analyse the scripts and building processes of Visual Studio / C++ in general and GZDoom in particular. I'm not familiar with these, I only know what I have observed. The build log seems to give a batch of command line statements, and involves the execution of a few external apps (such as SVN and ASM applications/compilers). If there's an app unique to gzdoom, it might be the source. Actually going indepth on that might constitute excessive effort. Any difference between build scripts/routines for zdoom and gzdoom might provide a clue.
User avatar
Enjay
 
 
Posts: 26517
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Error compiling ZDOOM [all solved]

Post by Enjay »

I've already had a poke around the various config files for GZdoom and Zdoom but nothing leapt out at me. To be fair though, this is really right on the edge of what I understand. I can setup VC++ and I've done enough theory in a college course so that I know the basics of what it is doing but when it starts to get into the detail, it's going beyond what I know.

I'll have a look again but unless I come up with something obvious I think I'll just leave it as it is because, when it comes down to it, it is working. Thanks for all your help along the way though. I've learned a few things anyway. :)
User avatar
randi
Site Admin
Posts: 7746
Joined: Wed Jul 09, 2003 10:30 pm
Contact:

Re: Error compiling ZDOOM [all solved]

Post by randi »

Enjay wrote:

Code: Select all

2>Could not find the temporary path. Make sure the TEMP environment variable is set.
2>
2>Checking brightmaps.pk3...
Assuming I am reading this correctly, it fails to find TEMP just before it checks brightmaps.pk3, so try comparing the settings for building gzdoom.pk3 versus brightmaps.pk3.
Post Reply

Return to “General”