Csound Csound-dev Csound-tekno Search About

[Csnd-dev] Linking errors trying to build csound6~ for Pd

Date2021-10-02 20:22
FromIain Duncan
Subject[Csnd-dev] Linking errors trying to build csound6~ for Pd
Hi Victor (and others), I'm trying to build csound6~ from scratch so I can poke at it to figure things out for the max version, but having never used Cmake before, I'm having some issues. I have built a Pd external before, but was using the pd lib builder helper.

I have installed the csound framework, and I have told Cmake where to find the pd header file, but on make I'm getting a linker error for libsndfile. I did try downloading and installing libsndfile, but that didn't change anything. Not sure if i need to specify where it is, or if this is not actually the issue and I'm doing something silly. Output is below:

thanks!

MacBook-Pro-7:build iainduncan$ make
/Applications/CMake.app/Contents/bin/cmake -S/Users/iainduncan/Documents/code/pd/csound_pd -B/Users/iainduncan/Documents/code/pd/csound_pd/build --check-build-system CMakeFiles/Makefile.cmake 0
/Applications/CMake.app/Contents/bin/cmake -E cmake_progress_start /Users/iainduncan/Documents/code/pd/csound_pd/build/CMakeFiles /Users/iainduncan/Documents/code/pd/csound_pd/build//CMakeFiles/progress.marks
/Library/Developer/CommandLineTools/usr/bin/make  -f CMakeFiles/Makefile2 all
/Library/Developer/CommandLineTools/usr/bin/make  -f CMakeFiles/pdcsound.dir/build.make CMakeFiles/pdcsound.dir/depend
cd /Users/iainduncan/Documents/code/pd/csound_pd/build && /Applications/CMake.app/Contents/bin/cmake -E cmake_depends "Unix Makefiles" /Users/iainduncan/Documents/code/pd/csound_pd /Users/iainduncan/Documents/code/pd/csound_pd /Users/iainduncan/Documents/code/pd/csound_pd/build /Users/iainduncan/Documents/code/pd/csound_pd/build /Users/iainduncan/Documents/code/pd/csound_pd/build/CMakeFiles/pdcsound.dir/DependInfo.cmake --color=
/Library/Developer/CommandLineTools/usr/bin/make  -f CMakeFiles/pdcsound.dir/build.make CMakeFiles/pdcsound.dir/build
[ 50%] Linking C shared module "csound6~.pd_darwin"
/Applications/CMake.app/Contents/bin/cmake -E cmake_link_script CMakeFiles/pdcsound.dir/link.txt --verbose=1
/Library/Developer/CommandLineTools/usr/bin/cc  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -bundle -Wl,-headerpad_max_install_names -flat_namespace -undefined suppress -o "csound6~.pd_darwin" CMakeFiles/pdcsound.dir/src/csoundapi_tilde.c.o -F/Library/Frameworks  -framework CsoundLib64
ld: file not found: @loader_path/../../libs/libsndfile.1.dylib for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [csound6~.pd_darwin] Error 1
make[1]: *** [CMakeFiles/pdcsound.dir/all] Error 2
make: *** [all] Error 2
MacBook-Pro-7:build iainduncan$

Date2021-10-02 20:58
FromVictor Lazzarini
SubjectRe: [Csnd-dev] [EXTERNAL] [Csnd-dev] Linking errors trying to build csound6~ for Pd
Maybe try adding /Library/Frameworks/CsoundLib64.framework/libs/ to your cmake library search path. That's where the libsndfile bundled with Csound is located.

I have not seen this issue before though.

Prof. Victor Lazzarini
Maynooth University
Ireland

On 2 Oct 2021, at 20:23, Iain Duncan <iainduncanlists@gmail.com> wrote:



*Warning*

This email originated from outside of Maynooth University's Mail System. Do not reply, click links or open attachments unless you recognise the sender and know the content is safe.

Hi Victor (and others), I'm trying to build csound6~ from scratch so I can poke at it to figure things out for the max version, but having never used Cmake before, I'm having some issues. I have built a Pd external before, but was using the pd lib builder helper.

I have installed the csound framework, and I have told Cmake where to find the pd header file, but on make I'm getting a linker error for libsndfile. I did try downloading and installing libsndfile, but that didn't change anything. Not sure if i need to specify where it is, or if this is not actually the issue and I'm doing something silly. Output is below:

thanks!

MacBook-Pro-7:build iainduncan$ make
/Applications/CMake.app/Contents/bin/cmake -S/Users/iainduncan/Documents/code/pd/csound_pd -B/Users/iainduncan/Documents/code/pd/csound_pd/build --check-build-system CMakeFiles/Makefile.cmake 0
/Applications/CMake.app/Contents/bin/cmake -E cmake_progress_start /Users/iainduncan/Documents/code/pd/csound_pd/build/CMakeFiles /Users/iainduncan/Documents/code/pd/csound_pd/build//CMakeFiles/progress.marks
/Library/Developer/CommandLineTools/usr/bin/make  -f CMakeFiles/Makefile2 all
/Library/Developer/CommandLineTools/usr/bin/make  -f CMakeFiles/pdcsound.dir/build.make CMakeFiles/pdcsound.dir/depend
cd /Users/iainduncan/Documents/code/pd/csound_pd/build && /Applications/CMake.app/Contents/bin/cmake -E cmake_depends "Unix Makefiles" /Users/iainduncan/Documents/code/pd/csound_pd /Users/iainduncan/Documents/code/pd/csound_pd /Users/iainduncan/Documents/code/pd/csound_pd/build /Users/iainduncan/Documents/code/pd/csound_pd/build /Users/iainduncan/Documents/code/pd/csound_pd/build/CMakeFiles/pdcsound.dir/DependInfo.cmake --color=
/Library/Developer/CommandLineTools/usr/bin/make  -f CMakeFiles/pdcsound.dir/build.make CMakeFiles/pdcsound.dir/build
[ 50%] Linking C shared module "csound6~.pd_darwin"
/Applications/CMake.app/Contents/bin/cmake -E cmake_link_script CMakeFiles/pdcsound.dir/link.txt --verbose=1
/Library/Developer/CommandLineTools/usr/bin/cc  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -bundle -Wl,-headerpad_max_install_names -flat_namespace -undefined suppress -o "csound6~.pd_darwin" CMakeFiles/pdcsound.dir/src/csoundapi_tilde.c.o -F/Library/Frameworks  -framework CsoundLib64
ld: file not found: @loader_path/../../libs/libsndfile.1.dylib for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [csound6~.pd_darwin] Error 1
make[1]: *** [CMakeFiles/pdcsound.dir/all] Error 2
make: *** [all] Error 2
MacBook-Pro-7:build iainduncan$

Date2021-10-02 21:12
FromVictor Lazzarini
SubjectRe: [Csnd-dev] [EXTERNAL] [Csnd-dev] Linking errors trying to build csound6~ for Pd
actually the CMakeLists.txt script seemed to be completely buggered. I think I fixed it now. 
Can you try it? You’ll need libsndfile installed I reckon, but you should not need any special configuration.

========================
Prof. Victor Lazzarini
Maynooth University
Ireland

> On 2 Oct 2021, at 20:22, Iain Duncan  wrote:
> 
> WARNINGThis email originated from outside of Maynooth University's Mail System. Do not reply, click links or open attachments unless you recognise the sender and know the content is safe.
> Hi Victor (and others), I'm trying to build csound6~ from scratch so I can poke at it to figure things out for the max version, but having never used Cmake before, I'm having some issues. I have built a Pd external before, but was using the pd lib builder helper.
> 
> I have installed the csound framework, and I have told Cmake where to find the pd header file, but on make I'm getting a linker error for libsndfile. I did try downloading and installing libsndfile, but that didn't change anything. Not sure if i need to specify where it is, or if this is not actually the issue and I'm doing something silly. Output is below:
> 
> thanks!
> 
> MacBook-Pro-7:build iainduncan$ make
> /Applications/CMake.app/Contents/bin/cmake -S/Users/iainduncan/Documents/code/pd/csound_pd -B/Users/iainduncan/Documents/code/pd/csound_pd/build --check-build-system CMakeFiles/Makefile.cmake 0
> /Applications/CMake.app/Contents/bin/cmake -E cmake_progress_start /Users/iainduncan/Documents/code/pd/csound_pd/build/CMakeFiles /Users/iainduncan/Documents/code/pd/csound_pd/build//CMakeFiles/progress.marks
> /Library/Developer/CommandLineTools/usr/bin/make  -f CMakeFiles/Makefile2 all
> /Library/Developer/CommandLineTools/usr/bin/make  -f CMakeFiles/pdcsound.dir/build.make CMakeFiles/pdcsound.dir/depend
> cd /Users/iainduncan/Documents/code/pd/csound_pd/build && /Applications/CMake.app/Contents/bin/cmake -E cmake_depends "Unix Makefiles" /Users/iainduncan/Documents/code/pd/csound_pd /Users/iainduncan/Documents/code/pd/csound_pd /Users/iainduncan/Documents/code/pd/csound_pd/build /Users/iainduncan/Documents/code/pd/csound_pd/build /Users/iainduncan/Documents/code/pd/csound_pd/build/CMakeFiles/pdcsound.dir/DependInfo.cmake --color=
> /Library/Developer/CommandLineTools/usr/bin/make  -f CMakeFiles/pdcsound.dir/build.make CMakeFiles/pdcsound.dir/build
> [ 50%] Linking C shared module "csound6~.pd_darwin"
> /Applications/CMake.app/Contents/bin/cmake -E cmake_link_script CMakeFiles/pdcsound.dir/link.txt --verbose=1
> /Library/Developer/CommandLineTools/usr/bin/cc  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -bundle -Wl,-headerpad_max_install_names -flat_namespace -undefined suppress -o "csound6~.pd_darwin" CMakeFiles/pdcsound.dir/src/csoundapi_tilde.c.o -F/Library/Frameworks  -framework CsoundLib64
> ld: file not found: @loader_path/../../libs/libsndfile.1.dylib for architecture x86_64
> clang: error: linker command failed with exit code 1 (use -v to see invocation)
> make[2]: *** [csound6~.pd_darwin] Error 1
> make[1]: *** [CMakeFiles/pdcsound.dir/all] Error 2
> make: *** [all] Error 2
> MacBook-Pro-7:build iainduncan$


Date2021-10-02 21:23
FromVictor Lazzarini
SubjectRe: [Csnd-dev] [EXTERNAL] [Csnd-dev] Linking errors trying to build csound6~ for Pd
No, there’s some other linking problem. I’ll need to try to fix it. That was never there before.
========================
Prof. Victor Lazzarini
Maynooth University
Ireland

> On 2 Oct 2021, at 21:12, Victor Lazzarini  wrote:
> 
> actually the CMakeLists.txt script seemed to be completely buggered. I think I fixed it now. 
> Can you try it? You’ll need libsndfile installed I reckon, but you should not need any special configuration.
> 
> ========================
> Prof. Victor Lazzarini
> Maynooth University
> Ireland
> 
>> On 2 Oct 2021, at 20:22, Iain Duncan  wrote:
>> 
>> WARNINGThis email originated from outside of Maynooth University's Mail System. Do not reply, click links or open attachments unless you recognise the sender and know the content is safe.
>> Hi Victor (and others), I'm trying to build csound6~ from scratch so I can poke at it to figure things out for the max version, but having never used Cmake before, I'm having some issues. I have built a Pd external before, but was using the pd lib builder helper.
>> 
>> I have installed the csound framework, and I have told Cmake where to find the pd header file, but on make I'm getting a linker error for libsndfile. I did try downloading and installing libsndfile, but that didn't change anything. Not sure if i need to specify where it is, or if this is not actually the issue and I'm doing something silly. Output is below:
>> 
>> thanks!
>> 
>> MacBook-Pro-7:build iainduncan$ make
>> /Applications/CMake.app/Contents/bin/cmake -S/Users/iainduncan/Documents/code/pd/csound_pd -B/Users/iainduncan/Documents/code/pd/csound_pd/build --check-build-system CMakeFiles/Makefile.cmake 0
>> /Applications/CMake.app/Contents/bin/cmake -E cmake_progress_start /Users/iainduncan/Documents/code/pd/csound_pd/build/CMakeFiles /Users/iainduncan/Documents/code/pd/csound_pd/build//CMakeFiles/progress.marks
>> /Library/Developer/CommandLineTools/usr/bin/make  -f CMakeFiles/Makefile2 all
>> /Library/Developer/CommandLineTools/usr/bin/make  -f CMakeFiles/pdcsound.dir/build.make CMakeFiles/pdcsound.dir/depend
>> cd /Users/iainduncan/Documents/code/pd/csound_pd/build && /Applications/CMake.app/Contents/bin/cmake -E cmake_depends "Unix Makefiles" /Users/iainduncan/Documents/code/pd/csound_pd /Users/iainduncan/Documents/code/pd/csound_pd /Users/iainduncan/Documents/code/pd/csound_pd/build /Users/iainduncan/Documents/code/pd/csound_pd/build /Users/iainduncan/Documents/code/pd/csound_pd/build/CMakeFiles/pdcsound.dir/DependInfo.cmake --color=
>> /Library/Developer/CommandLineTools/usr/bin/make  -f CMakeFiles/pdcsound.dir/build.make CMakeFiles/pdcsound.dir/build
>> [ 50%] Linking C shared module "csound6~.pd_darwin"
>> /Applications/CMake.app/Contents/bin/cmake -E cmake_link_script CMakeFiles/pdcsound.dir/link.txt --verbose=1
>> /Library/Developer/CommandLineTools/usr/bin/cc  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -bundle -Wl,-headerpad_max_install_names -flat_namespace -undefined suppress -o "csound6~.pd_darwin" CMakeFiles/pdcsound.dir/src/csoundapi_tilde.c.o -F/Library/Frameworks  -framework CsoundLib64
>> ld: file not found: @loader_path/../../libs/libsndfile.1.dylib for architecture x86_64
>> clang: error: linker command failed with exit code 1 (use -v to see invocation)
>> make[2]: *** [csound6~.pd_darwin] Error 1
>> make[1]: *** [CMakeFiles/pdcsound.dir/all] Error 2
>> make: *** [all] Error 2
>> MacBook-Pro-7:build iainduncan$
> 


Date2021-10-02 21:48
FromVictor Lazzarini
SubjectRe: [Csnd-dev] [EXTERNAL] [Csnd-dev] Linking errors trying to build csound6~ for Pd
I have to figure out why CMake is making a mess of it. For the moment, you can build the object with the following 
command (assuming your m_pd.h is in in /usr/local/include  and that you are in the top directory of the sources)

cc -bundle -Wl,-headerpad_max_install_names -flat_namespace -undefined suppress -o "csound6~.pd_darwin" ./src/csoundapi_tilde.c -F /Library/Frameworks -framework CsoundLib64 -I/usr/local/include

For some reason, CMake is building a command line that does not work all that well.
========================
Prof. Victor Lazzarini
Maynooth University
Ireland

> On 2 Oct 2021, at 20:22, Iain Duncan  wrote:
> 
> WARNINGThis email originated from outside of Maynooth University's Mail System. Do not reply, click links or open attachments unless you recognise the sender and know the content is safe.
> Hi Victor (and others), I'm trying to build csound6~ from scratch so I can poke at it to figure things out for the max version, but having never used Cmake before, I'm having some issues. I have built a Pd external before, but was using the pd lib builder helper.
> 
> I have installed the csound framework, and I have told Cmake where to find the pd header file, but on make I'm getting a linker error for libsndfile. I did try downloading and installing libsndfile, but that didn't change anything. Not sure if i need to specify where it is, or if this is not actually the issue and I'm doing something silly. Output is below:
> 
> thanks!
> 
> MacBook-Pro-7:build iainduncan$ make
> /Applications/CMake.app/Contents/bin/cmake -S/Users/iainduncan/Documents/code/pd/csound_pd -B/Users/iainduncan/Documents/code/pd/csound_pd/build --check-build-system CMakeFiles/Makefile.cmake 0
> /Applications/CMake.app/Contents/bin/cmake -E cmake_progress_start /Users/iainduncan/Documents/code/pd/csound_pd/build/CMakeFiles /Users/iainduncan/Documents/code/pd/csound_pd/build//CMakeFiles/progress.marks
> /Library/Developer/CommandLineTools/usr/bin/make  -f CMakeFiles/Makefile2 all
> /Library/Developer/CommandLineTools/usr/bin/make  -f CMakeFiles/pdcsound.dir/build.make CMakeFiles/pdcsound.dir/depend
> cd /Users/iainduncan/Documents/code/pd/csound_pd/build && /Applications/CMake.app/Contents/bin/cmake -E cmake_depends "Unix Makefiles" /Users/iainduncan/Documents/code/pd/csound_pd /Users/iainduncan/Documents/code/pd/csound_pd /Users/iainduncan/Documents/code/pd/csound_pd/build /Users/iainduncan/Documents/code/pd/csound_pd/build /Users/iainduncan/Documents/code/pd/csound_pd/build/CMakeFiles/pdcsound.dir/DependInfo.cmake --color=
> /Library/Developer/CommandLineTools/usr/bin/make  -f CMakeFiles/pdcsound.dir/build.make CMakeFiles/pdcsound.dir/build
> [ 50%] Linking C shared module "csound6~.pd_darwin"
> /Applications/CMake.app/Contents/bin/cmake -E cmake_link_script CMakeFiles/pdcsound.dir/link.txt --verbose=1
> /Library/Developer/CommandLineTools/usr/bin/cc  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -bundle -Wl,-headerpad_max_install_names -flat_namespace -undefined suppress -o "csound6~.pd_darwin" CMakeFiles/pdcsound.dir/src/csoundapi_tilde.c.o -F/Library/Frameworks  -framework CsoundLib64
> ld: file not found: @loader_path/../../libs/libsndfile.1.dylib for architecture x86_64
> clang: error: linker command failed with exit code 1 (use -v to see invocation)
> make[2]: *** [csound6~.pd_darwin] Error 1
> make[1]: *** [CMakeFiles/pdcsound.dir/all] Error 2
> make: *** [all] Error 2
> MacBook-Pro-7:build iainduncan$

Date2021-10-02 22:20
FromIain Duncan
SubjectRe: [Csnd-dev] [EXTERNAL] [Csnd-dev] Linking errors trying to build csound6~ for Pd
Great, that did it! 

Thanks Victor. If you need a tester on another machine for a fix to the cmake bit, happy to help

iain

On Sat, Oct 2, 2021 at 1:48 PM Victor Lazzarini <Victor.Lazzarini@mu.ie> wrote:
I have to figure out why CMake is making a mess of it. For the moment, you can build the object with the following
command (assuming your m_pd.h is in in /usr/local/include  and that you are in the top directory of the sources)

cc -bundle -Wl,-headerpad_max_install_names -flat_namespace -undefined suppress -o "csound6~.pd_darwin" ./src/csoundapi_tilde.c -F /Library/Frameworks -framework CsoundLib64 -I/usr/local/include

For some reason, CMake is building a command line that does not work all that well.
========================
Prof. Victor Lazzarini
Maynooth University
Ireland

> On 2 Oct 2021, at 20:22, Iain Duncan <iainduncanlists@GMAIL.COM> wrote:
>
> WARNINGThis email originated from outside of Maynooth University's Mail System. Do not reply, click links or open attachments unless you recognise the sender and know the content is safe.
> Hi Victor (and others), I'm trying to build csound6~ from scratch so I can poke at it to figure things out for the max version, but having never used Cmake before, I'm having some issues. I have built a Pd external before, but was using the pd lib builder helper.
>
> I have installed the csound framework, and I have told Cmake where to find the pd header file, but on make I'm getting a linker error for libsndfile. I did try downloading and installing libsndfile, but that didn't change anything. Not sure if i need to specify where it is, or if this is not actually the issue and I'm doing something silly. Output is below:
>
> thanks!
>
> MacBook-Pro-7:build iainduncan$ make
> /Applications/CMake.app/Contents/bin/cmake -S/Users/iainduncan/Documents/code/pd/csound_pd -B/Users/iainduncan/Documents/code/pd/csound_pd/build --check-build-system CMakeFiles/Makefile.cmake 0
> /Applications/CMake.app/Contents/bin/cmake -E cmake_progress_start /Users/iainduncan/Documents/code/pd/csound_pd/build/CMakeFiles /Users/iainduncan/Documents/code/pd/csound_pd/build//CMakeFiles/progress.marks
> /Library/Developer/CommandLineTools/usr/bin/make  -f CMakeFiles/Makefile2 all
> /Library/Developer/CommandLineTools/usr/bin/make  -f CMakeFiles/pdcsound.dir/build.make CMakeFiles/pdcsound.dir/depend
> cd /Users/iainduncan/Documents/code/pd/csound_pd/build && /Applications/CMake.app/Contents/bin/cmake -E cmake_depends "Unix Makefiles" /Users/iainduncan/Documents/code/pd/csound_pd /Users/iainduncan/Documents/code/pd/csound_pd /Users/iainduncan/Documents/code/pd/csound_pd/build /Users/iainduncan/Documents/code/pd/csound_pd/build /Users/iainduncan/Documents/code/pd/csound_pd/build/CMakeFiles/pdcsound.dir/DependInfo.cmake --color=
> /Library/Developer/CommandLineTools/usr/bin/make  -f CMakeFiles/pdcsound.dir/build.make CMakeFiles/pdcsound.dir/build
> [ 50%] Linking C shared module "csound6~.pd_darwin"
> /Applications/CMake.app/Contents/bin/cmake -E cmake_link_script CMakeFiles/pdcsound.dir/link.txt --verbose=1
> /Library/Developer/CommandLineTools/usr/bin/cc  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -bundle -Wl,-headerpad_max_install_names -flat_namespace -undefined suppress -o "csound6~.pd_darwin" CMakeFiles/pdcsound.dir/src/csoundapi_tilde.c.o -F/Library/Frameworks  -framework CsoundLib64
> ld: file not found: @loader_path/../../libs/libsndfile.1.dylib for architecture x86_64
> clang: error: linker command failed with exit code 1 (use -v to see invocation)
> make[2]: *** [csound6~.pd_darwin] Error 1
> make[1]: *** [CMakeFiles/pdcsound.dir/all] Error 2
> make: *** [all] Error 2
> MacBook-Pro-7:build iainduncan$

Date2021-10-02 22:36
FromVictor Lazzarini
SubjectRe: [Csnd-dev] [EXTERNAL] [Csnd-dev] Linking errors trying to build csound6~ for Pd
It’s a stupid thing. CMake finds your installed sysroot and calls the compiler with a given isysroot, eg.

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc  -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk

Then when it’s linking it needs all of the libraries that are named in CsoundLib64

otool -L /Library/Frameworks/CsoundLib64.framework/CsoundLib64
/Library/Frameworks/CsoundLib64.framework/CsoundLib64:
	/Library/Frameworks/CsoundLib64.framework/CsoundLib64 (compatibility version 6.0.0, current version 0.0.0)
	@loader_path/../../libs/libsndfile.1.dylib (compatibility version 2.0.0, current version 2.28.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292.100.5)
	/usr/lib/libcurl.4.dylib (compatibility version 7.0.0, current version 9.0.0)
	/System/Library/Frameworks/Accelerate.framework/Versions/A/Accelerate (compatibility version 1.0.0, current version 4.0.0)

one of these is the bundled libsndfile. But because of the relative location with @loader_path, it can’t be passed anything as a link
lib and it fails. Nothing gets passed this. 

However, if you just compile/link using cc everything is fine and there’s no need for an extra library. However, I can’t coerce CMake
to just use ‘cc’.

This was never a problem before, so I don’t really know what the matter is. For the moment, CMake builds on MacOS for csound_pd
are broken. So the only way is to compile it directly. I spent the last couple of hours trying to figure out a solution but nothing seems to
work.

This also means that using CMake to build other Csound API clients on MacOS will fail.
========================
Prof. Victor Lazzarini
Maynooth University
Ireland

> On 2 Oct 2021, at 22:20, Iain Duncan  wrote:
> 
> Great, that did it! 
> 
> Thanks Victor. If you need a tester on another machine for a fix to the cmake bit, happy to help
> 
> iain
> 
> On Sat, Oct 2, 2021 at 1:48 PM Victor Lazzarini  wrote:
> I have to figure out why CMake is making a mess of it. For the moment, you can build the object with the following 
> command (assuming your m_pd.h is in in /usr/local/include  and that you are in the top directory of the sources)
> 
> cc -bundle -Wl,-headerpad_max_install_names -flat_namespace -undefined suppress -o "csound6~.pd_darwin" ./src/csoundapi_tilde.c -F /Library/Frameworks -framework CsoundLib64 -I/usr/local/include
> 
> For some reason, CMake is building a command line that does not work all that well.
> ========================
> Prof. Victor Lazzarini
> Maynooth University
> Ireland
> 
> > On 2 Oct 2021, at 20:22, Iain Duncan  wrote:
> > 
> > WARNINGThis email originated from outside of Maynooth University's Mail System. Do not reply, click links or open attachments unless you recognise the sender and know the content is safe.
> > Hi Victor (and others), I'm trying to build csound6~ from scratch so I can poke at it to figure things out for the max version, but having never used Cmake before, I'm having some issues. I have built a Pd external before, but was using the pd lib builder helper.
> > 
> > I have installed the csound framework, and I have told Cmake where to find the pd header file, but on make I'm getting a linker error for libsndfile. I did try downloading and installing libsndfile, but that didn't change anything. Not sure if i need to specify where it is, or if this is not actually the issue and I'm doing something silly. Output is below:
> > 
> > thanks!
> > 
> > MacBook-Pro-7:build iainduncan$ make
> > /Applications/CMake.app/Contents/bin/cmake -S/Users/iainduncan/Documents/code/pd/csound_pd -B/Users/iainduncan/Documents/code/pd/csound_pd/build --check-build-system CMakeFiles/Makefile.cmake 0
> > /Applications/CMake.app/Contents/bin/cmake -E cmake_progress_start /Users/iainduncan/Documents/code/pd/csound_pd/build/CMakeFiles /Users/iainduncan/Documents/code/pd/csound_pd/build//CMakeFiles/progress.marks
> > /Library/Developer/CommandLineTools/usr/bin/make  -f CMakeFiles/Makefile2 all
> > /Library/Developer/CommandLineTools/usr/bin/make  -f CMakeFiles/pdcsound.dir/build.make CMakeFiles/pdcsound.dir/depend
> > cd /Users/iainduncan/Documents/code/pd/csound_pd/build && /Applications/CMake.app/Contents/bin/cmake -E cmake_depends "Unix Makefiles" /Users/iainduncan/Documents/code/pd/csound_pd /Users/iainduncan/Documents/code/pd/csound_pd /Users/iainduncan/Documents/code/pd/csound_pd/build /Users/iainduncan/Documents/code/pd/csound_pd/build /Users/iainduncan/Documents/code/pd/csound_pd/build/CMakeFiles/pdcsound.dir/DependInfo.cmake --color=
> > /Library/Developer/CommandLineTools/usr/bin/make  -f CMakeFiles/pdcsound.dir/build.make CMakeFiles/pdcsound.dir/build
> > [ 50%] Linking C shared module "csound6~.pd_darwin"
> > /Applications/CMake.app/Contents/bin/cmake -E cmake_link_script CMakeFiles/pdcsound.dir/link.txt --verbose=1
> > /Library/Developer/CommandLineTools/usr/bin/cc  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -bundle -Wl,-headerpad_max_install_names -flat_namespace -undefined suppress -o "csound6~.pd_darwin" CMakeFiles/pdcsound.dir/src/csoundapi_tilde.c.o -F/Library/Frameworks  -framework CsoundLib64
> > ld: file not found: @loader_path/../../libs/libsndfile.1.dylib for architecture x86_64
> > clang: error: linker command failed with exit code 1 (use -v to see invocation)
> > make[2]: *** [csound6~.pd_darwin] Error 1
> > make[1]: *** [CMakeFiles/pdcsound.dir/all] Error 2
> > make: *** [all] Error 2
> > MacBook-Pro-7:build iainduncan$


Date2021-10-02 23:10
FromVictor Lazzarini
SubjectRe: [Csnd-dev] [EXTERNAL] [Csnd-dev] Linking errors trying to build csound6~ for Pd
I think this is finally solved, I managed to make CMake build without setting isysroot and just using the cc command.
You can try now and see if it works for you.
========================
Prof. Victor Lazzarini
Maynooth University
Ireland

> On 2 Oct 2021, at 22:36, Victor Lazzarini  wrote:
> 
> It’s a stupid thing. CMake finds your installed sysroot and calls the compiler with a given isysroot, eg.
> 
> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc  -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk
> 
> Then when it’s linking it needs all of the libraries that are named in CsoundLib64
> 
> otool -L /Library/Frameworks/CsoundLib64.framework/CsoundLib64
> /Library/Frameworks/CsoundLib64.framework/CsoundLib64:
> 	/Library/Frameworks/CsoundLib64.framework/CsoundLib64 (compatibility version 6.0.0, current version 0.0.0)
> 	@loader_path/../../libs/libsndfile.1.dylib (compatibility version 2.0.0, current version 2.28.0)
> 	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292.100.5)
> 	/usr/lib/libcurl.4.dylib (compatibility version 7.0.0, current version 9.0.0)
> 	/System/Library/Frameworks/Accelerate.framework/Versions/A/Accelerate (compatibility version 1.0.0, current version 4.0.0)
> 
> one of these is the bundled libsndfile. But because of the relative location with @loader_path, it can’t be passed anything as a link
> lib and it fails. Nothing gets passed this. 
> 
> However, if you just compile/link using cc everything is fine and there’s no need for an extra library. However, I can’t coerce CMake
> to just use ‘cc’.
> 
> This was never a problem before, so I don’t really know what the matter is. For the moment, CMake builds on MacOS for csound_pd
> are broken. So the only way is to compile it directly. I spent the last couple of hours trying to figure out a solution but nothing seems to
> work.
> 
> This also means that using CMake to build other Csound API clients on MacOS will fail.
> ========================
> Prof. Victor Lazzarini
> Maynooth University
> Ireland
> 
>> On 2 Oct 2021, at 22:20, Iain Duncan  wrote:
>> 
>> Great, that did it! 
>> 
>> Thanks Victor. If you need a tester on another machine for a fix to the cmake bit, happy to help
>> 
>> iain
>> 
>> On Sat, Oct 2, 2021 at 1:48 PM Victor Lazzarini  wrote:
>> I have to figure out why CMake is making a mess of it. For the moment, you can build the object with the following 
>> command (assuming your m_pd.h is in in /usr/local/include  and that you are in the top directory of the sources)
>> 
>> cc -bundle -Wl,-headerpad_max_install_names -flat_namespace -undefined suppress -o "csound6~.pd_darwin" ./src/csoundapi_tilde.c -F /Library/Frameworks -framework CsoundLib64 -I/usr/local/include
>> 
>> For some reason, CMake is building a command line that does not work all that well.
>> ========================
>> Prof. Victor Lazzarini
>> Maynooth University
>> Ireland
>> 
>>> On 2 Oct 2021, at 20:22, Iain Duncan  wrote:
>>> 
>>> WARNINGThis email originated from outside of Maynooth University's Mail System. Do not reply, click links or open attachments unless you recognise the sender and know the content is safe.
>>> Hi Victor (and others), I'm trying to build csound6~ from scratch so I can poke at it to figure things out for the max version, but having never used Cmake before, I'm having some issues. I have built a Pd external before, but was using the pd lib builder helper.
>>> 
>>> I have installed the csound framework, and I have told Cmake where to find the pd header file, but on make I'm getting a linker error for libsndfile. I did try downloading and installing libsndfile, but that didn't change anything. Not sure if i need to specify where it is, or if this is not actually the issue and I'm doing something silly. Output is below:
>>> 
>>> thanks!
>>> 
>>> MacBook-Pro-7:build iainduncan$ make
>>> /Applications/CMake.app/Contents/bin/cmake -S/Users/iainduncan/Documents/code/pd/csound_pd -B/Users/iainduncan/Documents/code/pd/csound_pd/build --check-build-system CMakeFiles/Makefile.cmake 0
>>> /Applications/CMake.app/Contents/bin/cmake -E cmake_progress_start /Users/iainduncan/Documents/code/pd/csound_pd/build/CMakeFiles /Users/iainduncan/Documents/code/pd/csound_pd/build//CMakeFiles/progress.marks
>>> /Library/Developer/CommandLineTools/usr/bin/make  -f CMakeFiles/Makefile2 all
>>> /Library/Developer/CommandLineTools/usr/bin/make  -f CMakeFiles/pdcsound.dir/build.make CMakeFiles/pdcsound.dir/depend
>>> cd /Users/iainduncan/Documents/code/pd/csound_pd/build && /Applications/CMake.app/Contents/bin/cmake -E cmake_depends "Unix Makefiles" /Users/iainduncan/Documents/code/pd/csound_pd /Users/iainduncan/Documents/code/pd/csound_pd /Users/iainduncan/Documents/code/pd/csound_pd/build /Users/iainduncan/Documents/code/pd/csound_pd/build /Users/iainduncan/Documents/code/pd/csound_pd/build/CMakeFiles/pdcsound.dir/DependInfo.cmake --color=
>>> /Library/Developer/CommandLineTools/usr/bin/make  -f CMakeFiles/pdcsound.dir/build.make CMakeFiles/pdcsound.dir/build
>>> [ 50%] Linking C shared module "csound6~.pd_darwin"
>>> /Applications/CMake.app/Contents/bin/cmake -E cmake_link_script CMakeFiles/pdcsound.dir/link.txt --verbose=1
>>> /Library/Developer/CommandLineTools/usr/bin/cc  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -bundle -Wl,-headerpad_max_install_names -flat_namespace -undefined suppress -o "csound6~.pd_darwin" CMakeFiles/pdcsound.dir/src/csoundapi_tilde.c.o -F/Library/Frameworks  -framework CsoundLib64
>>> ld: file not found: @loader_path/../../libs/libsndfile.1.dylib for architecture x86_64
>>> clang: error: linker command failed with exit code 1 (use -v to see invocation)
>>> make[2]: *** [csound6~.pd_darwin] Error 1
>>> make[1]: *** [CMakeFiles/pdcsound.dir/all] Error 2
>>> make: *** [all] Error 2
>>> MacBook-Pro-7:build iainduncan$
>