xelerance / Openswan

Openswan
Other
858 stars 211 forks source link

openswan compile #439

Open JinShao1013 opened 4 years ago

JinShao1013 commented 4 years ago

hello I want to put the openswan transplanted to embedded Linux, use the cross compiler, compile openswan - 2.6.51.5 source code, there is an error: no rule to make target 'XXXX/OBJ. Linux. Arm/lib/libopenswan libopenswan. A', men by Pluto. Stop. Please help me.Thank you very much. Crosscompile.sh is configured as follows:

!/bin/sh

#

cross compile example

#

export PREFIX=/volquad/arm-4.0.2

export PREFIX=/usr/local/arm/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf export DESTDIR=./out

export ARCH=arm export CC=$PREFIX/bin/arm-linux-gnueabihf-gcc export GCC=$PREFIX/bin/arm-linux-gnueabihf-gcc export LD=$PREFIX/bin/arm-linux-gnueabihf-ld export RANLIB=$PREFIX/arm-linux-gnueabihf-ranlib export AR=$PREFIX/bin/arm-linux-gnueabihf-ar export AS=$PREFIX/bin/arm-linux-gnueabihf-as export STRIP=$PREFIX/bin/arm-linux-gnueabihf-strip export LD_LIBRARY_PATH=$PREFIX/lib/gcc/arm-linux-gnueabihf-gcc/4.9.4/ export PATH=$PATH:$PREFIX/bin export USERCOMPILE="-Wl,-elf2flt -DCOMPILER_HAS_NO_PRINTF_LIKE -O3 -g ${PORTDEFINE} -I$PREFIX/arm-elf/inc -L$PREFIX/lib/gcc-lib -DGCC_LINT -DLEAK_DETECTIVE -Dlinux -Dlinux" export WERROR=' '

now you can run:

make programs

and binaries will appear in OBJ.linux.$ARCH/

and run:

make install

and the install will go into $DESTDIR/

note: the arm_tools I had failed to compile PRINTF_LIKE(x), so the code

for that was ifdef'ed with #ifndef COMPILER_HAS_NO_PRINTF_LIKE statements.

Add -DCOMPILER_HAS_NO_PRINTF_LIKE to enable the workaround.

EXECUTABLE FILE FORMAT

#

Some uClibc/busybox combinations use different executable files formats from

ELF. This is configured during Linux kernel build. One common format is

the BLFT file format. Do not manually convert ELF binaries to BLTF using

elf2flt as that will create invalid binaries. Instead add -Wl,-elf2flt to

your flags (CFLAGS / LDFLAGS / USERCOMPILE)

mcr commented 4 years ago

hi. I don't know what arm_tools you are using. I guess not gcc. I have built with with musl on Alpine Linux many times. If you have no libopenswan.a, then it didn't compile correctly, or it doesn't do object directories correctly. I recommend you put all the variables into Makefile.local, see Makefile.inc for what to set, your list of exports likely is not complete.

mcr commented 4 years ago

It's hard for me to imagine an embedded Linux that does not use gcc,clang,llvm and that actually works, and is actually Linux.

mcr commented 4 years ago

well, you are clearly using gcc from linaro, so it must be that your /usr/include is missing PRINTF_LIKE, so you should just fix that.