Difference between revisions of "OpenWRT Cross Compiling"

4,239 bytes added ,  12:42, 30 August 2020
m
no edit summary
m
m
Line 38: Line 38:
**make dist, err, make tar (for OpenSSL, but it doesn't work of course);
**make dist, err, make tar (for OpenSSL, but it doesn't work of course);
***Key piece of information for doing it manually: https://stackoverflow.com/questions/1506462/what-files-did-make-install-copy-and-where and https://stackoverflow.com/questions/11307465/destdir-and-prefix-of-make
***Key piece of information for doing it manually: https://stackoverflow.com/questions/1506462/what-files-did-make-install-copy-and-where and https://stackoverflow.com/questions/11307465/destdir-and-prefix-of-make
***make install DESTDIR=  
***make install DESTDIR=
**Header files should be in /usr/include
**Header files should be in /usr/include
*Compiling
*Compiling
Line 48: Line 48:


...quitting for now because the instructions at https://openwrt.org/docs/guide-developer/build-system/use-buildsystem#selecting_a_specific_major_revision are a pathetic joke.  Go ahead, try them, see if it works.  Nope....
...quitting for now because the instructions at https://openwrt.org/docs/guide-developer/build-system/use-buildsystem#selecting_a_specific_major_revision are a pathetic joke.  Go ahead, try them, see if it works.  Nope....
Additional notes from other failed attempts;
<nowiki>http://transit.iut2.upmf-grenoble.fr/cgi-bin/man/man2html?Crypt::SSLeay+3</nowiki>
<nowiki>https://github.com/Entware/Entware-ng/wiki/Using-gcc-%28native-compilation%29</nowiki>
perl Makefile.PL --incpath /usr/src/lib
perl Makefile.PL -- $openssl_path=/usr/src/lib/openssl
echo | gcc -v -E -
perl -V
/usr/src/net/Net_SSLeay.pm-1.23/MYMETA.yml
env
opkg install perl-dev
opkg install openssl-
<nowiki>https://github.com/Entware/Entware-ng/wiki/Self-installation-of-perl-modules</nowiki>
<nowiki>https://github.com/Entware/Entware-ng/issues/430</nowiki>
<nowiki>https://github.com/Entware/Entware/wiki/Using-GCC-for-native-compilation</nowiki>
/usr/bin/ld: cannot find -lssl
/usr/bin/ld: cannot find -lcrypto
/usr/bin/ld: cannot find -ldl
ln -s
ld -lcrypto --verbose
find /
<nowiki>https://stackoverflow.com/questions/16710047/usr-bin-ld-cannot-find-lnameofthelibrary</nowiki>
For the /usr/bin/ld Issue: <nowiki>https://stackoverflow.com/questions/16710047/usr-bin-ld-cannot-find-lnameofthelibrary</nowiki>
/usr/bin/opensslOpenSSL 1.1.1g  21 Apr 2020
built on: Thu Jul 30 19:43:27 2020 UTC
platform: linux-arm-openwrt
options:  bn(64,32) rc4(char) des(long) blowfish(ptr)
compiler: arm-openwrt-linux-muslgnueabi-gcc -fPIC -pthread -Wa,--noexecstack -Wall -O3 -Os -pipe -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -mfloat-abi=hard -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -fpic -ffunction-sections -fdata-sections -znow -zrelro -DOPENSSL_USE_NODELETE -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DAES_ASM -DBSAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DPOLY1305_ASM -DNDEBUG -DOPENSSL_PREFER_CHACHA_OVER_GCM -DOPENSSL_SMALL_FOOTPRINT
OPENSSLDIR: "/etc/ssl"
ENGINESDIR: "/usr/lib/engines-1.1"
Seeding source: os-specific
OpenSSL>version -a
<nowiki>https://www.cpan.org/modules/by-module/Net/Net-SSLeay-1.73.readme</nowiki>
<nowiki>https://stackoverflow.com/questions/60521205/how-can-i-install-netssleay-with-perlbrew-in-macos-catalina</nowiki>
perl Makefile.PL -- INC=-I/usr/src/lib/ -- OPENSSL_PREFIX=/usr/src/openssl_compiled/usr/local
SSLeay.c: In function 'XS_Net__SSLeay_CTX_sessions':
SSLeay.c:3608:2: error: unknown type name 'LHASH'; did you mean '_LHASH'?
  LHASH * RETVAL;
<nowiki>  ^~~~~</nowiki>
 
  SSLeay.c line 3608, change LHASH to _LHASH
OpenSSL
remove -ldl and all -pthread references near EX_LIBS (from <nowiki>https://github.com/openssl/openssl/issues/3106</nowiki>)
Change destination directory for GCC Make: <nowiki>https://stackoverflow.com/questions/3239343/make-install-but-not-to-default-directories</nowiki>
...sure enough, in Makefile;
<nowiki>#</nowiki> DESTDIR is for package builders so that they can configure for, say,
<nowiki>#</nowiki> /usr/ and yet have everything installed to /tmp/somedir/usr/.
<nowiki>#</nowiki> Normally it is left empty.
DESTDIR=
Add the paths in Make File that include the new SSL stuff
DDLFLAGS = -shared -L/usr/src/openssl_compiled/usr/local/ -L/usr/src/openssl_compiled/usr/local/lib -L/usr -L/usr/lib -L/builder/shared-workdir/build/sdk/staging_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/usr/lib -L/builder/shared-workdir/build/sdk/staging_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/lib -L/builder/shared-workdir/build/sdk/staging_dir/toolchain-arm_cortex-a9+vfpv3-d16_gcc-7.5.0_musl_eabi/usr/lib -L/builder/shared-workdir/build/sdk/staging_dir/toolchain-arm_cortex-a9+vfpv3-d16_gcc-7.5.0_musl_eabi/lib -znow -zrelro
LDFLAGS = -L/usr/src/openssl_compiled/usr/local/ -L/usr/src/openssl_compiled/usr/local/lib -L/usr -L/usr/lib -L/builder/shared-workdir/build/sdk/staging_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/usr/lib -L/builder/shared-workdir/build/sdk/staging_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/lib -L/builder/shared-workdir/build/sdk/staging_dir/toolchain-arm_cortex-a9+vfpv3-d16_gcc-7.5.0_musl_eabi/usr/lib -L/builder/shared-workdir/build/sdk/staging_dir/toolchain-arm_cortex-a9+vfpv3-d16_gcc-7.5.0_musl_eabi/lib -znow -zrelro