piersharding / php-sapnwrfc

SAP RFC Connector using the SAP NW RFC SDK for PHP
http://www.piersharding.com/blog/
52 stars 15 forks source link

[wip] config.w32 file #12

Closed themasch closed 8 years ago

themasch commented 9 years ago

Hi,

i'm currently working on a config.w32 file to build this extension on windows:

Heres the current state:

ARG_WITH("sapnwrfc", "for sapnwrfc support", "[  --with-sapnwrfc[=DIR] Include sapnwrfc support. DIR is the SAP NWRFCSDK install directory.]");

if (PHP_SAPNWRFC != "no") {
  if (CHECK_HEADER_ADD_INCLUDE("sapnwrfc.h", "CFLAGS_SAPNWRFC", PHP_SAPNWRFC + "\\include;")
    && CHECK_LIB("sapnwrfc.lib", "sapnwrfc", PHP_SAPNWRFC)) {
    EXTENSION("sapnwrfc", "sapnwrfc.c", true);
  } else {
    WARNING("sapnwrfc not enabled; libraries and headers not found");
  }
}

https://gist.github.com/themasch/ef6a4be22f0d209836b9

It currently does not work, linking fails with the following messages:

   Creating library Release_TS\php_sapnwrfc.lib and object Release_TS\php_sapnwr
fc.exp
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcGetVersion@12 refer
enced in function _sapnwrfc_object_clone
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcSetIniPath@8 refere
nced in function _sapnwrfc_object_clone
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcReloadIniFile@4 ref
erenced in function _sapnwrfc_object_clone
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcUTF8ToSAPUC@24 refe
renced in function _u8to16c
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcSAPUCToUTF8@24 refe
renced in function _u16to8c
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcGetTypeAsString@4 r
eferenced in function _set_table_value
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcGetDirectionAsStrin
g@4 referenced in function _set_table_value
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcOpenConnection@12 r
eferenced in function _sapnwrfc_open
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcCloseConnection@8 r
eferenced in function _set_table_value
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcPing@8 referenced i
n function _set_table_value
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcGetConnectionAttrib
utes@12 referenced in function _set_table_value
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcGetPartnerSSOTicket
@16 referenced in function _set_table_value
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcInvoke@12 reference
d in function _set_table_value
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcCreateFunction@8 re
ferenced in function _set_table_value
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcDestroyFunction@8 r
eferenced in function _set_table_value
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcSetParameterActive@
16 referenced in function _set_table_value
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcIsParameterActive@1
6 referenced in function _set_table_value
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcGetCurrentRow@8 ref
erenced in function _get_table_value
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcAppendNewRow@8 refe
renced in function _set_table_value
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcMoveTo@12 reference
d in function _get_table_value
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcGetRowCount@12 refe
renced in function _get_table_value
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcGetChars@20 referen
ced in function _get_char_value
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcGetNum@20 reference
d in function _get_num_value
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcGetDate@16 referenc
ed in function _get_date_value
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcGetTime@16 referenc
ed in function _get_time_value
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcGetString@24 refere
nced in function _get_string_value
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcGetBytes@20 referen
ced in function _get_byte_value
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcGetXString@24 refer
enced in function _get_xstring_value
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcGetInt@16 reference
d in function _get_int_value
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcGetInt1@16 referenc
ed in function _get_int1_value
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcGetInt2@16 referenc
ed in function _get_int2_value
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcGetFloat@16 referen
ced in function _get_float_value
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcGetStructure@16 ref
erenced in function _get_structure_value
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcGetTable@16 referen
ced in function _get_field_value
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcGetStringLength@16
referenced in function _get_string_value
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcSetChars@20 referen
ced in function _set_char_value
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcSetNum@20 reference
d in function _set_num_value
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcSetString@20 refere
nced in function _set_bcd_value
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcSetDate@16 referenc
ed in function _set_date_value
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcSetTime@16 referenc
ed in function _set_time_value
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcSetBytes@20 referen
ced in function _set_byte_value
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcSetXString@20 refer
enced in function _set_xstring_value
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcSetInt@16 reference
d in function _set_int_value
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcSetInt1@16 referenc
ed in function _set_int1_value
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcSetInt2@16 referenc
ed in function _set_int2_value
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcSetFloat@20 referen
ced in function _set_float_value
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcDescribeType@8 refe
renced in function _get_structure_value
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcGetFunctionDesc@12
referenced in function _set_table_value
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcRemoveFunctionDesc@
12 referenced in function _sapnwrfc_object_clone
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcGetFieldCount@12 re
ferenced in function _get_structure_value
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcGetFieldDescByIndex
@16 referenced in function _get_structure_value
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcGetFieldDescByName@
16 referenced in function _set_structure_value
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcGetParameterCount@1
2 referenced in function _set_table_value
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcGetParameterDescByI
ndex@16 referenced in function _set_table_value
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcGetParameterDescByN
ame@16 referenced in function _set_table_value
sapnwrfc.obj : error LNK2019: unresolved external symbol _RfcDestroyFunctionDesc
@8 referenced in function _sapnwrfc_function_object_free_storage
Release_TS\php_sapnwrfc.dll : fatal error LNK1120: 56 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 11.0
\VC\BIN\cl.exe"' : return code '0x2'

Although, the created Makefile looks sane:

[...]
LDFLAGS_SAPNWRFC=/libpath:"C:\Users\schmale\software\php\sapnwrf_src\nwrfcsdk\lib"
LIBS_SAPNWRFC=sapnwrfc.lib
[...]
CFLAGS_BD_EXT_SAPNWRFC= /Fd$(BUILD_DIR)\ext\sapnwrfc\ /Fp$(BUILD_DIR)\ext\sapnwrfc\ /FR$(BUILD_DIR)\ext\sapnwrfc\
SAPNWRFC_GLOBAL_OBJS= $(BUILD_DIR)\ext\sapnwrfc\sapnwrfc.obj
CFLAGS_SAPNWRFC=/I "C:\Users\schmale\software\php\sapnwrf_src\nwrfcsdk\include"  /DHAVE_SAPNWRFC_H=1 /D COMPILE_DL_SAPNWRFC /D SAPNWRFC_EXPORTS=1

Any ideas on what is missing? I had the "libsapucum.lib" in there, too. Did not change anything.

piersharding commented 9 years ago

Hi - try putting the lib files into a global place like system32 - it looks like even though you are specifying the location of them the compiler is still unable to resolve them. Also make sure that you have the right NW SAP RFC SDK for your architecture. Cheers, Piers Harding.

themasch commented 9 years ago

I already have them in system32 and using a them from there (prebuild extension).

themasch commented 9 years ago

Okay, I failed. I tried to build a 32bit extension with 64bit libs. It compiles now but crashes php when creating the sapnwrfc instance. Currently no idea why, i only get a "xyz stopped working"-screen on windows.

ThaDafinser commented 8 years ago

@themasch did you made any progress on this?

themasch commented 8 years ago

@ThaDafinser not yet. I've used the prebuild binaries for now :/

ThaDafinser commented 8 years ago

Did you used those? https://github.com/piersharding/php-sapnwrfc/tree/master/builds

themasch commented 8 years ago

exactly these, thanks for them! ;)

ThaDafinser commented 8 years ago

Cool. Now i got a feedback that they work actually for others too :+1: