Linux kernel programming - linux-kernel

i want to catch pipe() syscall, so i've changed source code in pipe.c
static pipe_hook_t pipe_hook;
pipe_hook_t set_pipe_hook(pipe_hook_t hook)
{
pipe_hook_t old_hook = pipe_hook;
pipe_hook = hook;
printk(KERN_INFO, "pipe hook: %p", hook);
return old_hook;
}
EXPORT_SYMBOL_GPL(set_pipe_hook);
then i tried to define pipe_hook_t in file syscalls.h (included in pipe.c)
typedef void (*pipe_hook_t)(int *filedes);
pipe_hook_t set_pipe_hook(pipe_hook_t hook);
and i have error:
fs/pipe.c:1130: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘pipe_hook’
fs/pipe.c:1131: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘set_pipe_hook’
fs/pipe.c:1138: error: ‘set_pipe_hook’ undeclared here (not in a function)
fs/pipe.c:1138: warning: type defaults to ‘int’ in declaration of ‘set_pipe_hook’
fs/pipe.c: In function ‘sys_pipe2’:
fs/pipe.c:1153: error: ‘pipe_hook’ undeclared (first use in this function)
fs/pipe.c:1153: error: (Each undeclared identifier is reported only once
fs/pipe.c:1153: error: for each function it appears in.)
fs/pipe.c:1154: error: implicit declaration of function ‘pipe_hook’
i've tried to create my own .h file and define pipe_hook_t there but the error was the same

Problem has been solved. I've just confused directory where header files are.

Related

error ‘underlying_type_t’ in namespace ‘std’ does not name a template type in example.cpp from project-OSRM

I try to execute the examle.cpp file of Project-OSRM. I did the following steps:
build OSRM from source as described here
in new terminal: cd osrm-backend/example
in the terminal: cmake ..
in the terminal: cmake --build .
in the terminal: sudo cmake --build . --target install
move the maps contractor, engine, extractor, partition, storage, util from /usr/local/include/osrm to /usr/local/include (else error maps are not in /usr/local/include)
in the terminal: g++ -std=c++11 example.cpp -o example
But I get the error
‘underlying_type_t’ in namespace ‘std’ does not name a template type
static_cast<std::underlying_type_t<RouteParameters::AnnotationsType>>
Does anyone have a idea what I'm doing wrong or what is going wrong and how to solve this?
Error message
In file included from /usr/local/include/engine/api/match_parameters.hpp:31:0,
from /usr/local/include/osrm/match_parameters.hpp:31,
from example.cpp:1:
/usr/local/include/engine/api/route_parameters.hpp: In function ‘bool osrm::engine::api::operator&(osrm::engine::api::RouteParameters::AnnotationsType, osrm::engine::api::RouteParameters::AnnotationsType)’:
/usr/local/include/engine/api/route_parameters.hpp:144:26: error: ‘underlying_type_t’ in namespace ‘std’ does not name a template type
static_cast<std::underlying_type_t<RouteParameters::AnnotationsType>>(l
^
/usr/local/include/engine/api/route_parameters.hpp:144:43: error: expected ‘>’ before ‘<’ token
static_cast<std::underlying_type_t<RouteParameters::AnnotationsType>>(l
^
/usr/local/include/engine/api/route_parameters.hpp:144:43: error: expected ‘(’ before ‘<’ token
/usr/local/include/engine/api/route_parameters.hpp:144:43: error: expected primary-expression before ‘<’ token
/usr/local/include/engine/api/route_parameters.hpp:144:76: error: expected primary-expression before ‘>>’ token
static_cast<std::underlying_type_t<RouteParameters::AnnotationsType>>(lhs) &
^
/usr/local/include/engine/api/route_parameters.hpp:145:26: error: ‘underlying_type_t’ in namespace ‘std’ does not name a template type
static_cast<std::underlying_type_t<RouteParameters::AnnotationsType>>(r
^
/usr/local/include/engine/api/route_parameters.hpp:145:43: error: expected ‘>’ before ‘<’ token
static_cast<std::underlying_type_t<RouteParameters::AnnotationsType>>(r
^
/usr/local/include/engine/api/route_parameters.hpp:145:43: error: expected ‘(’ before ‘<’ token
/usr/local/include/engine/api/route_parameters.hpp:145:43: error: expected primary-expression before ‘<’ token
/usr/local/include/engine/api/route_parameters.hpp:145:76: error: expected primary-expression before ‘>>’ token
static_cast<std::underlying_type_t<RouteParameters::AnnotationsType>>(rhs));
^
/usr/local/include/engine/api/route_parameters.hpp:145:84: error: expected ‘)’ before ‘;’ token
static_cast<std::underlying_type_t<RouteParameters::AnnotationsType>>(rhs));
^
/usr/local/include/engine/api/route_parameters.hpp:145:84: error: expected ‘)’ before ‘;’ token
/usr/local/include/engine/api/route_parameters.hpp: In function ‘osrm::engine::api::RouteParameters::AnnotationsType osrm::engine::api::operator|(osrm::engine::api::RouteParameters::AnnotationsType, osrm::engine::api::RouteParameters::AnnotationsType)’:
/usr/local/include/engine/api/route_parameters.hpp:152:26: error: ‘underlying_type_t’ in namespace ‘std’ does not name a template type
static_cast<std::underlying_type_t<RouteParameters::AnnotationsType>>(l
^
/usr/local/include/engine/api/route_parameters.hpp:152:43: error: expected ‘>’ before ‘<’ token
static_cast<std::underlying_type_t<RouteParameters::AnnotationsType>>(l
^
/usr/local/include/engine/api/route_parameters.hpp:152:43: error: expected ‘(’ before ‘<’ token
/usr/local/include/engine/api/route_parameters.hpp:152:43: error: expected primary-expression before ‘<’ token
/usr/local/include/engine/api/route_parameters.hpp:152:76: error: expected primary-expression before ‘>>’ token
static_cast<std::underlying_type_t<RouteParameters::AnnotationsType>>(lhs) |
^
/usr/local/include/engine/api/route_parameters.hpp:153:26: error: ‘underlying_type_t’ in namespace ‘std’ does not name a template type
static_cast<std::underlying_type_t<RouteParameters::AnnotationsType>>(r
^
/usr/local/include/engine/api/route_parameters.hpp:153:43: error: expected ‘>’ before ‘<’ token
static_cast<std::underlying_type_t<RouteParameters::AnnotationsType>>(r
^
/usr/local/include/engine/api/route_parameters.hpp:153:43: error: expected ‘(’ before ‘<’ token
/usr/local/include/engine/api/route_parameters.hpp:153:43: error: expected primary-expression before ‘<’ token
/usr/local/include/engine/api/route_parameters.hpp:153:76: error: expected primary-expression before ‘>>’ token
static_cast<std::underlying_type_t<RouteParameters::AnnotationsType>>(rhs));
^
/usr/local/include/engine/api/route_parameters.hpp:153:84: error: expected ‘)’ before ‘;’ token
static_cast<std::underlying_type_t<RouteParameters::AnnotationsType>>(rhs));
^
/usr/local/include/engine/api/route_parameters.hpp:153:84: error: expected ‘)’ before ‘;’ token
underlying_type_t requires C++14. To be able to use it pass -std=c++14 to your compiler.
Don't forget to
#include <type_traits>
This missing directive also lead to the same (confusing) error message.

EGlib 2.6.20 does not install (trying to install SCIP)

I am trying to solve an integer linear program using SCIP. The beta version that I require (for exact solving) is given at:
http://scip.zib.de/#exact
As linked there, the source code is at:
http://scip.zib.de/download.php?fname=scip-3.0.0-ex.tgz
I followed the INSTALL file. It requires the installation of EGlib 2.6.20. However, this installation fails during 'make' with the following error:
phani#OptiPlex-9030-AIO ~/EGlib-2.6.20 $ make
make[1]: Entering directory '/home/phani/EGlib-2.6.20'
make[1]: Leaving directory '/home/phani/EGlib-2.6.20'
make[1]: Entering directory '/home/phani/EGlib-2.6.20'
Building include/EGlib.h
Compiling src/eg_bit.c
Compiling src/eg_compare.c
Compiling src/eg_io.c
src/eg_io.c: In function ‘EGioGets’:
src/eg_io.c:618:7: warning: unused variable ‘b’ [-Wunused-variable]
char*b = buf;
^
src/eg_io.c: In function ‘EGioEof’:
src/eg_io.c:648:6: warning: unused variable ‘err’ [-Wunused-variable]
int err;
^
src/eg_io.c: In function ‘EGmvar’:
src/eg_io.c:42:2: warning: second parameter of ‘va_start’ not last named argument [-Wvarargs]
va_start (largs, nind);
^
Compiling src/eg_lpnum.c
Compiling src/eg_net.c
Compiling src/eg_random.c
Compiling src/eg_macros.c
Compiling src/eg_ehash.c
Compiling src/eg_perm_it.c
Compiling src/eg_symtab.c
Compiling src/eg_keytab.c
Compiling src/eg_simula.c
In file included from src/eg_simula.c:25:0:
src/eg_simula.h:227:2: error: unknown type name ‘dbl_EGeHeapCn_t’
dbl_EGeHeapCn_t heap_cn;/**< connector in the heap containing the agent */
^
src/eg_simula.h:240:2: error: unknown type name ‘dbl_EGeHeap_t’
dbl_EGeHeap_t hp; /**< Heap containing events to be processed */
^
src/eg_simula.c: In function ‘EGsimExp’:
src/eg_simula.c:29:30: warning: unused parameter ‘t’ [-Wunused-parameter]
double EGsimExp(const double t, void*const data)
^
src/eg_simula.c: In function ‘EGsimUniform’:
src/eg_simula.c:40:34: warning: unused parameter ‘t’ [-Wunused-parameter]
double EGsimUniform(const double t, void*const data)
^
src/eg_simula.c: In function ‘EGsimNormal’:
src/eg_simula.c:51:33: warning: unused parameter ‘t’ [-Wunused-parameter]
double EGsimNormal(const double t, void*const data)
^
In file included from src/eg_simula.c:25:0:
src/eg_simula.c: In function ‘EGsimNewEvent’:
src/eg_simula.h:277:2: warning: implicit declaration of function ‘dbl_EGeHeapCnInit’ [-Wimplicit-function-declaration]
dbl_EGeHeapCnInit(&(__EGsimA->heap_cn));\
^
src/eg_simula.c:73:2: note: in expansion of macro ‘EGsimSetAgent’
EGsimSetAgent(la,sim->cur_time + gen->gen(sim->cur_time,gen->data));
^
src/eg_simula.c:74:13: error: request for member ‘val’ in something not a structure or union
la->heap_cn.val = la->last_time;
^
src/eg_simula.c:77:12: error: request for member ‘sz’ in something not a structure or union
if(sim->hp.sz == sim->hp.max_sz)
^
src/eg_simula.c:77:26: error: request for member ‘max_sz’ in something not a structure or union
if(sim->hp.sz == sim->hp.max_sz)
^
src/eg_simula.c:78:3: warning: implicit declaration of function ‘dbl_EGeHeapResize’ [-Wimplicit-function-declaration]
dbl_EGeHeapResize(&(sim->hp),sim->hp.sz*2);
^
src/eg_simula.c:78:39: error: request for member ‘sz’ in something not a structure or union
dbl_EGeHeapResize(&(sim->hp),sim->hp.sz*2);
^
src/eg_simula.c:80:9: warning: implicit declaration of function ‘dbl_EGeHeapAdd’ [-Wimplicit-function-declaration]
rval = dbl_EGeHeapAdd(&(sim->hp),&(la->heap_cn));
^
In file included from src/eg_simula.h:47:0,
from src/eg_simula.c:25:
src/eg_simula.c:85:55: error: request for member ‘val’ in something not a structure or union
MESSAGE(EG_SIM_VERBOSE,"new Agent at %lf",la->heap_cn.val);
^
src/eg_macros.h:246:18: note: in definition of macro ‘MESSAGE’
fprintf(stderr,__VA_ARGS__);\
^
In file included from src/eg_simula.h:47:0,
from src/eg_simula.c:25:
src/eg_simula.c: In function ‘EGsim’:
src/eg_simula.c:284:22: warning: implicit declaration of function ‘dbl_EGeHeapGetMin’ [-Wimplicit-function-declaration]
ca = EGcontainerOf(dbl_EGeHeapGetMin(&(sim->hp)), EGsimAgent_t,heap_cn);
^
src/eg_macros.h:134:56: note: in definition of macro ‘EGcontainerOf’
typeof(((__type *)0)->__member) *const __EGcOf_ptr = (__ptr);\
^
src/eg_macros.h:134:55: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
typeof(((__type *)0)->__member) *const __EGcOf_ptr = (__ptr);\
^
src/eg_simula.c:284:8: note: in expansion of macro ‘EGcontainerOf’
ca = EGcontainerOf(dbl_EGeHeapGetMin(&(sim->hp)), EGsimAgent_t,heap_cn);
^
src/eg_simula.c:285:30: error: request for member ‘val’ in something not a structure or union
sim->cur_time = ca->heap_cn.val;
^
src/eg_simula.c:327:17: error: request for member ‘val’ in something not a structure or union
na->heap_cn.val = sim->cur_time + cn->gen(sim->cur_time,cn->data);
^
src/eg_simula.c:328:6: warning: implicit declaration of function ‘dbl_EGeHeapSiftUp’ [-Wimplicit-function-declaration]
dbl_EGeHeapSiftUp(&(sim->hp),&(na->heap_cn));
^
src/eg_simula.c:365:17: error: request for member ‘val’ in something not a structure or union
ca->heap_cn.val = sim->cur_time;
^
src/eg_simula.c:371:17: error: request for member ‘val’ in something not a structure or union
ca->heap_cn.val = sim->cur_time + nn->gen(sim->cur_time,nn->data);
^
src/eg_simula.c:377:17: error: request for member ‘val’ in something not a structure or union
ca->heap_cn.val = DBL_MAX;
^
src/eg_simula.c:381:12: warning: implicit declaration of function ‘dbl_EGeHeapSiftDown’ [-Wimplicit-function-declaration]
rval = dbl_EGeHeapSiftDown(&(sim->hp),&(ca->heap_cn));
^
src/eg_simula.c:388:5: warning: implicit declaration of function ‘dbl_EGeHeapDel’ [-Wimplicit-function-declaration]
dbl_EGeHeapDel(&(sim->hp),&(ca->heap_cn));
^
src/eg_simula.c:429:17: error: request for member ‘val’ in something not a structure or union
ca->heap_cn.val = sim->cur_time;
^
src/eg_simula.c:433:17: error: request for member ‘val’ in something not a structure or union
ca->heap_cn.val = sim->cur_time + nn->gen(sim->cur_time,nn->data);
^
src/eg_simula.c:441:17: error: request for member ‘val’ in something not a structure or union
ca->heap_cn.val = DBL_MAX;
^
Makefile.library:38: recipe for target 'obj/eg_simula.o' failed
make[1]: *** [obj/eg_simula.o] Error 1
make[1]: Leaving directory '/home/phani/EGlib-2.6.20'
Makefile:23: recipe for target 'library' failed
make: *** [library] Error 2
After some searching, I have noticed that dbl_EGeHeap_t is not defined in the source code, and that seems to be throwing errors.
On searching online, it seems to be the case that it was defined in EGlib 2.6.15 (https://conexo.dii.uchile.cl/SVN/EGlib/EGlib2/tags/EGlib-2.6.15/TEmplate/dbl_eg_eheap.h), but the corresponding file in 2.6.20 does not have the definition.
Has anybody else experienced this? I badly need a solution to this.

Really impossible to make package with Theos

I really don't manage to "make package" with Theos for a Tweak made by me, so I copied the "unlockchanger" example on the web (here https://github.com/codyd51/Theos-Examples/tree/master/unlockchanger ) and tried to do "make package". I get these errors:
iPhone-di-Gabriele:/var/mobile/unlockchanger root# make package
/var/mobile/unlockchanger/theos/makefiles/targets/Darwin-arm/iphone.mk:43: Targeting iOS 4.0 and higher is not supported with iphone-gcc. Forcing clang.
/var/mobile/unlockchanger/theos/makefiles/targets/Darwin-arm/iphone.mk:53: Deploying to iOS 3.0 while building for 6.0 will generate armv7-only binaries.
Making all for tweak UnlockChanger...
Preprocessing Tweak.xm...
Compiling Tweak.xm...
In file included from Tweak.xm:3:
/var/mobile/unlockchanger/theos/include/substrate.h:57:20: error: unknown type name 'pid_t'
bool MSHookProcess(pid_t pid, const char *library);
^
/var/mobile/unlockchanger/theos/include/substrate.h:69:1: error: unknown type name 'IMP'
IMP MSHookMessage(Class _class, SEL sel, IMP imp, const char *prefix _default(NULL));
^
/var/mobile/unlockchanger/theos/include/substrate.h:69:42: error: unknown type name 'IMP'
IMP MSHookMessage(Class _class, SEL sel, IMP imp, const char *prefix _default(NULL));
^
/var/mobile/unlockchanger/theos/include/substrate.h:69:79: error: use of undeclared identifier 'NULL'
IMP MSHookMessage(Class _class, SEL sel, IMP imp, const char *prefix _default(NULL));
^
/var/mobile/unlockchanger/theos/include/substrate.h:48:27: note: expanded from macro '_default'
#define _default(value) = value
^
/var/mobile/unlockchanger/theos/include/substrate.h:71:45: error: unknown type name 'IMP'
void MSHookMessageEx(Class _class, SEL sel, IMP imp, IMP *result);
^
/var/mobile/unlockchanger/theos/include/substrate.h:71:54: error: unknown type name 'IMP'
void MSHookMessageEx(Class _class, SEL sel, IMP imp, IMP *result);
^
/var/mobile/unlockchanger/theos/include/substrate.h:125:92: error: use of undeclared identifier 'NULL'
static inline Type_ *MSHookMessage(Class _class, SEL sel, Type_ *imp, const char *prefix = NULL) {
^
/var/mobile/unlockchanger/theos/include/substrate.h:126:82: error: unknown type name 'IMP'
return reinterpret_cast<Type_ *>(MSHookMessage(_class, sel, reinterpret_cast<IMP>(imp), prefix));
^
/var/mobile/unlockchanger/theos/include/substrate.h:132:58: error: unknown type name 'IMP'
return MSHookMessageEx(_class, sel, reinterpret_cast<IMP>(imp), reinterpret_cast<IMP *>(result));
^
/var/mobile/unlockchanger/theos/include/substrate.h:132:86: error: unknown type name 'IMP'
return MSHookMessageEx(_class, sel, reinterpret_cast<IMP>(imp), reinterpret_cast<IMP *>(result));
^
/var/mobile/unlockchanger/theos/include/substrate.h:137:5: error: use of undeclared identifier 'Ivar'
Ivar ivar(class_getInstanceVariable(object_getClass(self), name));
^
/var/mobile/unlockchanger/theos/include/substrate.h:138:19: error: use of undeclared identifier 'ivar'
void *pointer(ivar == NULL ? NULL : reinterpret_cast<char *>(self) + ivar_getOffset(ivar));
^
/var/mobile/unlockchanger/theos/include/substrate.h:138:27: error: use of undeclared identifier 'NULL'
void *pointer(ivar == NULL ? NULL : reinterpret_cast<char *>(self) + ivar_getOffset(ivar));
^
/var/mobile/unlockchanger/theos/include/substrate.h:138:34: error: use of undeclared identifier 'NULL'
void *pointer(ivar == NULL ? NULL : reinterpret_cast<char *>(self) + ivar_getOffset(ivar));
^
/var/mobile/unlockchanger/theos/include/substrate.h:138:89: error: use of undeclared identifier 'ivar'
void *pointer(ivar == NULL ? NULL : reinterpret_cast<char *>(self) + ivar_getOffset(ivar));
^
/var/mobile/unlockchanger/theos/include/substrate.h:294:71: error: use of undeclared identifier 'NULL'
return MSHookFunction(symbol, replace, reinterpret_cast<Type_ **>(NULL));
^
/var/mobile/unlockchanger/theos/include/substrate.h:298:85: error: use of undeclared identifier 'NULL'
static inline void MSHookSymbol(Type_ *&value, const char *name, MSImageRef image = NULL) {
^
/var/mobile/unlockchanger/theos/include/substrate.h:303:86: error: use of undeclared identifier 'NULL'
static inline void MSHookFunction(const char *name, Type_ *replace, Type_ **result = NULL) {
^
/var/mobile/unlockchanger/theos/include/substrate.h:310:104: error: use of undeclared identifier 'NULL'
static inline void MSHookFunction(MSImageRef image, const char *name, Type_ *replace, Type_ **result = NULL) {
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[2]: *** [obj/Tweak.xm.7838be1a.o] Error 1
make[1]: *** [internal-library-all_] Error 2
make: *** [UnlockChanger.all.tweak.variables] Error 2
Some detail:
I'm on iOS8.1, with an iPhone 5. Everything installed from Cydia
..and on Windows 8.1 with WinSCP and PuTTY
I've installed Theos, Perl.. everything (Also "BigBoss recommended packages")
I had to install also LLVM+Clang because make didn't find a "clang++" command
I've tried to dump classes, instead of taking them from the web
I've updated substrate.h in /include/ and libsubstrate.dylib in /lib/
If I try to "make package" on my tweak for SpringBoard, where in Tweak.xm I do:
#import <SpringBoard/Springboard.h>
I get these errors:
iPhone-di-Gabriele:/var/mobile/mytweak root# make package
/var/mobile/mytweak/theos/makefiles/targets/Darwin-arm/iphone.mk:43: Targeting iOS 4.0 and higher is not supported with iphone-gcc. Forcing clang.
/var/mobile/mytweak/theos/makefiles/targets/Darwin-arm/iphone.mk:53: Deploying to iOS 3.0 while building for 6.0 will generate armv7-only binaries.
Making all for tweak mytweak...
Preprocessing Tweak.xm...
Compiling Tweak.xm...
In file included from Tweak.xm:1:
/var/mobile/mytweak/theos/include/SpringBoard.h:33:19: error: field has incomplete type 'struct CGSize'
struct CGSize size;
^
/var/mobile/mytweak/theos/include/SpringBoard.h:33:12: note: forward declaration of 'CGSize'
struct CGSize size;
^
/var/mobile/mytweak/theos/include/SpringBoard.h:229:34: error: cannot find protocol declaration for 'NSObject'
#protocol APSConnectionDelegate <NSObject>
^
/var/mobile/mytweak/theos/include/SpringBoard.h:233:37: error: cannot find protocol declaration for 'NSObject'
#protocol AVExternalDeviceDelegate <NSObject>
^
/var/mobile/mytweak/theos/include/SpringBoard.h:236:27: error: cannot find protocol declaration for
'BBSectionIdentity'
#protocol BBDataProvider <BBSectionIdentity>
^
/var/mobile/mytweak/theos/include/SpringBoard.h:240:31: error: cannot find protocol declaration for 'NSObject'
#protocol BBObserverDelegate <NSObject>
^
/var/mobile/mytweak/theos/include/SpringBoard.h:246:30: error: cannot find protocol declaration for 'NSObject'
#protocol BBSectionIdentity <NSObject>
^
/var/mobile/mytweak/theos/include/SpringBoard.h:250:41: error: cannot find protocol declaration for 'NSObject'
#protocol BSSettingDescriptionProvider <NSObject>
^
/var/mobile/mytweak/theos/include/SpringBoard.h:255:34: error: cannot find protocol declaration for 'NSObject'
#protocol BSTransactionObserver <NSObject>
^
/var/mobile/mytweak/theos/include/SpringBoard.h:258:31: error: cannot find protocol declaration for 'NSObject'
#protocol BSWatchdogDelegate <NSObject>
^
/var/mobile/mytweak/theos/include/SpringBoard.h:261:38: error: cannot find protocol declaration for 'NSObject'
#protocol CLLocationManagerDelegate <NSObject>
^
/var/mobile/mytweak/theos/include/SpringBoard.h:264:41: error: cannot find protocol declaration for 'NSObject'
#protocol FBApplicationLibraryObserver <NSObject>
^
/var/mobile/mytweak/theos/include/SpringBoard.h:267:45: error: cannot find protocol declaration for 'NSObject'
#protocol FBApplicationPlaceholderObserver <NSObject>
^
/var/mobile/mytweak/theos/include/SpringBoard.h:270:41: error: cannot find protocol declaration for
'FBProcessObserver'
#protocol FBApplicationProcessObserver <FBProcessObserver>
^
/var/mobile/mytweak/theos/include/SpringBoard.h:276:37: error: cannot find protocol declaration for 'NSObject'
#protocol FBDisplayManagerObserver <NSObject>
^
/var/mobile/mytweak/theos/include/SpringBoard.h:279:37: error: cannot find protocol declaration for 'NSObject'
#protocol FBProcessManagerObserver <NSObject>
^
/var/mobile/mytweak/theos/include/SpringBoard.h:284:30: error: cannot find protocol declaration for 'NSObject'
#protocol FBProcessObserver <NSObject>
^
/var/mobile/mytweak/theos/include/SpringBoard.h:287:35: error: cannot find protocol declaration for 'NSObject'
#protocol FBSceneManagerDelegate <NSObject>
^
/var/mobile/mytweak/theos/include/SpringBoard.h:293:35: error: cannot find protocol declaration for 'NSObject'
#protocol FBSceneManagerObserver <NSObject>
^
/var/mobile/mytweak/theos/include/SpringBoard.h:302:46: error: cannot find protocol declaration for 'NSObject'
#protocol FBSynchronizedTransactionDelegate <NSObject>
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[2]: *** [obj/Tweak.xm.0ad6af3a.o] Error 1
make[1]: *** [internal-library-all_] Error 2
make: *** [mytweak.all.tweak.variables] Error 2
I really don't know where is the mistake, I really tried everything, also "make -i" but it doesn't create the dylib file!
Also using my dumped headers, for SpringBoard, I get:
iPhone-di-Gabriele:/var/mobile/test root# make package
/var/mobile/test/theos/makefiles/targets/Darwin-arm/iphone.mk:43: Targeting iOS 4.0 and higher is not supported with iphone-gcc. Forcing clang.
/var/mobile/test/theos/makefiles/targets/Darwin-arm/iphone.mk:53: Deploying to iOS 3.0 while building for 6.0 will generate armv7-only binaries.
Making all for tweak test...
Preprocessing Tweak.xm...
Compiling Tweak.xm...
In file included from Tweak.xm:1:
In file included from /var/mobile/test/theos/include/SpringBoard/SpringBoard.h:9:
In file included from /var/mobile/test/theos/include/SpringBoard/SBBannerContainerViewController.h:8:
In file included from /var/mobile/test/theos/include/SpringBoard/UIViewControllerAnimatedTransitioning.h:8:
In file included from /var/mobile/test/theos/include/SpringBoard/NSObject.h:8:
/var/mobile/test/theos/include/SpringBoard/SpringBoard-Structs.h:26:2: error:
unknown type name 'BOOL'
BOOL _field1;
^
/var/mobile/test/theos/include/SpringBoard/SpringBoard-Structs.h:27:2: error:
unknown type name 'BOOL'
BOOL _field2;
^
/var/mobile/test/theos/include/SpringBoard/SpringBoard-Structs.h:28:2: error:
unknown type name 'BOOL'
BOOL _field3;
^
/var/mobile/test/theos/include/SpringBoard/SpringBoard-Structs.h:29:2: error:
unknown type name 'BOOL'
BOOL _field4;
^
/var/mobile/test/theos/include/SpringBoard/SpringBoard-Structs.h:30:2: error:
unknown type name 'BOOL'
BOOL _field5;
^
/var/mobile/test/theos/include/SpringBoard/SpringBoard-Structs.h:66:2: error:
unknown type name 'BOOL'
BOOL itemIsEnabled[25];
^
/var/mobile/test/theos/include/SpringBoard/SpringBoard-Structs.h:67:2: error:
unknown type name 'BOOL'
BOOL timeString[64];
^
/var/mobile/test/theos/include/SpringBoard/SpringBoard-Structs.h:70:2: error:
unknown type name 'BOOL'
BOOL serviceString[100];
^
/var/mobile/test/theos/include/SpringBoard/SpringBoard-Structs.h:71:2: error:
unknown type name 'BOOL'
BOOL serviceCrossfadeString[100];
^
/var/mobile/test/theos/include/SpringBoard/SpringBoard-Structs.h:72:2: error:
unknown type name 'BOOL'
BOOL serviceImages[2][100];
^
/var/mobile/test/theos/include/SpringBoard/SpringBoard-Structs.h:73:2: error:
unknown type name 'BOOL'
BOOL operatorDirectory[1024];
^
/var/mobile/test/theos/include/SpringBoard/SpringBoard-Structs.h:80:2: error:
unknown type name 'BOOL'
BOOL batteryDetailString[150];
^
/var/mobile/test/theos/include/SpringBoard/SpringBoard-Structs.h:86:2: error:
unknown type name 'BOOL'
BOOL activityDisplayId[256];
^
/var/mobile/test/theos/include/SpringBoard/SpringBoard-Structs.h:102:2: error:
unknown type name 'BOOL'
BOOL _field3[4088];
^
/var/mobile/test/theos/include/SpringBoard/SpringBoard-Structs.h:116:2: error:
unknown type name 'BOOL'
BOOL __opaque[40];
^
/var/mobile/test/theos/include/SpringBoard/SpringBoard-Structs.h:162:2: error:
unknown type name 'BOOL'
BOOL valid;
^
/var/mobile/test/theos/include/SpringBoard/SpringBoard-Structs.h:179:2: error:
unknown type name 'BOOL'
BOOL isValid;
^
In file included from Tweak.xm:1:
In file included from /var/mobile/test/theos/include/SpringBoard/SpringBoard.h:9:
In file included from /var/mobile/test/theos/include/SpringBoard/SBBannerContainerViewController.h:8:
In file included from /var/mobile/test/theos/include/SpringBoard/UIViewControllerAnimatedTransitioning.h:8:
/var/mobile/test/theos/include/SpringBoard/NSObject.h:10:1: error: redefinition
of 'NSString' as different kind of symbol
#class NSString;
^
/var/mobile/test/theos/include/SpringBoard/SpringBoard-Structs.h:135:3: note:
previous definition is here
} NSString;
^
In file included from Tweak.xm:1:
In file included from /var/mobile/test/theos/include/SpringBoard/SpringBoard.h:9:
In file included from /var/mobile/test/theos/include/SpringBoard/SBBannerContainerViewController.h:8:
In file included from /var/mobile/test/theos/include/SpringBoard/UIViewControllerAnimatedTransitioning.h:8:
/var/mobile/test/theos/include/SpringBoard/NSObject.h:24:3: error: expected a
type
-(BOOL)respondsToSelector:(SEL)selector;
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[2]: *** [obj/Tweak.xm.56f06e0e.o] Error 1
make[1]: *** [internal-library-all_] Error 2
make: *** [test.all.tweak.variables] Error 2
Thank you to everyone who wants to help me.
If you get these errors, make sure you have not extracted, or copied SDK folder (iPhoneOSX.X.sdk) on Windows, because in this way you will lose every (symbolic) link between sdk's files. So manage and organize your sdk folder on Mac OS, iOS or Linux (but I didn't tried on this one).
Good Luck!

unknown error when compile STLPort with arm-linux-gcc

I was trying to compile STLPort with cross-compiler toolchaine for uclinux.
According to INSTALL in root folder of STLPort library, if you want add new toolchaine, then you must find most nearest toolchaine and modified for your compiler.
I select gcc.mak and change gcc to arm-linux-gcc and c++ to arm-linux-c++. I got this error when compile :
.../../src/num_get_float.cpp:44:6: #error Unknown endianness.
../../src/num_get_float.cpp: In function `double stlpmtx_std::_Stl_atod(char*,
int, int)':
../../src/num_get_float.cpp:728: error: 'struct _ll::<anonymous>' has no member
named 'hi'
../../src/num_get_float.cpp:729: error: 'struct _ll::<anonymous>' has no member
named 'lo'
../../src/num_get_float.cpp:736: error: 'struct _ll::<anonymous>' has no member
named 'hi'
../../src/num_get_float.cpp:737: error: 'struct _ll::<anonymous>' has no member
named 'lo'
what is this error? how can I make a appropciate Makefile for STLPort on arm-linux-gcc?
EDIT : Error is fixed by first answer but I have another error :
When I try to compile the code, the makefile gets me this sentences :
* ATTENTION! *
This makefile tries to use system locale which might not work well with all glibc flavours.
If build fails, please resort to gcc.mak which will build C-locale only version for STLport
and in the end I got this errors for c_local.c:
In file included from c_locale.c:32:
arm-linux-gcc -I../stlport -W -Wno-sign-compare -Wno-unused -Wno-uninitialized -D_STLP_USE_GLIBC -D_STLP_REAL_LOCALE_IMPLEMENTED -O2 -fpic c_locale.c -c -o ../lib/obj/GCC/ReleaseD/c_locale.o
c_locale_glibc/c_locale_glibc.c: In function `_Find_locale':
c_locale_glibc/c_locale_glibc.c:118: warning: return makes pointer from integer without a cast
c_locale_glibc/c_locale_glibc.c: In function `_Locale_decimal_point':
c_locale_glibc/c_locale_glibc.c:242: error: `DECIMAL_POINT' undeclared (first use in this function)
c_locale_glibc/c_locale_glibc.c:242: error: (Each undeclared identifier is reported only once
c_locale_glibc/c_locale_glibc.c:242: error: for each function it appears in.)
c_locale_glibc/c_locale_glibc.c: In function `_Locale_thousands_sep':
c_locale_glibc/c_locale_glibc.c:246: error: `THOUSANDS_SEP' undeclared (first use in this function)
c_locale_glibc/c_locale_glibc.c: In function `_Locale_grouping':
c_locale_glibc/c_locale_glibc.c:250: error: `GROUPING' undeclared (first use in this function)
c_locale_glibc/c_locale_glibc.c: In function `_Locale_int_curr_symbol':
c_locale_glibc/c_locale_glibc.c:289: error: `INT_CURR_SYMBOL' undeclared (first use in this function)
c_locale_glibc/c_locale_glibc.c: In function `_Locale_currency_symbol':
c_locale_glibc/c_locale_glibc.c:292: error: `CURRENCY_SYMBOL' undeclared (first use in this function)
c_locale_glibc/c_locale_glibc.c: In function `_Locale_mon_decimal_point':
c_locale_glibc/c_locale_glibc.c:295: error: `MON_DECIMAL_POINT' undeclared (first use in this function)
c_locale_glibc/c_locale_glibc.c: In function `_Locale_mon_thousands_sep':
c_locale_glibc/c_locale_glibc.c:298: error: `MON_THOUSANDS_SEP' undeclared (first use in this function)
c_locale_glibc/c_locale_glibc.c: In function `_Locale_mon_grouping':
c_locale_glibc/c_locale_glibc.c:301: error: `MON_GROUPING' undeclared (first use in this function)
c_locale_glibc/c_locale_glibc.c: In function `_Locale_positive_sign':
c_locale_glibc/c_locale_glibc.c:304: error: `POSITIVE_SIGN' undeclared (first use in this function)
c_locale_glibc/c_locale_glibc.c: In function `_Locale_negative_sign':
c_locale_glibc/c_locale_glibc.c:307: error: `NEGATIVE_SIGN' undeclared (first use in this function)
c_locale_glibc/c_locale_glibc.c: In function `_Locale_int_frac_digits':
c_locale_glibc/c_locale_glibc.c:310: error: `INT_FRAC_DIGITS' undeclared (first use in this function)
c_locale_glibc/c_locale_glibc.c: In function `_Locale_frac_digits':
c_locale_glibc/c_locale_glibc.c:313: error: `FRAC_DIGITS' undeclared (first use in this function)
c_locale_glibc/c_locale_glibc.c: In function `_Locale_p_cs_precedes':
c_locale_glibc/c_locale_glibc.c:316: error: `P_CS_PRECEDES' undeclared (first use in this function)
c_locale_glibc/c_locale_glibc.c: In function `_Locale_p_sep_by_space':
c_locale_glibc/c_locale_glibc.c:319: error: `P_SEP_BY_SPACE' undeclared (first use in this function)
c_locale_glibc/c_locale_glibc.c: In function `_Locale_p_sign_posn':
c_locale_glibc/c_locale_glibc.c:322: error: `P_SIGN_POSN' undeclared (first use in this function)
c_locale_glibc/c_locale_glibc.c: In function `_Locale_n_cs_precedes':
c_locale_glibc/c_locale_glibc.c:325: error: `N_CS_PRECEDES' undeclared (first use in this function)
c_locale_glibc/c_locale_glibc.c: In function `_Locale_n_sep_by_space':
c_locale_glibc/c_locale_glibc.c:328: error: `N_SEP_BY_SPACE' undeclared (first use in this function)
c_locale_glibc/c_locale_glibc.c: In function `_Locale_n_sign_posn':
c_locale_glibc/c_locale_glibc.c:331: error: `N_SIGN_POSN' undeclared (first use in this function)
c_locale_glibc/c_locale_glibc.c: In function `_Locale_ctype_create':
c_locale_glibc/c_locale_glibc.c:485: error: `_NL_CTYPE_TOLOWER_EL' undeclared (first use in this function)
c_locale_glibc/c_locale_glibc.c:487: error: `_NL_CTYPE_TOUPPER_EL' undeclared (first use in this function)
c_locale_glibc/c_locale_glibc.c: In function `cname_lookup':
c_locale_glibc/c_locale_glibc.c:526: error: `_NL_CTYPE_NAMES_EL' undeclared (first use in this function)
c_locale_glibc/c_locale_glibc.c:531: error: `_NL_CTYPE_HASH_SIZE' undeclared (first use in this function)
c_locale_glibc/c_locale_glibc.c:532: error: `_NL_CTYPE_HASH_LAYERS' undeclared (first use in this function)
make: *** [../lib/obj/GCC/ReleaseD/c_locale.o] Error 1
I think this error is related to attention of makefile.
What can I fix the problem? what is resort for gcc.mak in attendtion?
Check the endianness of the ARM processor you want to run uclinux on. Then you can try running gcc -D_STLP_BIG_ENDIAN ... or gcc -D_STLP_LITTLE_ENDIAN ... in your Makefile to get past this error.

gcc compile error for gnu readline() to read from stdin

HI, guys,
I write a small program, named "ioprogram.c", with gnu readline library, refering various documentation on the Internet. however, gcc reports the following errors. what is my problem?
#include <readline/readline.h>
#include <stdio.h>
int main()
{
char* c = readline("");
int len = strlen(c);
for(int i=0; i<len; i++)
{
printf("%c", *(c+i));
fflush(stdout);
}
free(c);
}
gcc errors:
In file included from /usr/include/readline/readline.h:37,
from ioprogram.c:1:
/usr/include/readline/rltypedefs.h:65: error: expected ‘)’ before ‘*’ token
In file included from ioprogram.c:1:
/usr/include/readline/readline.h:416: error: expected ‘)’ before ‘*’ token
/usr/include/readline/readline.h:532: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
/usr/include/readline/readline.h:533: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
/usr/include/readline/readline.h:555: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
/usr/include/readline/readline.h:823: error: expected specifier-qualifier-list before ‘FILE’
ioprogram.c: In function ‘main’:
ioprogram.c:7: error: ‘for’ loop initial declaration used outside C99 mode
Thanks in advance for any comments.
try compiling with
gcc ioprogram.c -o ioprogram -lreadline -lncurses

Resources