![]() ![]() I am using the following command to cross compile: npm install sqlite3 -target_arch=arm -enable-static=yes -build-from-source -sqlite_libname=sqlcipher -fPIC -sqlite=home/onkar/Library/sqlcipher-master/.libs -verbose I got a static library from sqlcipher (libsqlcipher.a) whose path is exported to the LDFLAGS. First, I cross-compiled OpenSSL 1.0.2 followed by Sqlcipher. I started out with exporting the environment variables from SDK. I have sqlite3 installed in the Linux Image as well as SDK. I have the same node version on Ubuntu and Embedded Linux (morty). usr/lib/x86_64-linux-gnu/libz.I am using Ubuntu 16.04 with Node 4.6.1 and NPM 2.15.9 to cross compile sqlite3(with sqlcipher support) for Colibri-iMX6. usr/bin/ld: /usr/lib/x86_64-linux-gnu/libz.a(gzlib.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object recompile with -fPIC $ gcc -pie -fPIE m.c /usr/lib/x86_64-linux-gnu/libz.a The other misleading error message about the static library lacking -fPIE can be triggered this way: The fix is the following, compiling as PIE, linking with shared libz: The correct myself the error was about not compiling m.c with -fPIE but the error is still misleading. > I can open a separate bug for that but this is closely related to the > `gzopen' can not be used when making a position independent executable > collect2: error: ld returned 1 exit status > /usr/bin/ld: final link failed: Bad value > symbol `gzopen' can not be used when making a shared object recompile with > /usr/bin/ld: /tmp/cchMINoQ.o: relocation R_X86_64_PC32 against undefined > non-PIC static library to a position independent executable: > Also please fix the error message emitted when trying to link a non-PIE (In reply to Balint Reczey from comment #1) The macros have the value 1 for -fpie and 2 for -fPIE. ![]() fpie and -fPIE both define the macros _pie_ and _PIE_. Usually these options are used when -pie GCC option is used during linking. These options are similar to -fpic and -fPIC, but generated position independent code can be only linked into executables. When this flag is set, the macros _pic_ and _PIC_ are defined to 2. Position-independent code requires special support, and therefore works only on certain machines. This option makes a difference on the m68k, PowerPC and SPARC. If supported for the target machine, emit position-independent code, suitable for dynamic linking and avoiding any limit on the size of the global offset table. ![]() When this flag is set, the macros _pic_ and _PIC_ are defined to 1. Code generated for the IBM RS/6000 is always position-independent. For the x86, GCC supports PIC for System V but not for the Sun 386i. (These maximums are 8k on the SPARC and 32k on the m68k and RS/6000. If the GOT size for the linked executable exceeds a machine-specific maximum size, you get an error message from the linker indicating that -fpic does not work in that case, recompile with -fPIC instead. The dynamic loader resolves the GOT entries when the program starts (the dynamic loader is not part of GCC it is part of the operating system). Such code accesses all constant addresses through a global offset table (GOT). Generate position-independent code (PIC) suitable for use in a shared library, if supported for the target machine. Here is how the -fpic/-fPIC and -fpic/-fPIE option descriptions currently read: Independent code can only be linked into executables. Independent code can be only linked into executables. These options are similar to -fpic and -fPIC, but generated position The description of -fPIE contains a small syntax error. Suitable for dynamic linking into executables or shared libraries, and If supported for the target machine, emit position-independent code, I think the -fPIC option description should begin like this: Generate position-independent code (PIC) suitable for use in a shared I think the -fpic description should begin like this: The impression is created that -fpic/-fPIC cannot be used for executables. However, because the -fpie/-fPIE options also exist, It doesn't say itĬan't be used to link into an executable. Generated code is suitable for use in a shared library. It's not clear if -fPIC can be used when compiling files which are going to be ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |