sonosaurus / sonobus

Source code for SonoBus, a real-time network audio streaming collaboration tool.
https://sonobus.net
GNU General Public License v3.0
1.5k stars 106 forks source link

Trying to build SonoBus under FreeBSD #98

Open hselasky opened 2 years ago

hselasky commented 2 years ago

Hi,

I'm trying to build SonoBus under FreeBSD, but it fails.

The reason is that many headers and libraries are installed under /usr/local/include and /usr/local/lib, instead of /usr/include and /usr/lib.

Anyone knows how I can patch those directories into the build system?

--HPS

sonobus/build % cmake ..
-- The C compiler identification is Clang 10.0.1
-- The CXX compiler identification is Clang 10.0.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PkgConfig: /usr/local/bin/pkg-config (found version "1.7.4") 
-- Checking for module 'libcurl'
--   Found libcurl, version 7.77.0
-- Checking for modules 'webkit2gtk-4.0;gtk+-x11-3.0'
--   Found webkit2gtk-4.0, version 2.30.5
--   Found gtk+-x11-3.0, version 3.24.29
-- Checking for module 'alsa'
--   Found alsa, version 1.2.2
-- Checking for module 'freetype2'
--   Found freetype2, version 23.4.17
-- Configuring juceaide
-- Building juceaide
CMake Error at deps/juce/extras/Build/juceaide/CMakeLists.txt:86 (message):
  Failed to build juceaide

  [ 12%] Building CXX object
  extras/Build/juceaide/CMakeFiles/juceaide.dir/Main.cpp.o

  In file included from
  sonobus/deps/juce/extras/Build/juceaide/Main.cpp:26:

  In file included from
  sonobus/deps/juce/extras/Build/juce_build_tools/juce_build_tools.h:56:

  In file included from
  sonobus/deps/juce/modules/juce_gui_basics/juce_gui_basics.h:56:

  In file included from
  sonobus/deps/juce/modules/juce_graphics/juce_graphics.h:58:

  In file included from
  sonobus/deps/juce/modules/juce_events/juce_events.h:78:

  sonobus/deps/juce/modules/juce_events/messages/juce_ApplicationBase.h:221:39:
  warning: unused parameter 'url' [-Wunused-parameter]

      virtual void urlOpened(const URL& url)     { }
                                        ^

  1 warning generated.

  [ 25%] Building CXX object
  extras/Build/juceaide/CMakeFiles/juceaide.dir/__/juce_build_tools/juce_build_tools.cpp.o

  In file included from
  sonobus/deps/juce/extras/Build/juce_build_tools/juce_build_tools.cpp:35:

  In file included from
  sonobus/deps/juce/extras/Build/juce_build_tools/juce_build_tools.h:56:

  In file included from
  sonobus/deps/juce/modules/juce_gui_basics/juce_gui_basics.h:56:

  In file included from
  sonobus/deps/juce/modules/juce_graphics/juce_graphics.h:58:

  In file included from
  sonobus/deps/juce/modules/juce_events/juce_events.h:78:

  sonobus/deps/juce/modules/juce_events/messages/juce_ApplicationBase.h:221:39:
  warning: unused parameter 'url' [-Wunused-parameter]

      virtual void urlOpened(const URL& url)     { }
                                        ^

  1 warning generated.

  [ 37%] Building CXX object
  extras/Build/juceaide/CMakeFiles/juceaide.dir/__/__/__/modules/juce_gui_basics/juce_gui_basics.cpp.o

  In file included from
  sonobus/deps/juce/modules/juce_gui_basics/juce_gui_basics.cpp:46:

  In file included from
  sonobus/deps/juce/modules/juce_gui_basics/juce_gui_basics.h:56:

  In file included from
  sonobus/deps/juce/modules/juce_graphics/juce_graphics.h:58:

  In file included from
  sonobus/deps/juce/modules/juce_events/juce_events.h:78:

  sonobus/deps/juce/modules/juce_events/messages/juce_ApplicationBase.h:221:39:
  warning: unused parameter 'url' [-Wunused-parameter]

      virtual void urlOpened(const URL& url)     { }
                                        ^

  In file included from
  sonobus/deps/juce/modules/juce_gui_basics/juce_gui_basics.cpp:46:

  sonobus/deps/juce/modules/juce_gui_basics/juce_gui_basics.h:313:12:
  fatal error: 'X11/Xlib.h' file not found

    #include <X11/Xlib.h>
             ^~~~~~~~~~~~

  1 warning and 1 error generated.

  gmake[2]: ***
  [extras/Build/juceaide/CMakeFiles/juceaide.dir/build.make:104:
  extras/Build/juceaide/CMakeFiles/juceaide.dir/__/__/__/modules/juce_gui_basics/juce_gui_basics.cpp.o]
  Error 1

  gmake[1]: *** [CMakeFiles/Makefile2:131:
  extras/Build/juceaide/CMakeFiles/juceaide.dir/all] Error 2

  gmake: *** [Makefile:136: all] Error 2
phijazz commented 2 years ago

Isn't it because the programs are installed in /usr/local on freebsd, no?

locate Xlib.h /usr/local/include/X11/Xlib.h

hselasky commented 2 years ago

Yes, that's correct.

essej commented 2 years ago

Try running cmake with these options:

CFLAGS="-I/usr/local/include" CXXFLAGS="-I/usr/local/include" LDFLAGS="-L/usr/local/lib" cmake ..

That should get you headed in the right direction....

phijazz commented 2 years ago

Can we solve this by modifying the file deps/juce/extras/Build/juceaide/CMakeLists.txt ?

hselasky commented 2 years ago

From what I can see, FreeBSD sets a variable called CMAKE_PREFIX_PATH. If you could use that, would be great!

/usr/ports/Mk/Uses/localbase.mk:CONFIGURE_ENV+= CMAKE_PREFIX_PATH="${LOCALBASE}"

phijazz commented 2 years ago

Ok, when I make with these flags, I obtain these errors

CFLAGS="-I/usr/local/include" CXXFLAGS="-I/usr/local/include" LDFLAGS="-L/usr/local/lib" cmake ..

[ 72%] Building CXX object CMakeFiles/SonoBus.dir/Source/SonobusPluginProcessor.cpp.o
/usr/home/phil/work/sonobus-1.5.1/Source/SonobusPluginEditor.cpp:2471:14: warning: 'replaceWith' is deprecated: Use the replaceAll method instead, which will also replace the data when numBytes == 0. [-Wdeprecated-declarations]
data.replaceWith(filtxml.toUTF8(), filtxml.getNumBytesAsUTF8());
^
/usr/home/phil/work/sonobus-1.5.1/deps/juce/modules/juce_core/memory/juce_MemoryBlock.h:273:7: note: 'replaceWith' has been explicitly marked deprecated here [[deprecated ("Use the replaceAll method instead, which will also replace the data when numBytes == 0.")]]
^
/usr/home/phil/work/sonobus-1.5.1/Source/SonobusPluginEditor.cpp:2471:14: warning: 'replaceWith' is deprecated: Use the replaceAll method instead, which will also replace the data when numBytes == 0. [-Wdeprecated-declarations]
data.replaceWith(filtxml.toUTF8(), filtxml.getNumBytesAsUTF8());
^
/usr/home/phil/work/sonobus-1.5.1/deps/juce/modules/juce_core/memory/juce_MemoryBlock.h:273:7: note: 'replaceWith' has been explicitly marked deprecated here [[deprecated ("Use the replaceAll method instead, which will also replace the data when numBytes == 0.")]]
^
/usr/home/phil/work/sonobus-1.5.1/Source/SonobusPluginProcessor.cpp:159:43: error: member access into incomplete type 'struct sockaddr_in'
return &(((struct sockaddr_in)sa)->sin_addr);
^
/usr/home/phil/work/sonobus-1.5.1/Source/SonobusPluginProcessor.cpp:159:27: note: forward declaration of 'sockaddr_in'
return &(((struct sockaddr_in
)sa)->sin_addr);
^
/usr/home/phil/work/sonobus-1.5.1/Source/SonobusPluginProcessor.cpp:160:40: error: member access into incomplete type 'struct sockaddr_in6'
return &(((struct sockaddr_in6)sa)->sin6_addr);
^
/usr/home/phil/work/sonobus-1.5.1/Source/SonobusPluginProcessor.cpp:160:23: note: forward declaration of 'sockaddr_in6'
return &(((struct sockaddr_in6
)sa)->sin6_addr);
^
/usr/home/phil/work/sonobus-1.5.1/Source/SonobusPluginProcessor.cpp:166:42: error: member access into incomplete type 'struct sockaddr_in'
return (((struct sockaddr_in)sa)->sin_port);
^
/usr/home/phil/work/sonobus-1.5.1/Source/SonobusPluginProcessor.cpp:166:26: note: forward declaration of 'sockaddr_in'
return (((struct sockaddr_in
)sa)->sin_port);
^
/usr/home/phil/work/sonobus-1.5.1/Source/SonobusPluginProcessor.cpp:168:39: error: member access into incomplete type 'struct sockaddr_in6'
return (((struct sockaddr_in6)sa)->sin6_port);
^
/usr/home/phil/work/sonobus-1.5.1/Source/SonobusPluginProcessor.cpp:168:22: note: forward declaration of 'sockaddr_in6'
return (((struct sockaddr_in6
)sa)->sin6_port);
^
/usr/home/phil/work/sonobus-1.5.1/Source/SonobusPluginProcessor.cpp:392:101: error: invalid application of 'sizeof' to an incomplete type 'struct sockaddr_in' result = (int) ::sendto(endpoint->owner->getRawSocketHandle(), data, (size_t)size, 0, addr, sizeof(struct sockaddr_in));
^ ~~~~

/usr/home/phil/work/sonobus-1.5.1/Source/SonobusPluginProcessor.cpp:392:115: note: forward declaration of 'sockaddr_in'
result = (int) ::sendto(endpoint->owner->getRawSocketHandle(), data, (size_t)size, 0, addr, sizeof(struct sockaddr_in));
^
/usr/home/phil/work/sonobus-1.5.1/Source/SonobusPluginProcessor.cpp:8824:63: warning: 'createInputStream' is deprecated: New code should use the method which takes an InputStreamOptions argument instead. [-Wdeprecated-declarations]
reader = mFormatManager.createReaderFor (audioURL.createInputStream (false));
^
/usr/home/phil/work/sonobus-1.5.1/deps/juce/modules/juce_core/network/juce_URL.h:669:7: note: 'createInputStream' has been explicitly marked deprecated here
[[deprecated ("New code should use the method which takes an InputStreamOptions argument instead.")]]
^
1 warning and 5 errors generated.
gmake[2]: [CMakeFiles/SonoBus.dir/build.make:528 : CMakeFiles/SonoBus.dir/Source/SonobusPluginProcessor.cpp.o] Erreur 1
gmake[2]:
Attente des tâches non terminées....
[ 72%] Building CXX object CMakeFiles/SonoBusInst.dir/Source/SonobusPluginProcessor.cpp.o
1 warning generated.
gmake[1]: [CMakeFiles/Makefile2:161 : CMakeFiles/SonoBus.dir/all] Erreur 2
gmake[1]:
Attente des tâches non terminées....
[ 72%] Building CXX object CMakeFiles/SonoBusInst.dir/Source/VersionInfo.cpp.o
1 warning generated.
[ 73%] Building CXX object CMakeFiles/SonoBusInst.dir/deps/aoo/lib/src/client.cpp.o
/usr/home/phil/work/sonobus-1.5.1/Source/VersionInfo.cpp:30:54: warning: 'createInputStream' is deprecated: New code should use the method which takes an Inpu tStreamOptions argument instead. [-Wdeprecated-declarations]
return std::unique_ptr (downloadUrl.createInputStream (false, nullptr, nullptr,
^
/usr/home/phil/work/sonobus-1.5.1/deps/juce/modules/juce_core/network/juce_URL.h:669:7: note: 'createInputStream' has been explicitly marked deprecated here
[[deprecated ("New code should use the method which takes an InputStreamOptions argument instead.")]]
^
/usr/home/phil/work/sonobus-1.5.1/Source/VersionInfo.cpp:78:61: warning: 'createInputStream' is deprecated: New code should use the method which takes an Inpu tStreamOptions argument instead. [-Wdeprecated-declarations]
std::unique_ptr inStream (latestVersionURL.createInputStream (false, nullptr, nullptr, extraHeaders));
^
/usr/home/phil/work/sonobus-1.5.1/deps/juce/modules/juce_core/network/juce_URL.h:669:7: note: 'createInputStream' has been explicitly marked deprecated here
[[deprecated ("New code should use the method which takes an InputStreamOptions argument instead.")]]
^
2 warnings generated. [ 73%] Building CXX object CMakeFiles/SonoBusInst.dir/deps/aoo/lib/src/codec_opus.cpp.o

[ 73%] Building CXX object CMakeFiles/SonoBusInst.dir/deps/aoo/lib/src/codec_pcm.cpp.o
/usr/home/phil/work/sonobus-1.5.1/Source/SonobusPluginProcessor.cpp:159:43: error: member access into incomplete type 'struct sockaddr_in'
return &(((struct sockaddr_in)sa)->sin_addr);
^
/usr/home/phil/work/sonobus-1.5.1/Source/SonobusPluginProcessor.cpp:159:27: note: forward declaration of 'sockaddr_in'
return &(((struct sockaddr_in
)sa)->sin_addr);
^
/usr/home/phil/work/sonobus-1.5.1/Source/SonobusPluginProcessor.cpp:160:40: error: member access into incomplete type 'struct sockaddr_in6'
return &(((struct sockaddr_in6)sa)->sin6_addr);
^
/usr/home/phil/work/sonobus-1.5.1/Source/SonobusPluginProcessor.cpp:160:23: note: forward declaration of 'sockaddr_in6'
return &(((struct sockaddr_in6
)sa)->sin6_addr);
^
/usr/home/phil/work/sonobus-1.5.1/Source/SonobusPluginProcessor.cpp:166:42: error: member access into incomplete type 'struct sockaddr_in'
return (((struct sockaddr_in)sa)->sin_port);
^
/usr/home/phil/work/sonobus-1.5.1/Source/SonobusPluginProcessor.cpp:166:26: note: forward declaration of 'sockaddr_in'
return (((struct sockaddr_in
)sa)->sin_port);

/usr/home/phil/work/sonobus-1.5.1/Source/SonobusPluginProcessor.cpp:168:39: error: member access into incomplete type 'struct sockaddr_in6' return (((struct sockaddr_in6)sa)->sin6_port); ^ /usr/home/phil/work/sonobus-1.5.1/Source/SonobusPluginProcessor.cpp:168:22: note: forward declaration of 'sockaddr_in6' return (((struct sockaddr_in6)sa)->sin6_port); ^ /usr/home/phil/work/sonobus-1.5.1/Source/SonobusPluginProcessor.cpp:392:101: error: invalid application of 'sizeof' to an incomplete type 'struct sockaddr_in' result = (int) ::sendto(endpoint->owner->getRawSocketHandle(), data, (size_t)size, 0, addr, sizeof(struct sockaddr_in)); ^ ~~~~ /usr/home/phil/work/sonobus-1.5.1/Source/SonobusPluginProcessor.cpp:392:115: note: forward declaration of 'sockaddr_in' result = (int) ::sendto(endpoint->owner->getRawSocketHandle(), data, (size_t)size, 0, addr, sizeof(struct sockaddr_in)); ^ /usr/home/phil/work/sonobus-1.5.1/Source/SonobusPluginProcessor.cpp:8824:63: warning: 'createInputStream' is deprecated: New code should use the method which takes an InputStreamOptions argument instead. [-Wdeprecated-declarations] reader = mFormatManager.createReaderFor (audioURL.createInputStream (false)); ^ /usr/home/phil/work/sonobus-1.5.1/deps/juce/modules/juce_core/network/juce_URL.h:669:7: note: 'createInputStream' has been explicitly marked deprecated here [[deprecated ("New code should use the method which takes an InputStreamOptions argument instead.")]] ^ /usr/home/phil/work/sonobus-1.5.1/deps/aoo/lib/src/codec_pcm.cpp:56:25: warning: implicit conversion from 'int' to 'float' changes value from 2147483647 to 2147483648 [-Wimplicit-const-int-float-conversion] int32_t temp = in * 0x7fffffff + 0.5f; ~ ^~~~~~ /usr/home/phil/work/sonobus-1.5.1/deps/aoo/lib/src/codec_pcm.cpp:106:32: warning: implicit conversion from 'int' to 'float' changes value from 2147483647 to 2147483648 [-Wimplicit-const-int-float-conversion] return (aoo_sample)c.i32 / 0x7fffffff; ~ ^~~~~~ [ 74%] Building CXX object CMakeFiles/SonoBusInst.dir/deps/aoo/lib/src/common.cpp.o 2 warnings generated. [ 74%] Building CXX object CMakeFiles/SonoBusInst.dir/deps/aoo/lib/src/net_utils.cpp.o [ 74%] Building CXX object CMakeFiles/SonoBusInst.dir/deps/aoo/lib/src/server.cpp.o [ 75%] Building CXX object CMakeFiles/SonoBusInst.dir/deps/aoo/lib/src/sink.cpp.o 1 warning and 5 errors generated. gmake[2]: [CMakeFiles/SonoBusInst.dir/build.make:528 : CMakeFiles/SonoBusInst.dir/Source/SonobusPluginProcessor.cpp.o] Erreur 1 gmake[2]: Attente des tâches non terminées.... gmake[1]: [CMakeFiles/Makefile2:294 : CMakeFiles/SonoBusInst.dir/all] Erreur 2 gmake: [Makefile:136 : all] Erreur 2

hselasky commented 2 years ago

Try to add: #include <netinet/in.h>

To resolve the missing sockaddr_in/in6 structure.

phijazz commented 2 years ago

Yesss!

Now I have this " #error To build JUCE VST3 plug-ins on BSD you must use an external BSD-compatible VST3 SDK with JUCE_CUSTOM_VST3_SDK=1"

audio/vst3sdk is built, but I don't know where I should put JUCE_CUSTOM_VST3_SDK=1