tpunix / kirk_engine

My version of kirk_engine
27 stars 15 forks source link

fail build on linux #2

Open sl1pkn07 opened 9 years ago

sl1pkn07 commented 9 years ago

when try to build kirk engine:

gcc -Wall -O2   -c -o ../common/utils.o ../common/utils.c
../common/utils.c:9:16: fatal error: io.h: No such file or directory

greetings

tpunix commented 9 years ago

kirk_engine are test under mingw. If you want build on linux, you can remove this header file.

sl1pkn07 commented 9 years ago

oh. thanks!

sl1pkn07 commented 9 years ago

with remove that file

└───╼  make
gcc -Wall -O2   -c -o kirk_engine.o kirk_engine.c
gcc -Wall -O2   -c -o crypto.o crypto.c
gcc -Wall -O2   -c -o amctrl.o amctrl.c
gcc -Wall -O2   -c -o bn.o bn.c
gcc -Wall -O2   -c -o ec.o ec.c
gcc -Wall -O2   -c -o ../common/utils.o ../common/utils.c
../common/utils.c: In function 'mkdir_p':
../common/utils.c:237:3: error: too few arguments to function 'mkdir'
   mkdir(name);
   ^
In file included from ../common/utils.c:8:0:
/usr/include/sys/stat.h:320:12: note: declared here
 extern int mkdir (const char *__path, __mode_t __mode)
        ^
<builtin>: recipe for target '../common/utils.o' failed
make: *** [../common/utils.o] Error 1

failed with GCC 5, GCC 4.9 and GCC 4.4

tpunix commented 9 years ago

use this: mkdir(name, 0777);

tpunix commented 9 years ago

mingw only have this format: mkdir(path)

sl1pkn07 commented 9 years ago

ok. now builds if uncomment the line https://github.com/tpunix/kirk_engine/blob/master/common/utils.c#L236 and comment out the line L237

but now fail build if build fake_np

http://sl1pkn07.wtf/paste/view/cf71c55c

greetings

sl1pkn07 commented 8 years ago

ok, finally i can build this on my linux!

diff --git a/common/utils.c b/common/utils.c
index 59494b4..c057985 100644
--- a/common/utils.c
+++ b/common/utils.c
@@ -6,7 +6,7 @@
 #include <stdlib.h>
 #include <dirent.h>
 #include <sys/stat.h>
-#include <io.h>
+//#include <io.h>

@@ -233,8 +233,8 @@ void mkdir_p(char *dname)
            break;

        *p = 0;
-       //mkdir(name, 0777);
-       mkdir(name);
+       mkdir(name, 0777);
+       //mkdir(name);
        *p = '/';
        cp = p+1;
    };
diff --git a/common/utils.h b/common/utils.h
index 0ce05eb..c34bbd8 100644
--- a/common/utils.h
+++ b/common/utils.h
@@ -5,6 +5,8 @@
 #define MIN(a, b) (((a) < (b)) ? (a) : (b))
 #define NELEMS(a) (sizeof(a) / sizeof(a[0]))

+typedef unsigned char u8;
+
 void hex_dump(const char *str, void *addr, int size);

diff --git a/fake_np/Makefile b/fake_np/Makefile
index 1624e8c..686649c 100644
--- a/fake_np/Makefile
+++ b/fake_np/Makefile
@@ -1,5 +1,5 @@
 CC = gcc
-CFLAGS = -Wall -I../kirk -I../common
+CFLAGS = -Wall -I../kirk -I../common -Wl,--allow-multiple-definition
 TARGET = fake_np
 OBJS = fake_np.o isoreader.o ../common/utils.o ../npdpc/tlzrc.o

diff --git a/fake_np/fake_np.c b/fake_np/fake_np.c
index 64d8373..9c60cb3 100644
--- a/fake_np/fake_np.c
+++ b/fake_np/fake_np.c
@@ -8,6 +8,8 @@
 #include <string.h>
 #include "utils.h"

+typedef unsigned char u8;
+
 #include "kirk_engine.h"
 #include "amctrl.h"

diff --git a/fake_np/isoreader.c b/fake_np/isoreader.c
index 4730f87..cd477de 100644
--- a/fake_np/isoreader.c
+++ b/fake_np/isoreader.c
@@ -296,7 +296,7 @@ static int findFile(const char * file, u32 lba, u32 dir_size, u32 is_dir, Iso966

            if (0 == strcmp(name, file)) {
                if (is_dir) {
-                   if(!rec->fileFlags & ISO9660_FILEFLAGS_DIR) {
+                   if(!rec->fileFlags && ISO9660_FILEFLAGS_DIR) {
                        return -14;
                    }
                }
diff --git a/npdpc/tlzrc.c b/npdpc/tlzrc.c
index bcb98d1..50395ca 100644
--- a/npdpc/tlzrc.c
+++ b/npdpc/tlzrc.c
@@ -6,6 +6,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <malloc.h>
+#include <stdlib.h>

 /*************************************************************/

and get this output:

└───╼  LANG=C make
gcc -Wall -O2   -c -o kirk_engine.o kirk_engine.c
gcc -Wall -O2   -c -o crypto.o crypto.c
gcc -Wall -O2   -c -o amctrl.o amctrl.c
amctrl.c: En la función ‘sceNpDrmGetFixedKey’:
amctrl.c:670:9: aviso: ‘strncpy’ specified bound 48 equals destination size [-Wstringop-truncation]
  670 |         strncpy(strbuf, npstr, 0x30);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
gcc -Wall -O2   -c -o bn.o bn.c
gcc -Wall -O2   -c -o ec.o ec.c
gcc -Wall -O2   -c -o ../common/utils.o ../common/utils.c
ar rcs libkirk.a kirk_engine.o crypto.o amctrl.o bn.o ec.o ../common/utils.o
└───╼  LC_ALL=C make
gcc -Wall -I../kirk -I../common -Wl,--allow-multiple-definition -O2   -c -o fake_np.o fake_np.c
gcc -Wall -I../kirk -I../common -Wl,--allow-multiple-definition -O2   -c -o isoreader.o isoreader.c
isoreader.c: In function 'isoOpen':
isoreader.c:422:62: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  422 |                                 printf("malloc -> 0x%08x\n", (u32)g_ciso_dec_buf);
      |                                                              ^
gcc -Wall -I../kirk -I../common -Wl,--allow-multiple-definition -O2   -c -o ../npdpc/tlzrc.o ../npdpc/tlzrc.c
../npdpc/tlzrc.c: In function 're_bit':
../npdpc/tlzrc.c:368:12: warning: variable 'old_p' set but not used [-Wunused-but-set-variable]
  368 |         u8 old_p;
      |            ^~~~~
../npdpc/tlzrc.c:367:13: warning: variable 'old_r' set but not used [-Wunused-but-set-variable]
  367 |         u32 old_r, old_c;
      |             ^~~~~
../npdpc/tlzrc.c: In function 'insert_node':
../npdpc/tlzrc.c:514:19: warning: variable 'win' set but not used [-Wunused-but-set-variable]
  514 |         u8 *src, *win;
      |                   ^~~
../npdpc/tlzrc.c: At top level:
../npdpc/tlzrc.c:659:13: warning: 're_find_match' defined but not used [-Wunused-function]
  659 | static void re_find_match(LZRC_DECODE *re, int *match_len, int *match_dist)
      |             ^~~~~~~~~~~~~
gcc -Wall -I../kirk -I../common -Wl,--allow-multiple-definition -O2 -o fake_np fake_np.o isoreader.o ../common/utils.o ../npdpc/tlzrc.o -L ../kirk -lkirk -lz

is safe?

greetings