Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

building capstone inside radare2 on cygwin - error #148

Closed
XVilka opened this issue Jun 25, 2014 · 2 comments
Closed

building capstone inside radare2 on cygwin - error #148

XVilka opened this issue Jun 25, 2014 · 2 comments

Comments

@XVilka
Copy link
Contributor

XVilka commented Jun 25, 2014

building capstone (next) on cygwin from radare2 gives me this error:

make[2]: Leaving directory '/cygdrive/d/Work/radare/radare2/shlr/gdb'
if [ ! -d capstone ]; then \
        git clone https://github.com/aquynh/capstone.git ; \
fi
cd capstone ; \
        git checkout next ; \
        git reset --hard 5a7f409dec06859ad28ee577d404a501b7d380c8 || \
( if [ -d .git ]; then \
        git pull ; git reset --hard 5a7f409dec06859ad28ee577d404a501b7d380c8 ; \
else true ; fi)
Already on 'next'
HEAD is now at 5a7f409 set @insn to NULL on error in cs_disasm_ex()
cd capstone && CFLAGS="-Dmips=mips  -MD" LDFLAGS="" \
        make CC="gcc" AR_EXT=a IS_CYGWIN=1 \
        RANLIB="ranlib" AR="ar" \
        libcapstone.a
make[2]: Entering directory '/cygdrive/d/Work/radare/radare2/shlr/capstone'
make[2]: *** No rule to make target 'libcapstone.a'.  Stop.
make[2]: Leaving directory '/cygdrive/d/Work/radare/radare2/shlr/capstone'
Makefile:164: recipe for target 'capstone-build' failed
make[1]: *** [capstone-build] Error 2
make[1]: Leaving directory '/cygdrive/d/Work/radare/radare2/shlr'
Makefile:24: recipe for target 'all' failed
make: *** [all] Error 2

This is also without IS_CYGWIN=1.
But if you change to IS_CYGWIN=0 it builds ok, but bitching about -fPIC (you already handling this in your code for cygwin, so your makefile just can't determine my cygwin properly:

if [ ! -d capstone ]; then \
    git clone https://github.com/aquynh/capstone.git ; \
fi
cd capstone ; \
    git checkout next ; \
    git reset --hard 5a7f409dec06859ad28ee577d404a501b7d380c8 || \
( if [ -d .git ]; then \
    git pull ; git reset --hard 5a7f409dec06859ad28ee577d404a501b7d380c8 ; \
else true ; fi)
Already on 'next'
HEAD is now at 5a7f409 set @insn to NULL on error in cs_disasm_ex()
cd capstone && CFLAGS="-Dmips=mips  -MD" LDFLAGS="" \
    make CC="gcc" AR_EXT=a IS_CYGWIN=0 \
    RANLIB="ranlib" AR="ar" \
    libcapstone.a 
make[2]: Entering directory '/cygdrive/d/Work/radare/radare2/shlr/capstone'
  CC      cs.o
cs.c:1:0: warning: -fPIC ignored for target (all code is position independent)
 /* Capstone Disassembly Engine */
 ^
  CC      utils.o
utils.c:1:0: warning: -fPIC ignored for target (all code is position independent)
 /* Capstone Disassembly Engine */
 ^
  CC      SStream.o
SStream.c:1:0: warning: -fPIC ignored for target (all code is position independent)
 /* Capstone Disassembly Engine */
 ^
@radare
Copy link
Contributor

radare commented Jun 25, 2014

The first issue is because when compiling for cygwin the library name is capstone.lib instead of libcapstone.a. that’s why forcing IS_CYGWIN=1 is necessary for us.

The fPIC thing can be fixed by overriding the CFLAGS after make.

On 25 Jun 2014, at 16:38, Anton Kochkov [email protected] wrote:

building capstone (next) on cygwin from radare2 gives me this error:

make[2]: Leaving directory '/cygdrive/d/Work/radare/radare2/shlr/gdb'
if [ ! -d capstone ]; then
git clone https://github.com/aquynh/capstone.git ;
fi
cd capstone ;
git checkout next ;
git reset --hard 5a7f409 ||
( if [ -d .git ]; then
git pull ; git reset --hard 5a7f409 ;
else true ; fi)
Already on 'next'
HEAD is now at 5a7f409 set @Insn to NULL on error in cs_disasm_ex()
cd capstone && CFLAGS="-Dmips=mips -MD" LDFLAGS=""
make CC="gcc" AR_EXT=a IS_CYGWIN=1
RANLIB="ranlib" AR="ar"
libcapstone.a
make[2]: Entering directory '/cygdrive/d/Work/radare/radare2/shlr/capstone'
make[2]: *** No rule to make target 'libcapstone.a'. Stop.
make[2]: Leaving directory '/cygdrive/d/Work/radare/radare2/shlr/capstone'
Makefile:164: recipe for target 'capstone-build' failed
make[1]: *** [capstone-build] Error 2
make[1]: Leaving directory '/cygdrive/d/Work/radare/radare2/shlr'
Makefile:24: recipe for target 'all' failed
make: *** [all] Error 2
This is also without IS_CYGWIN=1.
But if you change to IS_CYGWIN=0 it builds ok, but bitching about -fPIC (you already handling this in your code for cygwin, so your makefile just can't determine my cygwin properly:

if [ ! -d capstone ]; then
git clone https://github.com/aquynh/capstone.git ;
fi
cd capstone ;
git checkout next ;
git reset --hard 5a7f409 ||
( if [ -d .git ]; then
git pull ; git reset --hard 5a7f409 ;
else true ; fi)
Already on 'next'
HEAD is now at 5a7f409 set @Insn to NULL on error in cs_disasm_ex()
cd capstone && CFLAGS="-Dmips=mips -MD" LDFLAGS=""
make CC="gcc" AR_EXT=a IS_CYGWIN=0
RANLIB="ranlib" AR="ar"
libcapstone.a
make[2]: Entering directory '/cygdrive/d/Work/radare/radare2/shlr/capstone'
CC cs.o
cs.c:1:0: warning: -fPIC ignored for target (all code is position independent)
/* Capstone Disassembly Engine /
^
CC utils.o
utils.c:1:0: warning: -fPIC ignored for target (all code is position independent)
/
Capstone Disassembly Engine /
^
CC SStream.o
SStream.c:1:0: warning: -fPIC ignored for target (all code is position independent)
/
Capstone Disassembly Engine */
^

Reply to this email directly or view it on GitHub.

@aquynh
Copy link
Collaborator

aquynh commented Jun 25, 2014

yes, on Windows i have renamed libcapstone.* to capstone.* because those are more like conventional names for Windows.

thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants