Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Needed to add zstd and -lz dependencies to compile faustgen on macOS #911

Open
shakfu opened this issue Jun 2, 2023 · 2 comments
Open

Comments

@shakfu
Copy link
Contributor

shakfu commented Jun 2, 2023

On my macOS x86_64 system, I had to modify the faustgen CMakeLists.txt as follows (full file is attached) to get it to work. zstd was provided by homebrew (note the Add faustgen dependencies section):

...
####################################
# compiler dependent settings
if (WIN32)
	set (FAUSTLIBS ${FAUSTLIB}/libfaustwithllvm.lib ${FAUSTLIB}/libOSCFaust.lib)
	set (WINSRC ${MAXSDK}/max-includes/common/dllmain_win.c ${MAXSDK}/max-includes/common/commonsyms.c)
else()

	set (MACLIBS "-framework CoreServices -framework IOKit")
	set (CMAKE_CXX_FLAGS_RELEASE "-O3")
	
	if(DEFINED FAUST_PATH_IS_ABSOLUTE AND FAUST_PATH_IS_ABSOLUTE MATCHES "1")
	set (FAUSTLIBS ${FAUSTLIB}/libfaustwithllvm.a ${FAUSTLIB}/libOSCFaust.a)
	else()
	execute_process( COMMAND faust-config --system-libs OUTPUT_VARIABLE FC_OUTPUT RESULT_VARIABLE FC_RESULT)
	string(REPLACE " " ";" FC_OUTPUT ${FC_OUTPUT})
	string(STRIP "${FC_OUTPUT}" FC_OUTPUT)
	set (FAUSTLIBS ${FAUSTLIB}/libfaustwithllvm.a ${FC_OUTPUT} -L/usr/local/lib ${FAUSTLIB}/libOSCFaust.a)
	endif()

endif()

####################################
# Add faustgen dependencies
####################################
# execute_process (COMMAND /usr/local/bin/brew --prefix zstd OUTPUT_VARIABLE ZSTD_DIR)
# message("ZSTD_DIR: " ${ZSTD_DIR})
set(ZSTD_DIR /usr/local/opt/zstd)
set(ZSTD_INCLIDE ${ZSTD_DIR}/include)
set(ZSTD_LIB ${ZSTD_DIR}/lib)
set(LIBZSTD ${ZSTD_LIB}/libzstd.a)

####################################
# Add the faustgen target
####################################
...

CMakeLists.txt

@sletz
Copy link
Member

sletz commented Jun 2, 2023

Which LLVM version are you using ?

@shakfu
Copy link
Contributor Author

shakfu commented Jun 2, 2023

$ brew info llvm
==> llvm: stable 16.0.4 (bottled), HEAD [keg-only]
Next-gen compiler infrastructure
https://llvm.org/
/usr/local/Cellar/llvm/16.0.4 (6,779 files, 1.6GB)
  Poured from bottle using the formulae.brew.sh API on 2023-05-19 at 04:52:32
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/llvm.rb
License: Apache-2.0 with LLVM-exception
==> Dependencies
Build: cmake ✔, swig ✘
Required: python@3.11 ✔, six ✔, z3 ✔, zstd ✔
==> Options
--HEAD
	Install HEAD version
==> Caveats
To use the bundled libc++ please add the following LDFLAGS:
  LDFLAGS="-L/usr/local/opt/llvm/lib/c++ -Wl,-rpath,/usr/local/opt/llvm/lib/c++"

llvm is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

If you need to have llvm first in your PATH, run:
  echo 'export PATH="/usr/local/opt/llvm/bin:$PATH"' >> /Users/sa/.bash_profile

For compilers to find llvm you may need to set:
  export LDFLAGS="-L/usr/local/opt/llvm/lib"
  export CPPFLAGS="-I/usr/local/opt/llvm/include"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants