0

I'm trying to cross-compile the gsl library as a shared library - as opposed to static, which works fine - due to memory constraints on the target microcontroller. This seems worth the effort since doing the same for x86 seems to save at least 10x the size of the final executable.

After running ./configure --host=sparc-gaisler-elf, I find the following weird:

checking whether the sparc-gaisler-elf-gcc linker (/home/magnus/opt/bcc-2.2.0-gcc/sparc-gaisler-elf/bin/ld) supports shared libraries... yes
***************************************************
checking if libtool supports shared libraries... no
checking whether to build shared libraries... no
checking whether to build static libraries... yes

If I am not mistaken, the two statements seem contradictory to me. It leaves me a little confused since I'm not quite sure which of the two is correct.

I looked into other posts regarding this and the closest I could find was this issue: Libtool claims it does not support shared libraries during cross compilation. However after running ./configure --host=sparc CC=sparc-gaisler-elf-gcc CXX=sparc-gaisler-elf-g++ AR=sparc-gaisler-elf-ar RANLIB=sparc-gaisler-elf-ranlib STRIP=sparc-gaisler-elf-strip which solved their issue, I instead ran into a compilation error (which makes me think their solution does not work for me).

The other issues I researched seemed to be regarding the gsl configuration not being able to find the ld tool, which does not appear to be my issue.

I would appreciate any help :)

  • When using a shared library, the executable size is lower because the library code in in the shared library. But this actually **increase** the memory needed at run time: the executable need to load the shared library. The global memory use is executable + shared library. To have a smaller memory requirement, you have to link the library normally (that is included in the executable) **and** ask the linker to remove any referenced function. – fpiette Jul 01 '21 at 15:08
  • Aha, thanks. I think I had misunderstood the fundamentals behind static and shared libraries. From what I could read up on, a shared library seems to require an OS, which I don't even have. Then it makes sense that the shared library does not compile either. – magnusmaehlum Jul 01 '21 at 15:59

0 Answers0