Shared libraries on macOS

Does PGI C compiler support creating shared libraries on macOS? Previous version (16.10) supported it, but only in the 32-bits mode. A new version (17.4) doesn’t support 32-bit binaries on macOS anymore. Thus I haven’t found in user guide exact information about possibility of creating shared library.

I’m trying to make a shared library with the following commands:

pgcc -c ./test.c -o test.o
pgcc -dynamiclib ./test.o -o ./test.dylib

But I get an error:

error: /opt/local/bin/libtool: unknown option character `r' in: -arch
Usage: /opt/local/bin/libtool -static [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-sacLT] [-no_warning_for_no_symbols]
Usage: /opt/local/bin/libtool -dynamic [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-o output] [-install_name name] [-compatibility_version #] [-current_version #] [-seg1addr 0x#] [-segs_read_only_addr 0x#] [-segs_read_write_addr 0x#] [-seg_addr_table <filename>] [-seg_addr_table_filename <file_system_path>] [-all_load] [-noall_load]

Thanks for pointing out the problem. I have filed TPR 24266 to address in a future release.


Turns out TPR 23658 already has logged the fact that 64-bit
dynamic library creation is not supported yet.