convert a static library to a dynamic one?
Mark Brethen
mark.brethen at gmail.com
Mon Nov 19 07:23:51 UTC 2018
With the ‘-r’ option on ld I ended up with an object, not dylib:
brethen-air:~ marbre$ otool -hv /opt/local/lib/libspooles.1.dylib
Mach header
magic cputype cpusubtype caps filetype ncmds sizeofcmds flags
MH_MAGIC_64 X86_64 ALL 0x00 OBJECT 4 688 SUBSECTIONS_VIA_SYMBOLS
Removing that, however, causes it to fail: symbol(s) not found for architecture x86_64
This builds the archive file:
:debug:build system -W /opt/local/var/macports/build/_Users_marbre_ports_math_spooles/spooles/work/spooles.2.2_SHARED/MPI/src: /usr/bin/make -f makeGlobalLib
:info:build /opt/local/bin/mpicc-mpich-mp -c -Os -fPIC -I/opt/local/include/mpich-mp aggListMPI.c -o MPI_aggListMPI.o
.
.
.
:info:build /opt/local/bin/mpicc-mpich-mp -c -Os -fPIC -I/opt/local/include/mpich-mp utilities.c -o MPI_utilities.o
:info:build ar rv ../../spooles.a MPI_*.o
:info:build ar: creating archive ../../spooles.a
.
.
.
:info:build rm -f MPI_*.o
:info:build ranlib ../../spooles.a
Then use linker to convert static library to dylib:
:debug:build system -W /opt/local/var/macports/build/_Users_marbre_ports_math_spooles/spooles/work/spooles.2.2_SHARED: ld -dylib -arch x86_64 -all_load spooles.a -x -install_name /opt/local/lib/libspooles.1.dylib -o libspooles.1.dylib
Why doesn’t this work?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.log
Type: application/octet-stream
Size: 222846 bytes
Desc: not available
URL: <http://lists.macports.org/pipermail/macports-dev/attachments/20181119/76d0264f/attachment-0001.obj>
-------------- next part --------------
Mark Brethen
mark.brethen at gmail.com
> On Nov 18, 2018, at 5:54 PM, Joshua Root <jmr at macports.org> wrote:
>
> The default value of configure.ld_archflags is '-arch
> ${configure.build_arch}' provided the selected compiler supports -arch.
> So ‘-arch ${configure.ld_archflags}’ expands to e.g. ‘-arch -arch
> x86_64’. Don't do that. :)
>
> You can easily find out the value of any variable in a portfile by
> adding a line like:
>
> puts "somevar = ${somevar}"
>
> (Just run something like 'port info' to trigger it.)
>
> - Josh
>
> On 2018-11-19 09:34 , Mark Brethen wrote:
>> This port does not have a configure phase and I set 'universal no’ It
>> errors with ‘-arch ${configure.ld_archflags}’. How is this variable set?
>>
>>
>> Mark Brethen
>> mark.brethen at gmail.com <mailto:mark.brethen at gmail.com>
>>
>>
>>
>>> On Nov 18, 2018, at 4:16 PM, Joshua Root <jmr at macports.org
>>> <mailto:jmr at macports.org>> wrote:
>>>
>>> configure.ld_archflags
>>
More information about the macports-dev
mailing list