Trying to build prt4cmd with a hand-made Visual Studio project
Closed this issue · 24 comments
Hello,
I have put together my own Visual Studio solution and project to build prt4cmd.
I have copied every useful DLL in the same path as the executable I have built: com.esri.prt.adaptors.dll, com.esri.prt.codecs.dll, com.esri.prt.core.dll, com.esri.prt.loader.dll, flexnet_prt.dll and VueExport.dll.
Then I have tweaked the sample code so that the search paths match this file layout (inputArgs.mWorkDir and fsFlexLib).
But when I run the sample with arguments -f CityEngAdvFx
it aborts when executing the following line, although cExtPath is correct.
// -- initialize PRT with the path to its extension libraries, the desired log level and the licensing data
prt::init(&cExtPath, 1, (prt::LogLevel)inputArgs.mLogLevel, &flp);
I get a popup saying
``
Microsoft Visual C++ Runtime Library
Runtime Error!
Program: C:\Boulot...\ESRI_SDK_Test\output\prt4cmd.exe
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
OK
``
The log only contains
[2014-Apr-28 10:13:24.005776] [info] ESRI Procedural Runtime
[2014-Apr-28 10:13:24.011777] [info] Version: 1.0.1209 | Build Date: Tue 01/14/2014 06:55 PM | Build Config: PRT_BC_REL PRT_CC_OPT PRT_TC_VC10 | OS: win32
Is this because of some hardcoded search path in the prt runtime?
.
I have encountered the same error...Did anyone solve this problem yet??
Hi guys,
could you tell us your full command line, i.e the exact parameters you give to prt4cmd?
also, what version of visual studio / what build configuration do you use?
cheers
dec
I only give -f CityEngAdvFx
. I use VS 2012, but I can't give you more details yet because I'm out of office until the end of the week.
I have try two arguments in vs2012 debug mode, those are "-f CityEngAdv" and " -l 3 -p data/candler.02.rpk -a ruleFile:string=candler.01.cgb -a startRule:string=Default$Lot -a height:float=30 -e com.esri.prt.codecs.OBJEncoder -z baseName:string=myHouse -g candler_lot.obj", both got "Runtime error"
rror
when i try to execute the "prt4cmd.exe" in console window, i got following errors:
[2014-May-08 09:43:57.035688] [warning] failed to load or register an extension from F:\CityEngine\esri-cityengine-sdk-1.0.1209-win64\examples\prt4cmd\src\lib\com.esri.prt.adaptors.lib, ignoring.
[2014-May-08 09:43:57.095691] [warning] failed to load or register an extension from F:\CityEngine\esri-cityengine-sdk-1.0.1209-win64\examples\prt4cmd\src\lib\com.esri.prt.codecs.lib, ignoring.
[2014-May-08 09:43:57.134693] [warning] failed to load or register extensions from 'F:\CityEngine\esri-cityengine-sdk-1.0.1209-win64\examples\prt4cmd\src\lib\com.esri.prt.core.dll' due to exception: error while loading function 'registerExtensionFactories': 找不到指定的程序。
[2014-May-08 09:43:57.177696] [warning] failed to load or register an extension from F:\CityEngine\esri-cityengine-sdk-1.0.1209-win64\examples\prt4cmd\src\lib\com.esri.prt.core.lib, ignoring.
[2014-May-08 09:43:57.200697] [warning] failed to load or register extensions from 'F:\CityEngine\esri-cityengine-sdk-1.0.1209-win64\examples\prt4cmd\src\lib\com.esri.prt.loader.dll' due to exception: error while loading function 'registerExtensionFactories': 找不到指定的程序。
[2014-May-08 09:43:57.236699] [warning] failed to load or register an extension from F:\CityEngine\esri-cityengine-sdk-1.0.1209-win64\examples\prt4cmd\src\lib\com.esri.prt.loader.lib, ignoring.
[2014-May-08 09:43:57.262701] [warning] failed to load or register extensions from 'F:\CityEngine\esri-cityengine-sdk-1.0.1209-win64\examples\prt4cmd\src\lib\flexnet_prt.dll' due to exception: error while loading function 'registerExtensionFactories': 找不到指定的程序。
[2014-May-08 09:43:57.304703] [warning] failed to load or register extensions from 'F:\CityEngine\esri-cityengine-sdk-1.0.1209-win64\examples\prt4cmd\src\lib\VueExport.dll' due to exception: error while loading function 'registerExtensionFactories': 找不到指定的程序。
[2014-May-08 09:43:57.354706] [error] prt::createResolveMap failed, exception caught: 'error while reading 7zip archive: file not found'
Thanks in advance....
Regarding Benoit's problem: I could not reproduce the issue with Visual Studio 10 and the cmake-based build. Could you try to build it via cmake as described in the readme and see if that works? If it does we can look what's different in the solution-file based build.
Regarding Zsunpl's problem: the plugin path setup seems to be wrong (com.esri.core.dll and com.esri.prt.loader.dll should not be loaded as plugins). Can you try also to build & run the example as described in the readme via cmake and see if that works?
Thanks decesri! I built prt4cmd.exe using Visual Studio 2013 in Win7 64bit OS, and it works in console window now. You are right about the causes. But I still can't get it work in vs2013 debug mode. And I think the arguments is correct. It keeps showing "Runtime error: This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information" . Why does that happen?
Hi,
The cmake-built sample works fine I've been able to run it successfully with the provided rule package. I've had a look at the generated makefile and I don't see anything special that I should have added to my own project. AFAIR I didn't do anything special besides setting include and library search directories and adding stub libraries as linker input. I'm back at the office monday, I'll be able to provide more information then.
I've just checked my VS2012 project. There are no esoteric preprocessor definitions:
_MBCS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
I use Boost 1.55 in my include path
..\esri-cityengine-sdk\include;$(BOOST_ROOT)
And the equivalent libraries:
..\esri-cityengine-sdk\lib;..\esri-cityengine-sdk\bin;$(BOOST_ROOT)\lib64-msvc-11.0
com.esri.prt.core.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
And that's about it.
My Visual Studio version is this:
Microsoft Visual Studio Professional 2012
Version 11.0.61030.00 Update 4
Microsoft .NET Framework
Version 4.5.50709
did you try both Release and Debug mode?
Yes, abort() is called by both builds.
My next guess is the relative location of the dlls and the .exe file. Make sure com.esri.prt.core.dll and flexnet_prt.dll are in the same directory as prt4cmd.exe.
(edited: corrected dll name)
I don't have a com.esri.prt.dll, but I do have a com.esri.prt.core.dll. All the DLLs I could find (com.esri.prt.codecs.dll, com.esri.prt.core.dll, com.esri.prt.loader.dll, flexnet_prt.dll, VueExport.dll, com.esri.prt.adaptors.dll) are in the same directory as my executable. BTW, the debugging working directory is correct as well (set to $TargetDir which is the location of the generated executable).
Ok, can you try to put com.esri.prt.codecs.dll, VueExport.dll, com.esri.prt.adaptors.dll in a separate directory? (these are the actual plugins + depended libraries which get loaded by the core on init). I suspect com.esr.prt.core.dll trying to load itself might cause the problem.
My first attempt had everything in the same directory. I gave another try by replicating the install directory structure produced when generating the sample with cmake, but got the same behaviour.
Now I have moved the 3 dlls you mentioned in a separate subdirectory, the others being with the executable, but still have the same result.
I did get the same result with benoit
I think the problem is, why the prt4cmd.exe can be execute successfully in command line,but failed in debug mode since the env setting of both are the same.
Same with me: the program seems to work when launched from the command line, but fails when debugging inside Visual Studio.
So it just fails if you attach the debugger? Does it work if you start it without debugging (Ctrl+F5)?
When press Ctrl+F5, prt4cmd.exe can be execute successfully just like in the command line..
It would seem so, yes. I've checked argv[0] they are the same in both cases.
The callstack from which abort() is called is the following:
user32.dll!0000000076af933a() Unknown
user32.dll!0000000076b04bc4() Unknown
user32.dll!0000000076b04edd() Unknown
user32.dll!0000000076b52920() Unknown
user32.dll!0000000076b51c15() Unknown
user32.dll!0000000076b5146b() Unknown
user32.dll!0000000076b51616() Unknown
user32.dll!0000000076b51306() Unknown
flexnet_prt.dll!000007feeca4e26d() Unknown
flexnet_prt.dll!000007feeca2ae39() Unknown
flexnet_prt.dll!000007feeca2b09a() Unknown
flexnet_prt.dll!000007feeca6c746() Unknown
flexnet_prt.dll!000007feeca6c984() Unknown
flexnet_prt.dll!000007feeca6cb1b() Unknown
com.esri.prt.loader.dll!000007feed4f9d5f() Unknown
com.esri.prt.loader.dll!000007feed4bc577() Unknown
com.esri.prt.loader.dll!000007feed4b334d() Unknown
com.esri.prt.core.dll!000007feecede365() Unknown
com.esri.prt.core.dll!000007feecede712() Unknown
> prt4cmd.exe!main(int argc=3, char * * argv=0x00000000002f3fd0) Line 152 C++
prt4cmd.exe!__tmainCRTStartup() Line 536 C
prt4cmd.exe!mainCRTStartup() Line 377 C
kernel32.dll!0000000076d559ed() Unknown
ntdll.dll!000000007709c541() Unknown
Another note: If add a long Sleep() at the beginning of main(), then Ctrl-F5, then attach the debugger, I'll abort() just the same. It is starting to look like Flexnet detects that a debugger is attached and decides to bail out in that case for fear of being hacked.
Yes, that's it.
Well, that's not very convenient, but at least it can be worked around. Problem solved then :).