PDA

View Full Version : No .so created



Ni3ls
5th November 2015, 20:23
Hi all,

Im trying to compile mitch version of libcod

cd /ur/cod2/path
git clone https://github.com/M-itch/libcod
cd libcod
./doit.sh base
./doit.sh cod2_1_0

However, there is no libcod.so file created inside the bin folder

git clone https://github.com/M-itch/libcod gives me this result


Initialized empty Git repository in /home/olger/HIGHJUMP/libcod/.git/
remote: Counting objects: 802, done.
remote: Total 802 (delta 0), reused 0 (delta 0), pack-reused 802
Receiving objects: 100% (802/802), 952.86 KiB | 785 KiB/s, done.
Resolving deltas: 100% (544/544), done.


/doit.sh base


##### COMPILE GSC_ASTAR.CPP #####
##### COMPILE GSC_MYSQL.CPP #####
##### COMPILE SERVER.C #####
##### COMPILE GSC_MEMORY.CPP #####
##### COMPILE cracking.CPP #####
##### COMPILE GSC_MATH.CPP #####
##### COMPILE JAVA_EMBED.C #####
Ignore java_embed.c, because java_enable==false (e.g. because the dir $java_jdk=/root/helper/openjdk8 does not exist)


and ./doit.sh cod2_1_0


##### COMPILE cod2_1_0 LIBCOD.CPP #####
##### COMPILE cod2_1_0 GSC.CPP #####
##### COMPILE cod2_1_0 GSC_PLAYER.CPP #####
##### COMPILE cod2_1_0 GSC_UTILS.CPP #####
##### LINK libcod2_1_0.so #####
objects_normal/cracking.opp: could not read symbols: File in wrong format
collect2: ld returned 1 exit status


What is the problem?

IzNoGoD
5th November 2015, 21:08
Did you install the prerequisites as per the github readme?

Ni3ls
5th November 2015, 21:46
Its a centos linux, so i cant use those commands

kung foo man
6th November 2015, 00:49
Kinda strange, maybe just recompile cracking.opp with ./doit.sh base

Ni3ls
6th November 2015, 03:05
So dont use./doit.sh cod2_1_0?

kung foo man
6th November 2015, 03:11
Oh well, just do both commands again ^^

"base" will compile the version independent files and the "cod2_1_0" the version dependent files + linking everything together. So yea, you gotta do both again (just takes a few seconds nonetheless)

Ni3ls
6th November 2015, 08:40
Same result:( Again no .so

Mitch
6th November 2015, 12:05
Its a centos linux, so i cant use those commands

CentOS commands
http://killtube.org/showthread.php?2036-Help-me-pls)))&p=10702&viewfull=1#post10702

Ni3ls
6th November 2015, 19:41
Same. Still no .so

But if i use the extra step mentioned in the other post
http://killtube.org/showthread.php?2036-Help-me-pls)))&p=10702&viewfull=1#post10702

where you link "mysql" files in "vendors" directory first
mkdir vendors
ln -s /usr/lib/mysql/ vendors/lib
It will compile successfully but it will give a "segmentation fault" when I try to use the library


Package gcc-4.4.7-16.el6.x86_64 already installed and latest version
Package libgcc-4.4.7-16.el6.i686 already installed and latest version
Package gcc-c++-4.4.7-16.el6.x86_64 already installed and latest version
Package glibc-devel-2.12-1.166.el6_7.3.i686 already installed and latest version
Package mysql-server-5.1.73-5.el6_6.x86_64 already installed and latest version
Package mysql-devel-5.1.73-5.el6_6.i686 already installed and latest version

Dedi server is Centos 64 bit version.

IzNoGoD
6th November 2015, 20:39
Try compiling it without any mysql, see if that changes things (obviously you'd have to change your .gsc files to NOT call the mysql functions)

Ni3ls
7th November 2015, 17:41
I get Segmentation error on these 2 lines

strcpy(defaultweapon_mp, "defaultweapon_mp");
defaultweapon_mp[strlen(defaultweapon_mp)] = '\0';
gsc_utils.cpp

However, when I comment them out, setweaponfiretime doesnt work correctly (no error, but also no change in firetime) and after I shoot I get full ammo everytime

Mitch
7th November 2015, 18:22
I get Segmentation error on these 2 lines

strcpy(defaultweapon_mp, "defaultweapon_mp");
defaultweapon_mp[strlen(defaultweapon_mp)] = '\0';
gsc_utils.cpp

However, when I comment them out, setweaponfiretime doesnt work correctly (no error, but also no change in firetime) and after I shoot I get full ammo everytime

Can you post the segmentation fault of this crash from dmesg?
Does the getweaponfiretime function read the firetime correctly?

Ni3ls
8th November 2015, 09:45
Can you post the segmentation fault of this crash from dmesg?
Trying to reproduce the seg fault

Does the getweaponfiretime function read the firetime correctly?
No for all weapons it returns 0


case "firetime":
if(args.size >= 3) // say !firetime time
{
firetime = Int(args[2]);
maps\mp\gametypes\_weapons::setWepFireTime(self getCurrentWeapon(), firetime);
}
else
{
firetime = maps\mp\gametypes\_weapons::WeaponFireTime(self getCurrentWeapon());
self thread tellMessage("FireTime: " + firetime);
}
return;

And this is what I added in _weapons.gsc from another thread. I dont load/setup/precache anything in any other script. I dont know if I have to.

///NEW
loadWeaponInfo(i, array)
{
array.id = i;
array.dmg = getweapondamage(i); // store baseline
array.meleedmg = getweaponmeleedamage(i); // in case you want to restore old value

if(i >= 64) // no viewmodels after 64th weapon
array.bugged = 1;
}

getWeaponArray(weapon)
{
if(isDefined(level.weapons[weapon]) && isDefined(level.weapons[weapon].id))
return level.weapons[weapon];
else if(isDefined(level.otherweapons[weapon]) && isDefined(level.otherweapons[weapon].id))
return level.otherweapons[weapon];
else
return undefined;
}

updateWepDamage(weapon, dmg)
{
array = getWeaponArray(weapon);
if(isDefined(array))
array.dmg = dmg;
}

updateWepMeleeDamage(weapon, dmg)
{
array = getWeaponArray(weapon);
if(isDefined(array))
array.meleedmg = dmg;
}

getWeaponId(weapon)
{
if(isDefined(level.weapons[weapon]) && isDefined(level.weapons[weapon].id))
return level.weapons[weapon].id;
else if(isDefined(level.otherweapons[weapon]) && isDefined(level.otherweapons[weapon].id))
return level.otherweapons[weapon].id;
else
return -1;
}

WeaponMaxAmmo(weapon)
{
id = getWeaponId(weapon);
if(id == -1)
return 0;

return getweaponmaxammo(id);
}

WeaponDamage(weapon)
{
id = getWeaponId(weapon);
if(id == -1)
return 0;

return getweapondamage(id);
}

WeaponMeleeDamage(weapon)
{
id = getWeaponId(weapon);
if(id == -1)
return 0;

return getweaponmeleedamage(id);
}

setWepDamage(weapon, dmg, isdefault)
{
id = getWeaponId(weapon);
if(id == -1)
return 0;

if(isDefined(isdefault) && isdefault)
updateWepDamage(weapon, dmg);

return setweapondamage(id, dmg);
}

setWepMeleeDamage(weapon, dmg, isdefault)
{
id = getWeaponId(weapon);
if(id == -1)
return 0;

if(isDefined(isdefault) && isdefault)
updateWepMeleeDamage(weapon, dmg);

return setweaponmeleedamage(id, dmg);
}

WeaponFireTime(weapon)
{
id = getWeaponId(weapon);
if(id == -1)
return 0;

return getweaponfiretime(id);
}

setWepFireTime(weapon, time)
{
id = getWeaponId(weapon);
if(id == -1)
return 0;

return setweaponfiretime(id, time);
}

Mitch
8th November 2015, 15:08
What CentOS version are you running?

Also I have updated my CentOS build post, because in release 7 MySQL is replaced by MariaDB. Therefore the mysql packages are replaced by maradb-server and mariadb-devel.
You can check if your mysql client is detected correctly by running:

mysql_config --cflags --libs

Ni3ls
8th November 2015, 15:55
Centos x64.

If I run those commands


-I/usr/include/mysql -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fwrapv -fPIC -DUNIV_LINUX -DUNIV_LINUX
-rdynamic -L/usr/lib64/mysql -lmysqlclient -lz -lcrypt -lnsl -lm -lssl -lcrypto

EDIT: ammo issue is solved. I tried it with my old mod and it doesnt have the issue :/

Still setweaponfiretime not working.

Do I need to load the scripts somewhere?

Mitch
8th November 2015, 18:37
Centos x64.

Which CentOS release? 7? 6? 5?

cat /etc/redhat-release

Edit: the problem that you have with your mysql is that your mysql lib is 64-bit and libcod requires the 32-bit client.
If you can't install the 32-bit version then you need to use the vendors directory.

Ni3ls
8th November 2015, 19:00
Which CentOS release? 7? 6? 5?

cat /etc/redhat-release


CentOS release 6.5 (Final)


But i dont want to use mysql. Cant i compile without it like izno said? How to do that?

IzNoGoD
8th November 2015, 19:31
If getweaponfiretime returns 0 for all weapons then there's something wrong with the addresses used by said function. Try to figure that out first. (maybe no #ifdef for different cod versions?)

Mitch
8th November 2015, 19:41
CentOS release 6.5 (Final)


But i dont want to use mysql. Cant i compile without it like izno said? How to do that?

You can disable mysql by setting COMPILE_MYSQL to 0 in config.hpp.

Edit:

If getweaponfiretime returns 0 for all weapons then there's something wrong with the addresses used by said function. Try to figure that out first. (maybe no #ifdef for different cod versions?)

It might be possible that the offsets are different in 1.0 than 1.2/1.3.
Edit 2: firetime is the same offset as 1.3.

Ni3ls
9th November 2015, 15:43
Compiling wiothout my-sql will give me libcod2_1_0.so, however with segmentation fault


cod2_lnxded_1_0[9742]: segfault at 0 ip 0000000000a6bf1d sp 00000000ffd68e58 error 6 in libc-2.12.so[934000+190000]
cod2_lnxded_1_0[24555]: segfault at 0 ip 0000000000a6bf1d sp 00000000ffcd6958 error 6 in libc-2.12.so[934000+190000]
cod2_lnxded[31179]: segfault at 0 ip 0000000000a6bf1d sp 00000000ffb3a1c8 error 6 in libc-2.12.so[934000+190000]


Last 3 lines of "dmesg"

Ni3ls
10th November 2015, 10:32
I compiled the .so now using filthyfreaks files
http://killtube.org/showthread.php?2225-player-setAnim(string)&p=12104&viewfull=1#post12104

It results in a .so files with no segmentation fault. However, when I start a server, it says

******* script compile error *******
unknown function: (file 'maps/mp/gametypes/_weapons.gsc', line 1080)
return setweaponfiretime(id, time);



loadWeaponInfo(i, array)
{
array.id = i;
array.dmg = getweapondamage(i); // store baseline
array.meleedmg = getweaponmeleedamage(i); // in case you want to restore old value

if(i >= 64) // no viewmodels after 64th weapon
array.bugged = 1;
}

getWeaponArray(weapon)
{
if(isDefined(level.weapons[weapon]) && isDefined(level.weapons[weapon].id))
return level.weapons[weapon];
else if(isDefined(level.otherweapons[weapon]) && isDefined(level.otherweapons[weapon].id))
return level.otherweapons[weapon];
else
return undefined;
}

updateWepDamage(weapon, dmg)
{
array = getWeaponArray(weapon);
if(isDefined(array))
array.dmg = dmg;
}

updateWepMeleeDamage(weapon, dmg)
{
array = getWeaponArray(weapon);
if(isDefined(array))
array.meleedmg = dmg;
}

getWeaponId(weapon)
{
if(isDefined(level.weapons[weapon]) && isDefined(level.weapons[weapon].id))
return level.weapons[weapon].id;
else if(isDefined(level.otherweapons[weapon]) && isDefined(level.otherweapons[weapon].id))
return level.otherweapons[weapon].id;
else
return -1;
}

WeaponMaxAmmo(weapon)
{
id = getWeaponId(weapon);
if(id == -1)
return 0;

return getweaponmaxammo(id);
}

WeaponDamage(weapon)
{
id = getWeaponId(weapon);
if(id == -1)
return 0;

return getweapondamage(id);
}

WeaponMeleeDamage(weapon)
{
id = getWeaponId(weapon);
if(id == -1)
return 0;

return getweaponmeleedamage(id);
}

setWepDamage(weapon, dmg, isdefault)
{
id = getWeaponId(weapon);
if(id == -1)
return 0;

if(isDefined(isdefault) && isdefault)
updateWepDamage(weapon, dmg);

return setweapondamage(id, dmg);
}

setWepMeleeDamage(weapon, dmg, isdefault)
{
id = getWeaponId(weapon);
if(id == -1)
return 0;

if(isDefined(isdefault) && isdefault)
updateWepMeleeDamage(weapon, dmg);

return setweaponmeleedamage(id, dmg);
}

WeaponFireTime(weapon)
{
id = getWeaponId(weapon);
if(id == -1)
return 0;

return getweaponfiretime(id);
}

setWepFireTime(weapon, time)
{
id = getWeaponId(weapon);
if(id == -1)
return 0;

return setweaponfiretime(id, time);
}
Added to _weapons.gsc

Must I load or precache this script somewhere?

And in gsc.cpp I found this

{"getweaponfiretime" , gsc_utils_getweaponfiretime , 0},
{"setweaponfiretime" , gsc_utils_setweaponfiretime , 0},

So it should work right? Or am I missing something obvious

Ni3ls
10th November 2015, 18:57
Ok it gave me the error, because it didnt preload the libcod.so .... I thought it did.
Now preloading it will give me again segmentation fault.
Can somebody maybe compile filthyfreaks libcod version for me?

Mitch
10th November 2015, 21:13
This should make it easier to compile without mysql.

Add the following code to doit.sh

if [ "$2" == "no_mysql" ]; then
mysql_config=""
mysql_link=""
fi

After

if [ -d "./vendors/lib" ]; then
mysql_config=""
mysql_link="-lmysqlclient -L./vendors/lib"
fi

Now run


./doit.sh base
./doit.sh cod2_1_0 no_mysql

Ni3ls
11th November 2015, 09:09
Again error

> [INFO] Compiled for: CoD2 1.0
Compiled: Nov 11 2015 09:21:24
> [INFO] value of closer=08111d32
> [INFO] value of download=0808e508
./starttest2: line 1: 26998 Segmentation fault

with dmesg


cod2_lnxded_1_0[9742]: segfault at 0 ip 0000000000a6bf1d sp 00000000ffd68e58 error 6 in libc-2.12.so[934000+190000]
cod2_lnxded_1_0[24555]: segfault at 0 ip 0000000000a6bf1d sp 00000000ffcd6958 error 6 in libc-2.12.so[934000+190000]
cod2_lnxded[31179]: segfault at 0 ip 0000000000a6bf1d sp 00000000ffb3a1c8 error 6 in libc-2.12.so[934000+190000]
UDP: short packet: From 92.16.25.123:28960 2358/55 to 46.4.55.66:29957
cod2_lnxded[26436]: segfault at 0 ip 0000000000a6bf1d sp 00000000ff9850d8 error 6 in libc-2.12.so[934000+190000]
cod2_lnxded[27812]: segfault at 0 ip 0000000000a6bf1d sp 00000000ffef18d8 error 6 in libc-2.12.so[934000+190000]
cod2_lnxded[26998]: segfault at 0 ip 0000000000a6bf1d sp 00000000ffdfcb98 error 6 in libc-2.12.so[934000+190000]

IzNoGoD
11th November 2015, 09:31
are you sure you're running the correct cod2 1.0 version?

Ni3ls
11th November 2015, 11:13
Yes without libcod server runs fine

kung foo man
11th November 2015, 13:28
Since the crash was in libc (as the dmesg msg suggests) it could be a libc version conflict. I would try to build libcod against some old version.

If you would make me a ssh test account, I could try it out when I have time

IzNoGoD
11th November 2015, 13:28
Not what i meant.

Are you sure you're running the server file for which libcod was built?

Ni3ls
11th November 2015, 14:33
What do you mean Izno?

My server is running 1.0 and i compile against 1.0
In attachment i have my .so

@kung

Which old version do you suggest?

YuriJurek
11th November 2015, 16:07
As far as I am aware there is the stock server executable namely 1.0a and 1.0 (1.0a is just 1.0 with a few hotfixes), and there are also cracked executables, try and see if changing the executable file works.

Edit: By executable I mean the 'lnxded' file.

Mitch
11th November 2015, 17:12
Again error

> [INFO] Compiled for: CoD2 1.0
Compiled: Nov 11 2015 09:21:24
> [INFO] value of closer=08111d32
> [INFO] value of download=0808e508
./starttest2: line 1: 26998 Segmentation fault

with dmesg


cod2_lnxded_1_0[9742]: segfault at 0 ip 0000000000a6bf1d sp 00000000ffd68e58 error 6 in libc-2.12.so[934000+190000]
cod2_lnxded_1_0[24555]: segfault at 0 ip 0000000000a6bf1d sp 00000000ffcd6958 error 6 in libc-2.12.so[934000+190000]
cod2_lnxded[31179]: segfault at 0 ip 0000000000a6bf1d sp 00000000ffb3a1c8 error 6 in libc-2.12.so[934000+190000]
UDP: short packet: From 92.16.25.123:28960 2358/55 to 46.4.55.66:29957
cod2_lnxded[26436]: segfault at 0 ip 0000000000a6bf1d sp 00000000ff9850d8 error 6 in libc-2.12.so[934000+190000]
cod2_lnxded[27812]: segfault at 0 ip 0000000000a6bf1d sp 00000000ffef18d8 error 6 in libc-2.12.so[934000+190000]
cod2_lnxded[26998]: segfault at 0 ip 0000000000a6bf1d sp 00000000ffdfcb98 error 6 in libc-2.12.so[934000+190000]


Try adding printf messages to locate where libcod crashes. I'm currently unable to duplicate your crash.
The crash could be caused by the small differences between 1.0 versions.
I build my changes to libcod for 1.0 on the 1.0a version. So try a different 1.0 binary or upload your binary so that I can compare the versions.

COD2 binary versions: http://killtube.org/showthread.php?1719-Latest-cod2-linux-binaries-(1-0-1-2-1-3)

Ni3ls
12th November 2015, 08:16
I tried every lnxded file for 1.0. The one i want to use is in the attachments. It gives me this dmesg


cod2_lnxded_1_0[9742]: segfault at 0 ip 0000000000a6bf1d sp 00000000ffd68e58 error 6 in libc-2.12.so[934000+190000]
cod2_lnxded_1_0[24555]: segfault at 0 ip 0000000000a6bf1d sp 00000000ffcd6958 error 6 in libc-2.12.so[934000+190000]
cod2_lnxded[31179]: segfault at 0 ip 0000000000a6bf1d sp 00000000ffb3a1c8 error 6 in libc-2.12.so[934000+190000]
UDP: short packet: From 92.16.25.123:28960 2358/55 to 46.4.55.66:29957
cod2_lnxded[26436]: segfault at 0 ip 0000000000a6bf1d sp 00000000ff9850d8 error 6 in libc-2.12.so[934000+190000]
cod2_lnxded[27812]: segfault at 0 ip 0000000000a6bf1d sp 00000000ffef18d8 error 6 in libc-2.12.so[934000+190000]
cod2_lnxded[26998]: segfault at 0 ip 0000000000a6bf1d sp 00000000ffdfcb98 error 6 in libc-2.12.so[934000+190000]
cod2_lnxded_1_0[27535]: segfault at 0 ip 0000000000a6bf1d sp 00000000ff96c798 error 6 in libc-2.12.so[934000+190000]
cod2_lnxded_1_0[19086]: segfault at 0 ip 0000000000a6bf1d sp 00000000ffa60618 error 6 in libc-2.12.so[934000+190000]
cod2_lnxded_1_0[9453]: segfault at 0 ip 0000000000a6bf1d sp 00000000ffe80178 error 6 in libc-2.12.so[934000+190000]
cod2_lnxded_1_0[10971]: segfault at 0 ip 0000000000a6bf1d sp 00000000ff822778 error 6 in libc-2.12.so[934000+190000]


How to add iprints to libcod and spot the error?

voron00
12th November 2015, 17:33
Can you build it on other platform? E.g using Ubuntu live CD. It seems like some weird compiler/linker fault. Also try building from my repo, https://github.com/voron00/libcod, i've included filthy_freaks changes a while ago

voron00
13th November 2015, 18:30
Try it, built from my repo and i'm using it on my servers, but since you got a different libc, it may not work

Ni3ls
13th November 2015, 19:30
Works! Thanks man!