convert a static library to a dynamic one?

Mark Brethen mark.brethen at gmail.com
Sun Nov 18 22:05:50 UTC 2018


The following line worked,

system -W ${worksrcpath}_SHARED \
            "ld -dynamic -dylib -force_load spooles.a -r -x -o libspooles.1.dylib -install_name ${prefix}/lib/libspooles.1.dylib”

There was a warning in the main.log:

:debug:build system -W /opt/local/var/macports/build/_Users_marbre_ports_math_spooles/spooles/work/spooles.2.2_SHARED: ld -dynamic -dylib -force_load spooles.a -r -x -o libspooles.1.dylib -install_name /opt/local/lib/libspooles.1.dylib
:info:build ld: warning: -arch not specified

So I specified -arch ${os.arch} then it warned about spooles.a being i386, not x86_64. Why am I getting the warning?


Mark Brethen
mark.brethen at gmail.com



> On Nov 18, 2018, at 1:36 PM, Mark Brethen <mark.brethen at gmail.com> wrote:
> 
> The spooles src creates a static ‘spooles.a’ library. I want to get a dynamic library out of it. In BSD, for a .so library you would use:
> 
> ld -Bshareable -o libspooles.so.1 -x -soname libspooles.so.1 --whole-archive spooles.a
> 
> For macports I tried
> 
> system -W ${worksrcpath}_SHARED ld -dylib -force_load spooles.a -o libspooles.1.dylib
> 
> ld fails with an error:
> 
> :info:build ld: symbol(s) not found for inferred architecture x86_64
> :info:build Command failed: ld -dylib -force_load spooles.a -o libspooles.1.dylib
> :info:build Exit code: 1
> :error:build Failed to build spooles: command execution failed
> 
> How do I have to modify above command so I will get the desired result?
> 
> 
> Mark Brethen
> mark.brethen at gmail.com
> 
> 
> 



More information about the macports-dev mailing list