Gen EDGE

 View Only

 CA Gen Application Error LNK2019

Marios Tofarides's profile image
Marios Tofarides posted Jul 26, 2022 05:40 AM

Hey guys, 

The build tool is not able to successfully link a server application.
The server is 64-bit
I was looking at the profile to ensure it is looking in the correct place. All seems correct: Error output: 

..Linking Load Module stub BDS02
    link /NOLOGO /SUBSYSTEM:WINDOWS -entry:WinMainCRTStartup -out:"C:\Models\BDS.ief\c\BDS02.EXE" "C:\Models\BDS.ief\c\OBJC\STUB.OBJ" "C:\Models\BDS.ief\c\OBJC\STUBMAIN.OBJ" "C:\Models\BDS.ief\c\STUB.RES" @"C:\Models\BDS.ief\c\STUB.LNK"
STUB.OBJ : error LNK2019: unresolved external symbol _sqlcxt referenced in function _C4CONNECT
C:\Models\BDS.ief\c\BDS02.EXE : fatal error LNK1120: 1 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Ms VS 11.0\VC\BIN\link.EXE"' : return code '0x460'
Stop.
****************************
Link step for STUB.EXE using C:\Models\BDS.ief\c\STUB.LNK failed with errors.


The setup we built is:



Can you please advise on how to resolve this?

Regards

Marios

Andy Hebert's profile image
Broadcom Employee Andy Hebert
Marios,
  The link error has been reported a few times so a Knowledge Document was created to answer the problem.  Please see the following KD link with the details, specifically the 'Visual Studio Installation Considerations'.

https://knowledge.broadcom.com/external/article?articleId=213770

Regards,
Andy Hebert
Broadcom Gen Support
Lynn Williams's profile image
Broadcom Employee Lynn Williams
Hi Marios,
In addition to what Andy posted, for the specific undefined symbol _sqlcxt, that should be getting resolved by Oracle client library orasql12.lib (found in the ORACLE_CLIENT_HOME\PRECOMP\LIB directory)
However, as you are building a Gen 64-bit server you need to be referencing 64-bit Oracle client libraries otherwise that symbol won't be resolved.
Your BT profile token LOC.DBLIB points to c:\ora12c\client_1\PRECOMP\LIB. Is that the 32-bit Oracle client?
As quick test to confirm you could change OPT.BITS from 64 to 32 to build a 32-bit server and if that is successful then it confirms that above is 32-bit Oracle client.

To build a Gen 64-bit server you need the Oracle 64-bit client.  If you have the Oracle DB software installed on the same machine the 64-bit client will already be installed in the ORACLE_HOME\PRECOMP\LIB directory. Otherwise you will need to install it separately.
Then to use it in the build change LOC.DBLIB to point to the 64-bit Oracle client PRECOMP\LIB directory.
 
Hope that helps.
 
Regards,
 
Lynn
Marios Tofarides's profile image
Marios Tofarides
Hey guys,

What Andy points me to, is for Gen 8.6 with VS 2017/2019. We still have 8.5 with VS2012 - I don't know if the KB articles are applicable to our case.

Lynn,
It is a 64-bit Oracle 12c client, the one I mentioned in my initial post. c:\ora12c\client_1\PRECOMP\LIB.


I also tried to build using a 32-bit Oracle 12c Instant client setup ('C:\instantclient_12_1\sdk\), and I get the following error:
...SQL Precompiling BDS02 - BDSSRVAE
    CD "C:\Models\BDS.ief\c\."
    PROC.EXE iname=BDSSRVAE.SQC SQLCHECK=SYNTAX MODE=ANSI IRECLEN=255 ORECLEN=255 LTYPE=NONE ONAME=BDSSRVAE.C
NMAKE : fatal error U1077: 'C:\instantclient_12_1\sdk\PROC.EXE' : return code '0xc0000139'
Stop.
****************************
SQL Precompile of C:\Models\BDS.ief\c\BDSSRVAE.SQC failed with errors.
Try PROC.EXE command to check if ORACLE preprocessor is installed.
File Not Found
IEFSIGNAL:FAIL
*** Build for Load Module BDS02 Failed. ***
Important!  Review above for any errors.

It seems that we cannot build using any of the two clients (32-bit instant client and 64-bit installed client)

Regards,

Marios
Lynn Williams's profile image
Broadcom Employee Lynn Williams
Hi Marios,
So when you built 64-bit server with 64-bit Oracle client were all the precompile steps successful and only the final link step failed?
For that problem can you test the result when you force the Oracle DBMS STUB to be precompiled and compiled by setting C token OPT.BUILD_SRC to Yes instead of default No. That will copy the Oracle DBMS stub source STUBORAN.SQC to the model build directory , then precompile and compile it. 
 
For the 32-bit build with 32-bit Oracle client is the PROC.EXE definitely in directory "C:\instantclient_12_1\sdk"? The error implies that executable cannot be found?
 
Thanks
 
Lynn
Marios Tofarides's profile image
Marios Tofarides
Hey Lynn,
The OPT.BUILD_SRC option is set to "N"
----------------------------------------------------------------------------------------------
Let's start with the default 64-bit server module
If you see the attached file, I get this error:
...Linking Load Module stub BDS02
link /NOLOGO /SUBSYSTEM:WINDOWS -entry:WinMainCRTStartup -out:"C:\Models\bds.ief\c\BDS02.EXE" "C:\Models\bds.ief\c\OBJC\STUB.OBJ" "C:\Models\bds.ief\c\OBJC\STUBMAIN.OBJ" "C:\Models\bds.ief\c\STUB.RES" @"C:\Models\bds.ief\c\STUB.LNK"
LINK : fatal error LNK1181: cannot open input file 'ORASQL12.LIB'
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\BIN\link.EXE"' : return code '0x49d'
Stop.

Which shouldn't be, because a 64-bit  ORASQL12.LIB exists in %ORACLE_HOME%\PRECOMP\LIB 

C:\ora12c\client_1\precomp\lib>dir
Volume in drive C has no label.
Volume Serial Number is 344D-746A

Directory of C:\ora12c\client_1\precomp\lib

10/16/2020 01:23 PM <DIR> .
10/16/2020 01:23 PM <DIR> ..
10/16/2020 01:23 PM <DIR> msvc
06/28/2013 04:00 AM 31,422 orasql12.lib
06/28/2013 03:47 AM 311,339 ottclasses.zip
------------------------------------------------------------------------------------------------------------------------------
The 32-bit client module builds, using the 32-bit profile, is located in c:\instantclient_12_1\sdk\lib\msvc.

Regards,

Marios


Attachment  View in library
Lynn Williams's profile image
Broadcom Employee Lynn Williams
Hi Marios,
Please test 64-bit build with OPT.BUILD_SRC set to Yes which will force precompile and compile of the Oracle DBMS stub. I think the root cause might be due to that stub's object code being 32-bit.
Regards
Lynn
Marios Tofarides's profile image
Marios Tofarides
Edited: I have an error - I want to make sure it is occurring everywhere
Lynn Williams's profile image
Broadcom Employee Lynn Williams

Hi Marios,
Also I note from your previous attached file BDS02.out.txt it shows "Environment: WINDOWS" and contains these messages:

***WARNING*** Attempting to build GUI Application with 64bit compiler.
***WARNING*** OPT.BITS changed to 32 for GUI Application build.

So in Generation options your "TP Monitor" is set to Windows which means you are building a GUI client application and even though OPT.BITS=64, the BT resets it back to 32-bits because GUI applications can only be 32 bit.  For a server build you need to set "TP Monitor" to IEFAE.

Hope that helps

Lynn

Lynn Williams's profile image
Broadcom Employee Lynn Williams
Hi Marios,
I also now realise that trying to build a GUI application has been your problem all along.
Your initial output also indicated you have been building a GUI application:
===
..Linking Load Module stub BDS02
    link /NOLOGO /SUBSYSTEM:WINDOWS -entry:WinMainCRTStartup -out:"C:\Models\BDS.ief\c\BDS02.EXE" "C:\Models\BDS.ief\c\OBJC\STUB.OBJ" "C:\Models\BDS.ief\c\OBJC\STUBMAIN.OBJ" "C:\Models\BDS.ief\c\STUB.RES" @"C:\Models\BDS.ief\c\STUB.LNK"
STUB.OBJ : error LNK2019: unresolved external symbol _sqlcxt referenced in function _C4CONNECT
C:\Models\BDS.ief\c\BDS02.EXE : fatal error LNK1120: 1 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Ms VS 11.0\VC\BIN\link.EXE"' : return code '0x460'
===
The STUB concept is only used for GUI applications and token OPT.BUILD_SRC is also relevant to stubs for GUI applications. Sorry, I should have spotted that earlier!
Per my previous post, even if you set token OPT.BITS=64, that value is ignored for GUI applications which can only be 32-bit. Therefore a GUI application is incompatible with a 64-bit Oracle 12c client. That is also why your build was successful when you changed to use the 32-bit Oracle 12c client.
 
When I tried to build Gen 8.5 sample model Window Packaged GUI module GUIMENU with an Oracle 12c 64-bit client I see the exact same "STUB.OBJ : error LNK2019: unresolved external symbol _sqlcxt referenced in function _C4CONNECT" error.
If I change TP Monitor to IEFAE and regenerate then the build is successful when using OPT.BITS=64 and Oracle 12c 64-bit client.
EDIT:
If I change to use Cooperative Packaged server P900 with TP Monitor set to IEFAE and regenerate then the build is successful when using OPT.BITS=64 and Oracle 12c 64-bit client.
So in summary if you want to build a Windows Gen 64-bit application with a 64-bit Oracle client then a Cooperative Packaged Server Manager load module can be built by setting set the "TP Monitor" generation option to IEFAE. Then build a 32-bit GUI client (with "TP Monitor" set to Windows and no database access) to connect to that 64-bit server e.g. in the Gen Sample model "Generation > Cooperative Code", Server Manager P900 and Windows Manager W900.
 
Hope that helps
 
Lynn
Marios Tofarides's profile image
Marios Tofarides
Hey Lynn,

For a server build you need to set "TP Monitor" to IEFAE. Where do I set this in the Build Tool?

So in summary if you want to build a Windows Gen 64-bit application with a 64-bit Oracle client then a Cooperative Packaged Server Manager load module can be built by setting set the "TP Monitor" generation option to IEFAE. Then build a 32-bit GUI client (with "TP Monitor" set to Windows and no database access) to connect to that 64-bit server 

This is for the generation on the server, correct?

Regards,

Marios
Lynn Williams's profile image
Broadcom Employee Lynn Williams

Hi Marios,
"TP Monitor" is a generation option, so for a Cooperative Server Manager you set it to IEFAE either in Generation Defaults or on the Server Manager/Details/Server Environment (if you use the latter don't have Override checkbox set on Generation Defaults unless those values match the Server Environment values)
e.g. for Gen Sample Model Server Manager P900
Using Generation Defaults:


Using Server Manager/Details/Server Environment:

Hope it helps

Lynn