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

Linux compiling


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Neeeeeeeeeel.-
Some Guy Yellin'
Join Date: Jul 2010
Location: Argentina
Old 07-06-2014 , 15:09   Linux compiling
Reply With Quote #1

I'm trying to compile this module under Linux... I never compiled a module under Linux before...

I run:
Code:
gcc -shared -I hlsdk/dlls -I hlsdk/public -I hlsdk/common -I hlsdk/engine -I metamod Host_Status.cpp
Output:
Code:
In file included from Host_Status.cpp:4:0:
chooker.h: In member function ‘void* CMemory::GetLibraryFromName(char*)’:
chooker.h:477:22: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
      return ( void* )baseaddress;
                      ^
chooker.h: In member function ‘void* CFunc::Hook(void*, BOOL)’:
chooker.h:641:26: error: cast from ‘void*’ to ‘unsigned int’ loses precision [-fpermissive]
     *p = ( unsigned int )dst - ( unsigned int )address - 5;
                          ^
chooker.h:641:48: error: cast from ‘void*’ to ‘unsigned int’ loses precision [-fpermissive]
     *p = ( unsigned int )dst - ( unsigned int )address - 5;
                                                ^
chooker.h: In function ‘int dl_callback(dl_phdr_info*, size_t, void*)’:
chooker.h:926:35: error: cast from ‘char*’ to ‘unsigned int’ loses precision [-fpermissive]
      if( ismain && ( uint32 )obj->baseadd > IAlign( info->dlpi_phdr[i].p_vaddr ) )
                                   ^
chooker.h:927:66: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
       obj->baseadd = ( char* )IAlign( info->dlpi_phdr[i].p_vaddr );
                                                                  ^
chooker.h:929:25: error: cast from ‘char*’ to ‘unsigned int’ loses precision [-fpermissive]
      if( ( uint32 )obj->endadd < ( info->dlpi_phdr[i].p_vaddr + info->dlpi_phdr[i].p_memsz ) )
                         ^
chooker.h:930:99: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
       obj->endadd = ( char* )IAlign2( ( info->dlpi_phdr[i].p_vaddr + info->dlpi_phdr[i].p_memsz ) );
                                                                                                   ^
chooker.h:936:23: error: cast from ‘char*’ to ‘int’ loses precision [-fpermissive]
    return ( int )obj->baseadd;
                       ^
Host_Status.cpp: In function ‘int Meta_Query(char*, plugin_info_t**, mutil_funcs_t*)’:
Host_Status.cpp:96:98: error: declaration of C function ‘int Meta_Query(char*, plugin_info_t**, mutil_funcs_t*)’ conflicts with
 C_DLLEXPORT int Meta_Query(char *ifvers, plugin_info_t **pPlugInfo, mutil_funcs_t *pMetaUtilFuncs)
                                                                                                  ^
In file included from Host_Status.cpp:2:0:
metamod/meta_api.h:134:17: error: previous declaration ‘int Meta_Query(const char*, plugin_info_t**, mutil_funcs_t*)’ here
 C_DLLEXPORT int Meta_Query(const char *interfaceVersion,
Any help?
__________________
Neeeeeeeeeel.- is offline
Send a message via Skype™ to Neeeeeeeeeel.-
Bos93
Veteran Member
Join Date: Jul 2010
Old 07-06-2014 , 15:45   Re: Linux compiling
Reply With Quote #2

PHP Code:
    #ifdef _WIN32 
        
FuncHost_Status_fOrig Hooker->MemorySearchFuncHost_Status_f >( "0x55,0x8B,0xEC,0x81,0xEC,*,*,*,*,0xA1,*,*,*,*,0x53,0x56,0x57,0xBF,*,*,*,*,0x33,0xDB,0x8B,0xF7,0x3B,0xC7,0x89,0x5D,0xE4,0x89,0x5D,0xDC,0x89,0x5D,0xE8,0x89,0x5D,0xF8,0x89,0x75,0xFC,0xC7,0x45,0xF4,0x50,0xCF", ( void* )gpGlobalsFALSE );
    
#else
        
FuncHost_Status_fOrig Hooker->MemorySearchFuncHost_Status_f >( "Host_Status_f", ( void* )gpGlobalsTRUE );
    
#endif 
PHP Code:
#(C)2004-2005 AMX Mod X Development Team
# Makefile written by David "BAILOPAN" Anderson

HLSDK = ../hlsdk
MM_ROOT 
= ../metamod

### EDIT BELOW FOR OTHER PROJECTS ###

OPT_FLAGS = -O2 -funroll-loops --pipe -fomit-frame-pointer -fno-strict-aliasing
DEBUG_FLAGS 
= --ggdb3
CPP 
g++
NAME Host_Status

BIN_SUFFIX_32 
i386.so
BIN_SUFFIX_64 
amd64.so

OBJECTS 
Host_Status.cpp


LINK 
=

INCLUDE = -
I. -I$(HLSDK) -I$(HLSDK)/dlls -I$(HLSDK)/engine -I$(HLSDK)/game_shared -I$(HLSDK)/game_shared \
    -
I$(MM_ROOT) -I$(HLSDK)/common -I$(HLSDK)/pm_shared -Isdk -Iinclude

GCC_VERSION 
:= $(shell $(CPP) -dumpversion >&cut -b1)


ifeq "$(DEBUG)" "true"
    
BIN_DIR Debug
    CFLAGS 
= $(DEBUG_FLAGS)
else
    
BIN_DIR Release
    CFLAGS 
= $(OPT_FLAGS)
endif

CFLAGS += -lm -ldl -static -static-libstdc++ -std=c++11 -Dlinux -D__linux__ -DNDEBUG -Wall -Wno-char-subscripts -Wno-unknown-pragmas -Wno-write-strings -Wno-deprecated -Wno-non-virtual-dtor -fno-exceptions -DHAVE_STDINT_H -fno-rtti -m32

ifeq 
"$(AMD64)" "true"
    
BINARY = $(NAME)_$(BIN_SUFFIX_64)
    
CFLAGS += -DPAWN_CELL_SIZE=64 -DHAVE_I64 -m64 
else
    
BINARY = $(NAME)_$(BIN_SUFFIX_32)
    
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32
    OPT_FLAGS 
+= -march=i586
endif

OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)

$(
BIN_DIR)/%.o: %.cpp
    
$(CPP) $(INCLUDE) $(CFLAGS) -$@ -$<

all:
    
mkdir -$(BIN_DIR)
    
mkdir -$(BIN_DIR)/sdk
    
$(MAKEHost_Status

amd64
:
    $(
MAKEall AMD64=true

Host_Status
: $(OBJ_LINUX)
    $(
CPP) $(INCLUDE) $(CFLAGS) $(OBJ_LINUX) $(LINK) -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)

debug:    
    $(
MAKEall DEBUG=true

default: all

clean
:
    
rm -rf $(BIN_DIR)/sdk/*.o
    rm -rf $(BIN_DIR)/*.o
    rm -rf $(BIN_DIR)/$(NAME)_$(BIN_SUFFIX_32)
    rm -rf $(BIN_DIR)/$(NAME)_$(BIN_SUFFIX_64) 
Attached Files
File Type: so Host_Status_i386.so (12.0 KB, 225 views)
__________________
Bos93 is offline
Send a message via ICQ to Bos93 Send a message via Skype™ to Bos93
Neeeeeeeeeel.-
Some Guy Yellin'
Join Date: Jul 2010
Location: Argentina
Old 07-06-2014 , 16:56   Re: Linux compiling
Reply With Quote #3

I tried to execute the Makefile but...
Code:
nelson@nelson:~/Escritorio/status$ make
mkdir -p Release
mkdir -p Release/sdk
make Host_Status
make[1]: Entering directory «/home/nelson/Escritorio/status»
make[1]: *** No rule to make target «Release/Host_Status.o», needed by «Host_Status». Stop
make[1]: Leaving directory «/home/nelson/Escritorio/status»
make: *** [all] Error 2
__________________
Neeeeeeeeeel.- is offline
Send a message via Skype™ to Neeeeeeeeeel.-
Bos93
Veteran Member
Join Date: Jul 2010
Old 07-06-2014 , 18:14   Re: Linux compiling
Reply With Quote #4

You rename Host_Status.cpp?
__________________
Bos93 is offline
Send a message via ICQ to Bos93 Send a message via Skype™ to Bos93
Neeeeeeeeeel.-
Some Guy Yellin'
Join Date: Jul 2010
Location: Argentina
Old 07-06-2014 , 18:25   Re: Linux compiling
Reply With Quote #5

No, but I managed to fix it.

Now I got
Code:
g++ -I. -Ihlsdk -Ihlsdk/dlls -Ihlsdk/engine -Ihlsdk/public -Ihlsdk/game_shared -Ihlsdk/game_shared -Imetamod -Ihlsdk/common -Ihlsdk/pm_shared -Isdk -Iinclude -I/usr/lib/syslinux/com32/include -I/usr/include/x86_64-linux-gnu/ -O2 -funroll-loops -s -pipe -fomit-frame-pointer -fno-strict-aliasing -march=i586 -lm -ldl -static -static-libstdc++ -std=c++11 -Dlinux -D__linux__ -DNDEBUG -Wall -Wno-char-subscripts -Wno-unknown-pragmas -Wno-write-strings -Wno-deprecated -Wno-non-virtual-dtor -fno-exceptions -DHAVE_STDINT_H -fno-rtti -m32 -DPAWN_CELL_SIZE=32 -DJIT -DASM32 -o Release/Host_Status.o -c Host_Status.cpp
In file included from hlsdk/dlls/extdll.h:95:0,
                 from Host_Status.cpp:1:
hlsdk/dlls/vector.h: In member function ‘float Vector2D::Length() const’:
hlsdk/dlls/vector.h:32:63: error: ‘sqrt’ was not declared in this scope
  inline float Length(void)      const { return sqrt(x*x + y*y );  }
                                                               ^
hlsdk/dlls/vector.h: In member function ‘float Vector::Length() const’:
hlsdk/dlls/vector.h:80:67: error: ‘sqrt’ was not declared in this scope
  inline float Length(void) const     { return sqrt(x*x + y*y + z*z); }
                                                                   ^
hlsdk/dlls/vector.h: In member function ‘float Vector::Length2D() const’:
hlsdk/dlls/vector.h:100:63: error: ‘sqrt’ was not declared in this scope
  inline float Length2D(void) const     { return sqrt(x*x + y*y); }
                                                               ^
In file included from metamod/osdep.h:41:0,
                 from metamod/dllapi.h:41,
                 from metamod/meta_api.h:40,
                 from Host_Status.cpp:2:
/usr/lib/syslinux/com32/include/ctype.h: At global scope:
/usr/lib/syslinux/com32/include/ctype.h:120:55: error: expected ‘,’ or ‘...’ before ‘new’
 __extern void chrreplace(char *source, char old, char new);
                                                       ^
In file included from chooker.h:39:0,
                 from Host_Status.cpp:4:
/usr/include/x86_64-linux-gnu/sys/mman.h:29:17: error: conflicting declaration ‘typedef __off_t off_t’
 typedef __off_t off_t;
                 ^
In file included from /usr/lib/syslinux/com32/include/sys/stat.h:8:0,
                 from hlsdk/public/archtypes.h:12,
                 from hlsdk/dlls/extdll.h:49,
                 from Host_Status.cpp:1:
/usr/lib/syslinux/com32/include/sys/types.h:14:16: error: ‘off_t’ has a previous declaration as ‘typedef size_t off_t’
 typedef size_t off_t;
                ^
In file included from chooker.h:39:0,
                 from Host_Status.cpp:4:
/usr/include/x86_64-linux-gnu/sys/mman.h:37:18: error: conflicting declaration ‘typedef __mode_t mode_t’
 typedef __mode_t mode_t;
                  ^
In file included from /usr/lib/syslinux/com32/include/sys/stat.h:8:0,
                 from hlsdk/public/archtypes.h:12,
                 from hlsdk/dlls/extdll.h:49,
                 from Host_Status.cpp:1:
/usr/lib/syslinux/com32/include/sys/types.h:13:13: error: ‘mode_t’ has a previous declaration as ‘typedef int mode_t’
 typedef int mode_t;
             ^
In file included from Host_Status.cpp:4:0:
chooker.h: In function ‘void* Align(void*)’:
chooker.h:63:28: error: ‘_SC_PAGESIZE’ was not declared in this scope
   #define PAGESIZE sysconf(_SC_PAGESIZE)
                            ^
chooker.h:68:42: note: in expansion of macro ‘PAGESIZE’
   return ( void* )( ( long )address & ~( PAGESIZE - 1 ) );
                                          ^
chooker.h:63:40: error: ‘sysconf’ was not declared in this scope
   #define PAGESIZE sysconf(_SC_PAGESIZE)
                                        ^
chooker.h:68:42: note: in expansion of macro ‘PAGESIZE’
   return ( void* )( ( long )address & ~( PAGESIZE - 1 ) );
                                          ^
chooker.h: In function ‘unsigned int IAlign(unsigned int)’:
chooker.h:63:28: error: ‘_SC_PAGESIZE’ was not declared in this scope
   #define PAGESIZE sysconf(_SC_PAGESIZE)
                            ^
chooker.h:73:25: note: in expansion of macro ‘PAGESIZE’
   return ( address & ~( PAGESIZE - 1 ) );
                         ^
chooker.h:63:40: error: ‘sysconf’ was not declared in this scope
   #define PAGESIZE sysconf(_SC_PAGESIZE)
                                        ^
chooker.h:73:25: note: in expansion of macro ‘PAGESIZE’
   return ( address & ~( PAGESIZE - 1 ) );
                         ^
chooker.h: In function ‘unsigned int IAlign2(unsigned int)’:
chooker.h:63:28: error: ‘_SC_PAGESIZE’ was not declared in this scope
   #define PAGESIZE sysconf(_SC_PAGESIZE)
                            ^
chooker.h:78:32: note: in expansion of macro ‘PAGESIZE’
   return ( IAlign( address ) + PAGESIZE );
                                ^
chooker.h:63:40: error: ‘sysconf’ was not declared in this scope
   #define PAGESIZE sysconf(_SC_PAGESIZE)
                                        ^
chooker.h:78:32: note: in expansion of macro ‘PAGESIZE’
   return ( IAlign( address ) + PAGESIZE );
                                ^
chooker.h: In member function ‘void CMemory::SetupSignature(char*)’:
chooker.h:218:11: warning: value computed is not used [-Wunused-value]
      *s1++;
           ^
chooker.h:219:11: warning: value computed is not used [-Wunused-value]
      *s2++;
           ^
chooker.h:224:11: warning: value computed is not used [-Wunused-value]
      *s1++;
           ^
chooker.h:240:11: warning: value computed is not used [-Wunused-value]
      *s2++;
           ^
chooker.h: In member function ‘BOOL CFunc::Patch()’:
chooker.h:63:28: error: ‘_SC_PAGESIZE’ was not declared in this scope
   #define PAGESIZE sysconf(_SC_PAGESIZE)
                            ^
chooker.h:663:51: note: in expansion of macro ‘PAGESIZE’
     if( memFunc->ChangeMemoryProtection( address, PAGESIZE, PAGE_EXECUTE_READWRITE ) )
                                                   ^
chooker.h:63:40: error: ‘sysconf’ was not declared in this scope
   #define PAGESIZE sysconf(_SC_PAGESIZE)
                                        ^
chooker.h:663:51: note: in expansion of macro ‘PAGESIZE’
     if( memFunc->ChangeMemoryProtection( address, PAGESIZE, PAGE_EXECUTE_READWRITE ) )
                                                   ^
chooker.h: In member function ‘BOOL CFunc::Restore()’:
chooker.h:63:28: error: ‘_SC_PAGESIZE’ was not declared in this scope
   #define PAGESIZE sysconf(_SC_PAGESIZE)
                            ^
chooker.h:678:51: note: in expansion of macro ‘PAGESIZE’
     if( memFunc->ChangeMemoryProtection( address, PAGESIZE, PAGE_EXECUTE_READWRITE ) )
                                                   ^
chooker.h:63:40: error: ‘sysconf’ was not declared in this scope
   #define PAGESIZE sysconf(_SC_PAGESIZE)
                                        ^
chooker.h:678:51: note: in expansion of macro ‘PAGESIZE’
     if( memFunc->ChangeMemoryProtection( address, PAGESIZE, PAGE_EXECUTE_READWRITE ) )
                                                   ^
Host_Status.cpp: In function ‘int Meta_Query(char*, plugin_info_t**, mutil_funcs_t*)’:
Host_Status.cpp:96:98: error: declaration of C function ‘int Meta_Query(char*, plugin_info_t**, mutil_funcs_t*)’ conflicts with
 C_DLLEXPORT int Meta_Query(char *ifvers, plugin_info_t **pPlugInfo, mutil_funcs_t *pMetaUtilFuncs)
                                                                                                  ^
In file included from Host_Status.cpp:2:0:
metamod/meta_api.h:134:17: error: previous declaration ‘int Meta_Query(const char*, plugin_info_t**, mutil_funcs_t*)’ here
 C_DLLEXPORT int Meta_Query(const char *interfaceVersion, 
                 ^
In file included from Host_Status.cpp:4:0:
chooker.h: In function ‘unsigned int IAlign(unsigned int)’:
chooker.h:74:2: warning: control reaches end of non-void function [-Wreturn-type]
  }
  ^
chooker.h: In function ‘unsigned int IAlign2(unsigned int)’:
chooker.h:79:2: warning: control reaches end of non-void function [-Wreturn-type]
  }
  ^
chooker.h: In function ‘void* Align(void*)’:
chooker.h:69:2: warning: control reaches end of non-void function [-Wreturn-type]
  }
  ^
make[1]: *** [Release/Host_Status.o] Error 1
Edit: Nvm, I did it with orpheu, it's easier.
__________________

Last edited by Neeeeeeeeeel.-; 07-07-2014 at 19:47.
Neeeeeeeeeel.- is offline
Send a message via Skype™ to Neeeeeeeeeel.-
Old 07-07-2014, 19:46
Neeeeeeeeeel.-
This message has been deleted by Neeeeeeeeeel.-.
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 01:09.


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