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

Linux support #33

Open
dromer opened this issue May 14, 2023 · 26 comments
Open

Linux support #33

dromer opened this issue May 14, 2023 · 26 comments
Labels
enhancement New feature or request

Comments

@dromer
Copy link

dromer commented May 14, 2023

Duh.

@DamRsn DamRsn added the enhancement New feature or request label May 21, 2023
@DamRsn
Copy link
Owner

DamRsn commented May 21, 2023

Contributions are welcome 🙂

The building process should be very similar to OSx.

@gnac
Copy link

gnac commented Jul 24, 2023

I've made some steps to build this (and the /libonnxruntime-neuralnote dependency) in Linux.
At the moment, I've got NeuralNote compiling but it fails in the linker stage. I'll push what I have to my NeuralNote and onnxruntime lib forks. But in short, I'm currently stuck on the following error:

[100%] Built target NeuralNote_Standalone
/usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: libBasicPitchCNN.a(BasicPitchCNN.cpp.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/lib64/gcc/x86_64-suse-linux/12/../../../../x86_64-suse-linux/bin/ld: failed to set dynamic section sizes: bad value
collect2: error: ld returned 1 exit status

@gnac
Copy link

gnac commented Jul 25, 2023

I've created a (pull request](#44) that is dependent on a prebuilt onnxruntime library. It isn't building (linking errors) yet, but I figured its a place to start a discussion.
FWIW, I also have a pending pull request on the libonnx project which adds support for building the linux archive. You will probably need to pull this project to build an archive to test the linux build of this pull request.

@RustoMCSpit
Copy link

just tried running this on wine with yabridge on bitwig, it kinda works but the gui has a weird rendering issues which causes huge delay / latency

@dromer
Copy link
Author

dromer commented Jul 29, 2023

@RustoMCSpit but we have the source-code, so no need for wine.

Thnx for the work @gnac not sure if I'll be able to get your stuff tested, but looking forward to see it working!

@RustoMCSpit
Copy link

@RustoMCSpit but we have the source-code, so no need for wine.

Thnx for the work @gnac not sure if I'll be able to get your stuff tested, but looking forward to see it working!

no need for wine until it actually is supported you mean right?

@dromer
Copy link
Author

dromer commented Jul 29, 2023

@RustoMCSpit sure, if it works for you and you can play with the software that's great.

@RustoMCSpit
Copy link

@RustoMCSpit sure, if it works for you and you can play with the software that's great.

ehhh, 'works' but barely, very bugged

@RustoMCSpit
Copy link

yeah after a few days the app is pretty unbareable to work with through WINE, if the devs want to see it through they could collect crash reports they get and see whats going on

@dromer
Copy link
Author

dromer commented Jul 31, 2023

@RustoMCSpit if you want to go that route please open a separate ticket so we don't mix up topics.

I think it would make more sense to build the program for Linux then to try and debug wine issues.

@thelabcat
Copy link

Lemme know if this goes anywhere! RN it is only usable in a VM for me ;-(

@RustoMCSpit
Copy link

just to update, program still really weird on WINE after new update

@dromer
Copy link
Author

dromer commented Sep 16, 2023

@RustoMCSpit please open a separate topic on WINE, this request is about actual Linux builds and NOT any WINE work
around.

Lets not dilute either topic by cramming it into the same ticket.

@polygon
Copy link

polygon commented Oct 28, 2023

@gnac Did you get any further with this? I've also managed to build my own version of onnxruntime and actually got NeuralNote to compile. But right now it segfaults when starting. I've so far traced this back to this line of code (juce_XmlElement.cpp):

static const String juce_xmltextContentAttributeName ("text");

For some reason, this static variable is not initialized correctly and the pointer inside the string (to the actual text data) is a Null pointer so it crashes when it's being used (in this case, to parse the Linux fontconfig). Might just be a small issue with some JUCE settings required on Linux, I'm sifting through the things, but it's a pretty strange error.

@polygon
Copy link

polygon commented Oct 28, 2023

To me, this looks like a case of "static initialization fiasco". In NeuralNote/Lib/Components/UIDefines.h there are pointers to fonts declared like so:

// Fonts
const juce::Typeface::Ptr MONTSERRAT_BOLD =
    juce::Typeface::createSystemTypefaceFor(BinaryData::MontserratBold_ttf, BinaryData::MontserratBold_ttfSize);

const juce::Typeface::Ptr MONTSERRAT_SEMIBOLD =
    juce::Typeface::createSystemTypefaceFor(BinaryData::MontserratSemiBold_ttf, BinaryData::MontserratSemiBold_ttfSize);

const juce::Typeface::Ptr MONTSERRAT_REGULAR =
    juce::Typeface::createSystemTypefaceFor(BinaryData::MontserratRegular_ttf, BinaryData::MontserratRegular_ttfSize);

Under Linux, this triggers (unless JUCE_FONT_PATH is set) a font lookup that involves parsing /etc/fonts/fonts.conf using the XML parser. The XML parser has the static string initialization mentioned above. In my compiled variant, this static string has not been initialized when the createSystemTypefaceFor calls are being made. I guess this works for Windows and Mac because loading fonts there does not involve the XML parser. Still, this could be considered unsound (at least on Linux). I will try to work around this.

Setting JUCE_FONT_PATH seems to solve the problem and makes the program start. Seems to work well so far. I'm not sure why JUCE insists on parsing the fontconfig since this plugin only loads fonts from its local resources. But it's probably a simple patch to fix this (or just set JUCE_FONT_PATH environment to literally anything).

So in summary, it's working in Linux for me, note detection etc. is working as expected. Unfortunately, I cannot seem to get MIDI out of the plugin. I can start the dragging, but neither dropping it into my DAW (Bitwig), nor into the file browser seems to be doing anything.

@gnac
Copy link

gnac commented Oct 28, 2023

@polygon you've gotten further than I have. How did you resolve the linker issue?

@polygon
Copy link

polygon commented Oct 29, 2023

I don't remember running into this linker issue to be honest. I've uploaded my current state here: https://github.com/polygon/NeuralNote/tree/linux

I re-factored the UIDefines.h code into a singleton provider to work around the initialization order issues. Setting JUCE_FONT_PATH would solve the issue for running the program standalone but not when used as a plugin. With the refactoring, I also got things working in Bitwig.

I'm not currently using build.sh but just run CMake directly like so:

cmake -B build -DCMAKE_BUILD_TYPE="Release"
cmake --build build -j

This expects to have a Linux built libonnxruntime-neuralnote in place as well, similarly unpacked as described in the build.sh. I've also got this done, but it's still quite hacky and I'm in the process of writing scripts for all of this. So you can poke around if you want, but it's still all a bit hacky and I'm working on consolidating everything.

@CodesoundR
Copy link

I don't remember running into this linker issue to be honest. I've uploaded my current state here: https://github.com/polygon/NeuralNote/tree/linux

I re-factored the UIDefines.h code into a singleton provider to work around the initialization order issues. Setting JUCE_FONT_PATH would solve the issue for running the program standalone but not when used as a plugin. With the refactoring, I also got things working in Bitwig.

I'm not currently using build.sh but just run CMake directly like so:

cmake -B build -DCMAKE_BUILD_TYPE="Release"
cmake --build build -j

This expects to have a Linux built libonnxruntime-neuralnote in place as well, similarly unpacked as described in the build.sh. I've also got this done, but it's still quite hacky and I'm in the process of writing scripts for all of this. So you can poke around if you want, but it's still all a bit hacky and I'm working on consolidating everything.

Hi, and thanks so much for porting this beautiful project in Linux (I'm under Mint).
I ask you if you have any news on the script you proposed. I'm having a hard time figuring out how to install this softare...
thanks again!!!

@Ken-Andre
Copy link

I don't remember running into this linker issue to be honest. I've uploaded my current state here: https://github.com/polygon/NeuralNote/tree/linux
I re-factored the UIDefines.h code into a singleton provider to work around the initialization order issues. Setting JUCE_FONT_PATH would solve the issue for running the program standalone but not when used as a plugin. With the refactoring, I also got things working in Bitwig.
I'm not currently using build.sh but just run CMake directly like so:

cmake -B build -DCMAKE_BUILD_TYPE="Release"
cmake --build build -j

This expects to have a Linux built libonnxruntime-neuralnote in place as well, similarly unpacked as described in the build.sh. I've also got this done, but it's still quite hacky and I'm in the process of writing scripts for all of this. So you can poke around if you want, but it's still all a bit hacky and I'm working on consolidating everything.

Hi, and thanks so much for porting this beautiful project in Linux (I'm under Mint). I ask you if you have any news on the script you proposed. I'm having a hard time figuring out how to install this softare... thanks again!!!

Yes it will be really great.
Think that they had already started working on it.

@CodesoundR
Copy link

Yes it will be really great.
Think that they had already started working on it.

Thanks ..... I'm waiting.... ;-)

@polygon
Copy link

polygon commented Mar 12, 2024

I drove this a bit further and opened Pull Requests in both project components:

#85
tiborvass/libonnxruntime-neuralnote#2

However, communication quickly died down (or didn't happen), so I assumed that the maintainers were not interested in this. I finished the packaging for the Linux distribution of my choice (NixOS) and carried on. I'll give a short rundown on how to build this yourself, though. You will need to use my forks of libonnxruntime-neuralnote and NeuralNote. For both, you want the "Linux" branch.

I will link my Nix build recipes, since they are also a good indicator on the dependencies that you will need. You can ignore a lot of the CMake download links replacement, that is a Nix/NixOS peculiarity (no internet access during builds).

libonnxruntime-neuralnote (Nix-recipe)

Once you installed everything unter buildInputs, you just run the instructions under buildPhase . This should yield you a libonnxruntime-neuralnote.tar.gz which you will need in the next step.

NeuralNote (Nix-recipe)

Again, make sure you have all the tools and dependencies installed. Now, run all the steps under postPatch in the root-folder of the repo (in line 83, reference the tar.gz file from the build above). This also patches a Drag&Drop bug in JUCE. You then just run CMake like above and this should give you the final binary / plugin.

Hopefully this gets you started. Let me know if you get stuck anywhere.

@thelabcat
Copy link

Thanks for doing this.

@CodesoundR
Copy link

I drove this a bit further and opened Pull Requests in both project components:

#85 tiborvass/libonnxruntime-neuralnote#2

However, communication quickly died down (or didn't happen), so I assumed that the maintainers were not interested in this. I finished the packaging for the Linux distribution of my choice (NixOS) and carried on. I'll give a short rundown on how to build this yourself, though. You will need to use my forks of libonnxruntime-neuralnote and NeuralNote. For both, you want the "Linux" branch.

I will link my Nix build recipes, since they are also a good indicator on the dependencies that you will need. You can ignore a lot of the CMake download links replacement, that is a Nix/NixOS peculiarity (no internet access during builds).

libonnxruntime-neuralnote (Nix-recipe)

Once you installed everything unter buildInputs, you just run the instructions under buildPhase . This should yield you a libonnxruntime-neuralnote.tar.gz which you will need in the next step.

NeuralNote (Nix-recipe)

Again, make sure you have all the tools and dependencies installed. Now, run all the steps under postPatch in the root-folder of the repo (in line 83, reference the tar.gz file from the build above). This also patches a Drag&Drop bug in JUCE. You then just run CMake like above and this should give you the final binary / plugin.

Hopefully this gets you started. Let me know if you get stuck anywhere.

hello and thank you for your interest. But I don't understand how to install it on my Mint system....

@Ken-Andre
Copy link

Ken-Andre commented Mar 21, 2024 via email

@polygon
Copy link

polygon commented Mar 27, 2024

hello and thank you for your interest. But I don't understand how to install it on my Mint system....

These instructions are to build the project, distribution for specific Linux systems comes later. I'm very sorry, but I don't have the time to build and maintain packages for a Linux distribution I am not using myself. If you find someone who knows how to package for Ubuntu/Mint and is interested, I'm happy to assist getting things started.

@CodesoundR
Copy link

hello and thank you for your interest. But I don't understand how to install it on my Mint system....

These instructions are to build the project, distribution for specific Linux systems comes later. I'm very sorry, but I don't have the time to build and maintain packages for a Linux distribution I am not using myself. If you find someone who knows how to package for Ubuntu/Mint and is interested, I'm happy to assist getting things started.

Hi,
I wanted to thank you anyway for what you did. I try to see in the various formums if there is someone who can help us for this porting.... bye

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

No branches or pull requests

8 participants