Dec/9/2017 

How to compile a c file into a 32-bit shared library,
on a 64-bit Linux (Ubuntu/Linux Mint), for Euphoria 3.1.1 open_dll():
---------------------------------------------------------------------

Problem: 

When you try to compile 'euphoria/demo/linux/Mylib.c' into a shared library,
on a 64-bit Linux, with:

        gcc -shared Mylib.c -o mylib.so

you may get the following or a similar message:

        /usr/bin/ld: /tmp/cc1RfzVM.o: relocation R_X86_64_PC32 against 
        symbol `extra' can not be used when making a shared object; 
        recompile with -fPIC
        /usr/bin/ld: final link failed: Bad value
        collect2: error: ld returned 1 exit status

This is because gcc needs the 32-bit libraries for 64-bit Linux system.


Solution:

So you have to install the gcc 32-bit libraries...

On a 64-bit Linux Ubuntu/Linux Mint system, type in bash shell:

        sudo apt-get install gcc-multilib


Then use the -m32 flag to compile your file into a shared library:

        gcc -m32 -shared Mylib.c -o mylib.so


Now you can run 'euphoria/demo/linux/mylib.exu' using mylib.so.

Shian.
