1

Temat: Kompilacja własnego programu na OpenWRT

Witam,
temat zapewne wałkowany niejednokrotnie ale nie mogę znaleźć odpowiedzi rozwiązującej mój problem. Programuję sobie w Pythonie, niestety skrypty pythona w openwrt działają jakby chciały, a nie mogły hmm. Postanowiłem więc użyć cythona aby przekonwertować kod do C, a następnie za pomocą SDK skompilować go pod OpenWRT, żeby zwiększyć wydajność. Używam rb532a. Ściągnąłem SDK pod tę platformę. Wykonałem:

export STAGING_DIR=/home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/staging_dir
export PATH=/home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/staging_dir/toolchain-mipsel_mips32_gcc-7.3.0_musl/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
feeds update -a
feeds install -a

Po takim zabiegu jestem w stanie uruchomić kompilator z poziomu dowolnego katalogu. Toolchain nie zawierał plików nagłówkowych do pythona. Ściągnąłem paczkę python3-dev_3.6.5-1_mipsel_mips32.ipk i przy pomocy polecenia tar ją rozpakowałem, a następnie rozpakowałem data.tar.gz. Utworzone katalogi i pliki po wypakowaniu dołączam w parametrach kompilatora. Polecenie jakim kompiluje:

mipsel-openwrt-linux-gcc -Os -I ~/usr/include/python3.6 -L ~/usr/lib -o main main.c -lpython3.6 -lpthread -lm -lutil -ldl

Efektem czego jest:

/home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/staging_dir/toolchain-mipsel_mips32_gcc-7.3.0_musl/bin/../lib/gcc/mipsel-openwrt-linux-musl/7.3.0/../../../../mipsel-openwrt-linux-musl/bin/ld: warning: libz.so.1, needed by /home/parallels/usr/lib/libpython3.6.so, not found (try using -rpath or -rpath-link)
/home/parallels/usr/lib/libpython3.6.so: undefined reference to `deflateEnd'
/home/parallels/usr/lib/libpython3.6.so: undefined reference to `inflate'
/home/parallels/usr/lib/libpython3.6.so: undefined reference to `inflateInit2_'
/home/parallels/usr/lib/libpython3.6.so: undefined reference to `zlibVersion'
/home/parallels/usr/lib/libpython3.6.so: undefined reference to `deflateCopy'
/home/parallels/usr/lib/libpython3.6.so: undefined reference to `deflateInit_'
/home/parallels/usr/lib/libpython3.6.so: undefined reference to `deflate'
/home/parallels/usr/lib/libpython3.6.so: undefined reference to `adler32'
/home/parallels/usr/lib/libpython3.6.so: undefined reference to `inflateSetDictionary'
/home/parallels/usr/lib/libpython3.6.so: undefined reference to `deflateSetDictionary'
/home/parallels/usr/lib/libpython3.6.so: undefined reference to `inflateEnd'
/home/parallels/usr/lib/libpython3.6.so: undefined reference to `crc32'
/home/parallels/usr/lib/libpython3.6.so: undefined reference to `deflateInit2_'
/home/parallels/usr/lib/libpython3.6.so: undefined reference to `inflateCopy@ZLIB_1.2.0'
collect2: error: ld returned 1 exit status

Z tego co widzę libpython3.6.so wymaga libz.so.1. Ściągnąłem więc paczkę zlib_1.2.11-2_mipsel_mips32.ipk i po wypakowaniu znajdowała się w katalogu razem z libpython3.6.so (więc uwzględniona w parametrach kompilatora). Niestety mimo, że biblioteka znajduje się w ~/usr/lib to kompilator dalej jej nie widzi i wyświetla taki sam komunikat. Przeszukałem wczoraj sporo internetu, niestety nie znalazłem nic co mogłoby rozwiązać ten problem hmm. Nie wykluczam (a raczej zdaję sobie sprawę), że robię coś źle, tylko już nie mam pomysłu dlaczego ld nie znajduje tej biblioteki. Odkryłem też coś takiego:

#file libz.so.1.2.11
libz.so.1.2.11: ELF 32-bit LSB shared object, MIPS, MIPS32 version 1 (SYSV), dynamically linked, corrupted section header size

Czy "corrupted section header size" może powodować ten błąd?
Proszę o jakieś nakierowanie smile
Z góry dzięki,
Tomek

PS. Pracuje na Debianie 9.6

2

Odp: Kompilacja własnego programu na OpenWRT

Dlaczego nie zrobisz sobie prostego makefile i nie zbudujesz paczki z tego tylko robisz to ręcznie?

/home/parallels/usr/lib/libpython3.6.so nie pochodzi z sdk?

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

3

Odp: Kompilacja własnego programu na OpenWRT

Nie umiem. Moja wiedza na temat programowania ogranicza się do pisania programów i klikania przycisku "compile" lub "run" big_smile Czy stworzenie makefile spowoduje, że libz.so.1 będzie wykrywane przez ld?

4

Odp: Kompilacja własnego programu na OpenWRT

Powoduje to że wszystko jest brane i linkowane z sdk a nie z katalogów obok. Dziesiątki przykładów masz w katalogu package i feeds. Jak chcesz prosty hello word w postaci paczki do zrobienia to masz tutaj: https://dl.eko.one.pl/projekty/helloworld.tar.gz

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

5

Odp: Kompilacja własnego programu na OpenWRT

Po dwóch dniach przeszukiwania internetów, tego jak używać SDK i jak zrobić Makefile, wyrzeźbiłem coś takiego:

include $(TOPDIR)/rules.mk

# Name, version and release number
# The name and version of your package are used to define the variable to point to the build directory of your package: $(PKG_BUILD_DIR)
PKG_NAME:=helloworld
PKG_VERSION:=1.0
PKG_RELEASE:=1
PYTHONINC:=-Os -I /home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/staging_dir/hostpkg/include/python3.6
ASDFLAGS:=-lz -lpython3.6 -lpthread -lm -lutil -ldl

# Source settings (i.e. where to find the source codes)
# This is a custom variable, used below
SOURCE_DIR:=/home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/helloworld

include $(INCLUDE_DIR)/package.mk

# Package definition; instructs on how and where our package will appear in the overall configuration menu ('make menuconfig')
define Package/helloworld
    SECTION:=examples
    CATEGORY:=Examples
    TITLE:=Hello, World!
endef

# Package description; a more verbose description on what our package does
define Package/helloworld/description
  A simple "Hello, world!" -application.
endef

# Package preparation instructions; create the build directory and copy the source code. 
# The last command is necessary to ensure our preparation instructions remain compatible with the patching system.
define Build/Prepare
    mkdir -p $(PKG_BUILD_DIR)
    cp $(SOURCE_DIR)/* $(PKG_BUILD_DIR)
        $(Build/Patch)
endef

# Package build instructions; invoke the target-specific compiler to first compile the source file, and then to link the file into the final executable
define Build/Compile
    $(TARGET_CC) $(TARGET_CFLAGS) $(PYTHONINC) -o $(PKG_BUILD_DIR)/helloworld.o -c $(PKG_BUILD_DIR)/helloworld.c
    $(TARGET_CC) $(TARGET_LDFLAGS) $(ASDFLAGS) -o $(PKG_BUILD_DIR)/$1 $(PKG_BUILD_DIR)/helloworld.o
endef

# Package install instructions; create a directory inside the package to hold our executable, and then copy the executable we built previously into the folder
define Package/helloworld/install
    $(INSTALL_DIR) $(1)/usr/bin
    $(INSTALL_BIN) $(PKG_BUILD_DIR)/helloworld $(1)/usr/bin
endef

# This command is always the last, it uses the definitions and variables we give above in order to get the job done
$(eval $(call BuildPackage,helloworld))

Paczka jest oznaczona "*" w make menuconfig, ale po wykonaniu "make package/helloworld/compile -j1 V=s" otrzymuję:

WARNING: Makefile 'package/linux/Makefile' has a dependency on 'r8169-firmware', which does not exist
WARNING: Makefile 'package/linux/Makefile' has a dependency on 'e100-firmware', which does not exist
WARNING: Makefile 'package/linux/Makefile' has a dependency on 'bnx2-firmware', which does not exist
WARNING: Makefile 'package/linux/Makefile' has a dependency on 'ar3k-firmware', which does not exist
WARNING: Makefile 'package/linux/Makefile' has a dependency on 'mwifiex-sdio-firmware', which does not exist
WARNING: Makefile 'package/linux/Makefile' has a dependency on 'kmod-phy-bcm-ns-usb2', which does not exist
WARNING: Makefile 'package/linux/Makefile' has a dependency on 'edgeport-firmware', which does not exist
WARNING: Makefile 'package/linux/Makefile' has a dependency on 'kmod-phy-bcm-ns-usb3', which does not exist
WARNING: Makefile 'package/linux/Makefile' has a dependency on 'prism54-firmware', which does not exist
WARNING: Makefile 'package/linux/Makefile' has a dependency on 'rtl8192su-firmware', which does not exist
tmp/.config-package.in:36:warning: ignoring type redefinition of 'PACKAGE_libc' from 'boolean' to 'tristate'
tmp/.config-package.in:64:warning: ignoring type redefinition of 'PACKAGE_libgcc' from 'boolean' to 'tristate'
tmp/.config-package.in:149:warning: ignoring type redefinition of 'PACKAGE_libpthread' from 'boolean' to 'tristate'
tmp/.config-package.in:177:warning: ignoring type redefinition of 'PACKAGE_librt' from 'boolean' to 'tristate'
#
# configuration written to .config
#
make[1]: Entering directory '/home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64'
make[2]: Entering directory '/home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/package/toolchain'
echo "libc" >> /home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/staging_dir/target-mipsel_mips32_musl/pkginfo/toolchain.default.install
echo "libgcc" >> /home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/staging_dir/target-mipsel_mips32_musl/pkginfo/toolchain.default.install
echo "libpthread" >> /home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/staging_dir/target-mipsel_mips32_musl/pkginfo/toolchain.default.install
echo "librt" >> /home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/staging_dir/target-mipsel_mips32_musl/pkginfo/toolchain.default.install
touch -r /home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/build_dir/target-mipsel_mips32_musl/toolchain/.built /home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/build_dir/target-mipsel_mips32_musl/toolchain/.autoremove 2>/dev/null >/dev/null
find /home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/build_dir/target-mipsel_mips32_musl/toolchain -mindepth 1 -maxdepth 1 -not '(' -type f -and -name '.*' -and -size 0 ')' -and -not -name '.pkgdir' | xargs -r rm -rf
make[2]: Leaving directory '/home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/package/toolchain'
time: package/toolchain/compile#0.03#0.00#0.21
make[2]: Entering directory '/home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/mypackages/examples/helloworld'
touch /home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/build_dir/target-mipsel_mips32_musl/helloworld-1.0/.prepared_483f0fb346d37560a40f06e2b5c7ffc7_18f1e190c5d53547fed41a3eaa76e9e9_check
mkdir -p /home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/build_dir/target-mipsel_mips32_musl/helloworld-1.0
cp /home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/helloworld/* /home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/build_dir/target-mipsel_mips32_musl/helloworld-1.0
touch /home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/build_dir/target-mipsel_mips32_musl/helloworld-1.0/.prepared_483f0fb346d37560a40f06e2b5c7ffc7_18f1e190c5d53547fed41a3eaa76e9e9
rm -f /home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/build_dir/target-mipsel_mips32_musl/helloworld-1.0/.configured_*
rm -f /home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/staging_dir/target-mipsel_mips32_musl/stamp/.helloworld_installed
(cd /home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/build_dir/target-mipsel_mips32_musl/helloworld-1.0/./; if [ -x ./configure ]; then find /home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/build_dir/target-mipsel_mips32_musl/helloworld-1.0/ -name config.guess | xargs -r chmod u+w; find /home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/build_dir/target-mipsel_mips32_musl/helloworld-1.0/ -name config.guess | xargs -r -n1 cp --remove-destination /home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/scripts/config.guess; find /home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/build_dir/target-mipsel_mips32_musl/helloworld-1.0/ -name config.sub | xargs -r chmod u+w; find /home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/build_dir/target-mipsel_mips32_musl/helloworld-1.0/ -name config.sub | xargs -r -n1 cp --remove-destination /home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/scripts/config.sub; AR="mipsel-openwrt-linux-musl-gcc-ar" AS="mipsel-openwrt-linux-musl-gcc -c -Os -pipe -mno-branch-likely -mips32 -mtune=mips32 -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -iremap/home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/build_dir/target-mipsel_mips32_musl/helloworld-1.0:helloworld-1.0 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro" LD=mipsel-openwrt-linux-musl-ld NM="mipsel-openwrt-linux-musl-gcc-nm" CC="mipsel-openwrt-linux-musl-gcc" GCC="mipsel-openwrt-linux-musl-gcc" CXX="mipsel-openwrt-linux-musl-g++" RANLIB="mipsel-openwrt-linux-musl-gcc-ranlib" STRIP=mipsel-openwrt-linux-musl-strip OBJCOPY=mipsel-openwrt-linux-musl-objcopy OBJDUMP=mipsel-openwrt-linux-musl-objdump SIZE=mipsel-openwrt-linux-musl-size CFLAGS="-Os -pipe -mno-branch-likely -mips32 -mtune=mips32 -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -iremap/home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/build_dir/target-mipsel_mips32_musl/helloworld-1.0:helloworld-1.0 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro " CXXFLAGS="-Os -pipe -mno-branch-likely -mips32 -mtune=mips32 -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -iremap/home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/build_dir/target-mipsel_mips32_musl/helloworld-1.0:helloworld-1.0 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro " CPPFLAGS="-I/home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/staging_dir/target-mipsel_mips32_musl/usr/include -I/home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/staging_dir/target-mipsel_mips32_musl/include -I/home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/staging_dir/toolchain-mipsel_mips32_gcc-7.3.0_musl/usr/include -I/home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/staging_dir/toolchain-mipsel_mips32_gcc-7.3.0_musl/include/fortify -I/home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/staging_dir/toolchain-mipsel_mips32_gcc-7.3.0_musl/include " LDFLAGS="-L/home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/staging_dir/target-mipsel_mips32_musl/usr/lib -L/home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/staging_dir/target-mipsel_mips32_musl/lib -L/home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/staging_dir/toolchain-mipsel_mips32_gcc-7.3.0_musl/usr/lib -L/home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/staging_dir/toolchain-mipsel_mips32_gcc-7.3.0_musl/lib -znow -zrelro "   ./configure --target=mipsel-openwrt-linux --host=mipsel-openwrt-linux --build=x86_64-pc-linux-gnu --program-prefix="" --program-suffix="" --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/lib --sysconfdir=/etc --datadir=/usr/share --localstatedir=/var --mandir=/usr/man --infodir=/usr/info --disable-nls  ; fi; )
touch /home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/build_dir/target-mipsel_mips32_musl/helloworld-1.0/.configured_68b329da9893e34099c7d8ad5cb9c940
rm -f /home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/build_dir/target-mipsel_mips32_musl/helloworld-1.0/.built
touch /home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/build_dir/target-mipsel_mips32_musl/helloworld-1.0/.built_check
mipsel-openwrt-linux-musl-gcc -Os -pipe -mno-branch-likely -mips32 -mtune=mips32 -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -iremap/home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/build_dir/target-mipsel_mips32_musl/helloworld-1.0:helloworld-1.0 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -Os -I /home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/staging_dir/hostpkg/include/python3.6 -o /home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/build_dir/target-mipsel_mips32_musl/helloworld-1.0/helloworld.o -c /home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/build_dir/target-mipsel_mips32_musl/helloworld-1.0/helloworld.c
In file included from /home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/staging_dir/hostpkg/include/python3.6/Python.h:53:0,
                 from /home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/build_dir/target-mipsel_mips32_musl/helloworld-1.0/helloworld.c:4:
/home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/staging_dir/hostpkg/include/python3.6/pyport.h:686:2: error: #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
 #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
  ^~~~~
/home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/build_dir/target-mipsel_mips32_musl/helloworld-1.0/helloworld.c:201:41: warning: division by zero [-Wdiv-by-zero]
     enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
                                         ^
/home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/build_dir/target-mipsel_mips32_musl/helloworld-1.0/helloworld.c:201:12: error: enumerator value for '__pyx_check_sizeof_voidp' is not an integer constant
     enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
            ^~~~~~~~~~~~~~~~~~~~~~~~
Makefile:50: recipe for target '/home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/build_dir/target-mipsel_mips32_musl/helloworld-1.0/.built' failed
make[2]: *** [/home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/build_dir/target-mipsel_mips32_musl/helloworld-1.0/.built] Error 1
make[2]: Leaving directory '/home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/mypackages/examples/helloworld'
time: package/feeds/mypackages/helloworld/compile#0.10#0.02#0.28
package/Makefile:107: recipe for target 'package/feeds/mypackages/helloworld/compile' failed
make[1]: *** [package/feeds/mypackages/helloworld/compile] Error 2
make[1]: Leaving directory '/home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64'
/home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/include/toplevel.mk:209: polecenia dla obiektu 'package/helloworld/compile' nie powiodły się
make: *** [package/helloworld/compile] Błąd 2

Jakiś pomysł z czym to może być związane? Dodam, że ten sam plik pod Debianem x86_64 kompiluje się bez problemu.

6

Odp: Kompilacja własnego programu na OpenWRT

PYTHONINC:=-Os -I /home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/staging_dir/hostpkg/include/python3.6

to jest błędne. Zapoznaj się że $STAGING_DIR

86_64/staging_dir/hostpkg/include/python3.6/pyport.h:686:2: error: #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
#error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
  ^~~~~
/home/parallels/openwrt-sdk-18.06.2-rb532_gcc-7.3.0_musl.Linux-x86_64/build_dir/ta

A to z kolei wynika z tego co masz w pyport.h

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.