build shared lib on macOS

2022. 9. 27. 07:48Programming

    목차
반응형

 

  • clang compiler
    • does not recognize GCC-specific -Wno-format-truncation
    • on Mac use .dylib extension instead of .so
    • Major number is located before the extension

ex.

On Linux

$(CC) $(CFLAGS) -shared $(LDFLAGS) -Wl,-soname -Wl,libxxx.so.$(LIBMAJOR) -o libxxx.so $(OBJECTS)

 

$(CC) $(CFLAGS) -dynamiclib -current_version $(LIBVER) $(OBJECTS) -o libxxx.$(LIBMAJOR).dylib

반응형

'Programming' 카테고리의 다른 글

Makefile %.o: %.cpp pattern  (0) 2022.09.29
cmake 옵션(option) 사용  (0) 2022.09.27
맥에서 boost 설치 및 위치 확인  (0) 2022.09.22
gtest 사용  (0) 2022.09.21
C++ map/vector  (0) 2022.03.01