Raised This Month: $51 Target: $400
 12% 

Build AMXX and mysql module on Visual Studio 2015 with Mozilla Build


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
addons_zz
Veteran Member
Join Date: Aug 2015
Location: Dreams, zz
Old 01-04-2017 , 13:12   Build AMXX and mysql module on Visual Studio 2015 with Mozilla Build
Reply With Quote #1

Build AMXX and mysql module on Visual Studio 2015 with Mozilla Build

I got the following problem:
PHP Code:
[8388cl basic_sql.obj handles.obj module.obj threading.obj _public_sdk_amxxmodule.obj oldcompat_sql.obj thread_BaseWorker.obj thread_ThreadWorker.obj mysql_MysqlQuery.obj mysql_MysqlRe
sultSet
.obj mysql_MysqlDatabase.obj mysql_MysqlDriver.obj thread_WinThreads.obj version.res /link /MACHINE:X86 /SUBSYSTEM:WINDOWS kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.
lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ..\..\..\support\versionlib\version\version.lib d:\User\Dropbox\Applications\SoftwareVersioning\Allie
dModdersFiles
\Dependencies\mysql-5.0\lib\opt\mysqlclient.lib ws2_32.lib ..\..\..\third_party\zlib\zlib\zlib.lib /OUT:mysql_amxx.dll /DEBUG /nologo /DLL /DEBUG /PDB:"mysql_amxx.pdb"
   
Creating library mysql_amxx.lib and object mysql_amxx.exp
mysqlclient
.lib(my_init.obj) : error LNK2001unresolved external symbol _sprintf
mysqlclient
.lib(vio.obj) : error LNK2001unresolved external symbol _sprintf
mysqlclient
.lib(ctype.obj) : error LNK2001unresolved external symbol _sprintf
mysqlclient
.lib(xml.obj) : error LNK2001unresolved external symbol _sprintf
mysqlclient
.lib(libmysql.obj) : error LNK2001unresolved external symbol _sprintf
mysqlclient
.lib(client.obj) : error LNK2001unresolved external symbol _sprintf
mysqlclient
.lib(password.obj) : error LNK2001unresolved external symbol _sprintf
mysqlclient
.lib(my_time.obj) : error LNK2001unresolved external symbol _sprintf
mysqlclient
.lib(my_open.obj) : error LNK2019unresolved external symbol __dosmaperr referenced in function _my_sopen
mysqlclient
.lib(default.obj) : error LNK2019unresolved external symbol _printf referenced in function _load_defaults
mysql_amxx
.dll fatal error LNK11203 unresolved externals
Build failed

I researched for solutions and I found these references:
  1. AlliedModders - Extension compiler: unresolved external symbol __snwprintf
  2. AlliedModders - How do you build SourceMod extension on Windows?
  3. StackOverflow - C++: Unresolved external symbol _sprintf and _sscanf in Visual Studio 2015

Code:
Add the following library to the linker input files:

    legacy_stdio_definitions.lib

VS 2015 now uses inline definitions that call internal functions for many of the `stdio.h` functions. 
If an object file (or library member) depends on one of those functions, then the
`legacy_stdio_definitions.lib` provides an externally linkable version of the function
 that can be linked to.
I said good, but where are the `linker input files` for the mysql module on the AM Build Script?

I think I found it on:
PHP Code:
Fileamxmodx\modules\mysqlx\AMBuilder
25
:   elif builder.target_platform is 'windows':
26:     binary.compiler.linkflags += [
27:       os.path.join(AMXX.mysql_path'lib''opt''mysqlclient.lib'),
28:       'ws2_32.lib','legacy_stdio_definitions.lib'
29:     ] 
However after I added it I got new error:
PHP Code:
[29660cl basic_sql.obj handles.obj module.obj threading.obj _public_sdk_amxxmodule.obj oldcompat_sql.obj thread_BaseWorker.obj thread_ThreadWorker.obj mysql_MysqlQuery.obj mysql_MysqlR
esultSet
.obj mysql_MysqlDatabase.obj mysql_MysqlDriver.obj thread_WinThreads.obj version.res /link /MACHINE:X86 /SUBSYSTEM:WINDOWS kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32
.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ..\..\..\support\versionlib\version\version.lib d:\User\Dropbox\Applications\SoftwareVersioning\Alli
edModdersFiles
\Dependencies\mysql-5.0\lib\opt\mysqlclient.lib ws2_32.lib legacy_stdio_definitions.lib ws2_32.lib ..\..\..\third_party\zlib\zlib\zlib.lib /OUT:mysql_amxx.dll /DEBUG /nolog
/DLL /DEBUG /PDB:"mysql_amxx.pdb"
   
Creating library mysql_amxx.lib and object mysql_amxx.exp
mysqlclient
.lib(my_open.obj) : error LNK2019unresolved external symbol __dosmaperr referenced in function _my_sopen
mysql_amxx
.dll fatal error LNK11201 unresolved externals
Build failed

For this I found this other reference:
  1. StackOverflow - unresolved external symbol __imp__fprintf and __imp____iob_func, SDL2

But that does not seen to fit. How to fix this `unresolved external symbol __dosmaperr`?

I found it inside the mysql5.0 folder. My sql version is `Mysql-Server 5.0.24a-win32`. Should I use another?
This is the one specified on the requirement script `mysqlver=mysql-noinstall-5.0.24a-win32`:
  1. https://github.com/alliedmodders/amxmodx/blob/master/support/checkout-deps.sh#L26-L28

The build steps are from: https://wiki.alliedmods.net/Building_AMX_Mod_X
This is the mysql I am using: https://github.com/evandrocoan/mysql-server

To build it I just to run `ambuild build` from the main folder, on the Mozilla Build Command Prompt window.
If I configure it to not use Mysql it successfully compiles:
PHP Code:
python ../configure.py --no-mysql
cd 
..
ambuild build
...
   
Creating library amxmodx_mm.lib and object amxmodx_mm.exp
[38296cp "amxmodx\amxmodx_mm\amxmodx_mm.dll" ".\packages\base\addons\amxmodx\dlls\amxmodx_mm.dll"
Build succeeded
__________________
Plugin: Sublime Text - ITE , Galileo
Multi-Mod: Manager / Plugin / Server

Support me on Patreon, Ko-fi, Liberapay or Open Collective

Last edited by addons_zz; 01-04-2017 at 13:55.
addons_zz is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 01-05-2017 , 07:59   Re: Build AMXX and mysql module on Visual Studio 2015 with Mozilla Build
Reply With Quote #2

https://github.com/alliedmodders/sou...cdb3ae73b93163
__________________
asherkin is offline
addons_zz
Veteran Member
Join Date: Aug 2015
Location: Dreams, zz
Old 01-05-2017 , 08:25   Re: Build AMXX and mysql module on Visual Studio 2015 with Mozilla Build
Reply With Quote #3

Thanks, it worked. I opened a pull request adding this fix:
  1. https://github.com/alliedmodders/amxmodx/pull/397
__________________
Plugin: Sublime Text - ITE , Galileo
Multi-Mod: Manager / Plugin / Server

Support me on Patreon, Ko-fi, Liberapay or Open Collective
addons_zz is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 19:17.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode