RobinSchmidt / RS-MET

Codebase for RS-MET products (Robin Schmidt's Music Engineering Tools)
Other
56 stars 6 forks source link

cannot build on OS X, missing definitions #36

Closed elanhickler closed 7 years ago

elanhickler commented 7 years ago

see thread: https://forum.juce.com/t/abs-rand-randmax-etc-functions-on-os-x-not-found/22856

elanhickler commented 7 years ago

please add me to the contributor list for RS-MET so we can finally fix the OS X issues.

there's a handful more bad errors than just this.

RobinSchmidt commented 7 years ago

i have now included stdlib.h in rosic.h - this should contain the missing definitions and it seems to be automatically included anywhere but on osx. i really really really need to review any change to my library before i drag them into the repository. it's not safe to assume that you can make a change here or there without breaking anything else (even if it seems so at first). so, can you work on your fork and pass me the desired changes? maybe, you can upload your fork to your gitlab and give me the link? however, i think, i'll set myself up with a mac build-system next week. after all, i want a mac version of my chainer, too

...i need to make my new mini-pc my main workstation. then i can also work directly on prettyscope on a proper desk (it sucks to work on the big screen without desk...i.e. sitting in an armchair with a plank for keyboard and mouse)

elanhickler commented 7 years ago

in jura_AudioPlugin.cpp

bool AudioPlugin::setPreferredBusArrangement(bool isInput, int bus, const AudioChannelSet& preferredSet)

no definition for this function in AudioPlugin, comment it out, or i think it's override that is causing the problem, there's no function to override

elanhickler commented 7 years ago

imageDrawer.cpp

swap should be std::swap

elanhickler commented 7 years ago

ImagePainter.cpp

move your template functions to ImagePainter.h

y u do dis robin!!!

RobinSchmidt commented 7 years ago

ok - i'll add these changes tomorrow...keep posting. ... i know, much of this stuff seems innocuous enough...but only i know the quirks of my code

elanhickler commented 7 years ago

romos_AudioConnection.h

AudioConnection::AudioConnection(Module sourceModule = NULL, int outputIndex = 0, Module targetModule = NULL, int inputIndex = 0);

change to

AudioConnection(Module sourceModule = NULL, int outputIndex = 0, Module targetModule = NULL, int inputIndex = 0);

(just remove AudioConnection:: i believe)

elanhickler commented 7 years ago

romos_ModuleTypeRegistry.h ModuleTypeRegistry::ModuleTypeRegistry(); -> remove ModuleTypeRegistry::

romos_ProcessingStatus.h VoiceAllocator::VoiceAllocator(); -> remove ProcessingStatus::

romos_VoiceAllocator.h VoiceAllocator::VoiceAllocator(); -> remove VoiceAllocator::

romos_InfrastructuralModules.h virtual void ParameterModule::setValueFromController(double controllerValue); -> remove ParameterModule::

elanhickler commented 7 years ago

tnt_sparse_matrix_csr.h

template <class T>
Sparse_Matrix_CompRow<T>::Sparse_Matrix_CompRow(int M, int N, int nz,
    const T *val, const int *r, const int *c) : val_(nz,val), 
        rowptr_(M, r), colind_(nz, c), dim1_(M), dim2_(N) {}

rowptr(M, r), colind(nz, c) should be rowptr(M, *r), colind(nz, *c)

elanhickler commented 7 years ago

kiss_fft.h had to comment out #include <malloc.h> get malloc from

rosic.h had to comment out #include <malloc.h> get malloc from

elanhickler commented 7 years ago

jura_Editor.h

juce::Array<Rectangle > guiLayoutRectangles;

Rectangle needs namespace, add juce::

RobinSchmidt commented 7 years ago

ok - i applied a batch of changes (some a little different from what you suggested):

imageDrawer.cpp swap should be std::swap

->replaced by rsSwap

romos_AudioConnection.h AudioConnection::AudioConnection(Module sourceModule = NULL, int outputIndex = 0, Module targetModule = NULL, int inputIndex = 0); change to AudioConnection(Module sourceModule = NULL, int outputIndex = 0, Module targetModule = NULL, int inputIndex = 0); (just remove AudioConnection:: i believe)

->done

romos_ModuleTypeRegistry.h ModuleTypeRegistry::ModuleTypeRegistry(); -> remove ModuleTypeRegistry:: romos_ProcessingStatus.h VoiceAllocator::VoiceAllocator(); -> remove ProcessingStatus:: romos_VoiceAllocator.h VoiceAllocator::VoiceAllocator(); -> remove VoiceAllocator:: romos_InfrastructuralModules.h virtual void ParameterModule::setValueFromController(double controllerValue); -> remove ParameterModule::

->done

tnt_sparse_matrix_csr.h template Sparse_Matrix_CompRow::Sparse_MatrixCompRow(int M, int N, int nz, const T val, const int r, const int *c) : val(nz,val), rowptr(M, r), colind(nz, c), dim1(M), dim2(N) {} rowptr(M, r), colind(nz, c) should be rowptr(M, *r), colind(nz, *c)

->removed TNT dependency (singular value decomposition commented out)

jura_Editor.h juce::Array guiLayoutRectangles; Rectangle needs namespace, add juce::

->done

kiss_fft.h had to comment out #include get malloc from

->done

RobinSchmidt commented 7 years ago

some other changes need further consideration:

rosic.h had to comment out #include get malloc from

->breaks windows codeblocks project due to alloca (probably linux too - need to try)

in jura_AudioPlugin.cpp bool AudioPlugin::setPreferredBusArrangement(bool isInput, int bus, const AudioChannelSet& preferredSet) no definition for this function in AudioPlugin, comment it out, or i think it's override that is causing the problem, there's no function to override

-> commenting out triggers assertion with msvc

ImagePainter.cpp move your template functions to ImagePainter.h y u do dis robin!!!

-> no good idea: (non-inlined) template functions in headers easily lead to "multiple definition" linker errors

RobinSchmidt commented 7 years ago

what error messages do these produce? there must be different ways to solve these issues without introducing other issues...or maybe just wait until i have my own mac build system and sort these out myself...

elanhickler commented 7 years ago

ImagePainter.cpp move your template functions to ImagePainter.h y u do dis robin!!!

-> no good idea: (non-inlined) template functions in headers easily lead to "multiple definition" linker errors

why did you define your own abs

RobinSchmidt commented 7 years ago

where did i? probably because i needed a template-based version. not sure. where is it?

elanhickler commented 7 years ago

oh, nevermind abs.

template inline int roundToInt(T x) { return ipart(x + 0.5f); } template inline void swap(T& x, T& y) { T t = x; x = y; y = t; }

definitely those are redifinitions

elanhickler commented 7 years ago

use std::swap

RobinSchmidt commented 7 years ago

ahh...these come from copying over the wu algorithm from wikipedia at the point where this source file didn't have access to the other definitions. can probably be removed now. but shouldn't be an issue

elanhickler commented 7 years ago

some other changes need further consideration:

rosic.h had to comment out #include get malloc from

->breaks windows codeblocks project due to alloca (probably linux too - need to try)

then do ifdefs

alloca should never be used

RobinSchmidt commented 7 years ago

using rsSwap now

RobinSchmidt commented 7 years ago

ok, i have wrapped #include into "#ifndef APPLE" in rosic.h

RobinSchmidt commented 7 years ago

..äähh...the software here apparently automatically converts double underscores to boldface

RobinSchmidt commented 7 years ago

...and messes up other things in other ways

elanhickler commented 7 years ago

last few issues

Libraries/JUCE/modules/rapt/Visualization/Graphics/ImageDrawer.cpp roundToInt undefined in 3 places

Libraries/JUCE/modules/jura_framework/audio/jura_AudioPlugin.h const AudioChannelSet& preferredSet) override; get rid of override, there's no function to override.

Libraries/JUCE/modules/jura_framework/audio/jura_AudioPlugin.cpp line 218 remove AudioProcessor:: you shouldn't put a class namespace within its own scope!

elanhickler commented 7 years ago

oh i see, once it's not overridden then that becomes a problem.

RobinSchmidt commented 7 years ago

this is weird - there is a setPreferredBusArrangement baseclass function: juce_AudioProcessor.h, line 338

RobinSchmidt commented 7 years ago

Libraries/JUCE/modules/jura_framework/audio/jura_AudioPlugin.cpp line 218 remove AudioProcessor:: you shouldn't put a class namespace within its own scope!

this is actually a call to the baseclass method

RobinSchmidt commented 7 years ago

without the baseclass qualifier, i'd have an infinite recursion (the function would call itself) ;-) ...i.e. stack-overflow

elanhickler commented 7 years ago

what does that function do anyway? do I need it right now?

also define those roundToInts please!!! that's the almost last issue.

The you have a billion warnings to go through once you get your mac running.

RobinSchmidt commented 7 years ago

i trigger an assertion error if i don't override it - look at the comment in the cpp file. build a plugin with msvc, plug it in: BÄM: jassert(blah) gets triggered. ...at least in my chainer. does it not happen in your plugins?

RobinSchmidt commented 7 years ago

alloca should never be used

hmm...well - this was an optimization for some performance critical code. stack memory is (much) faster to allocate than heap memory. i may try to get rid of this

elanhickler commented 7 years ago

ok then keep alloca, it's not an issue anymore

RobinSchmidt commented 7 years ago

i think, a better way to deal with the situation when a performance critical (i.e. supposed to be used inside realtime code) function needs some temporary auxilliary memory would be to pass a "workArea" pointer. this could be even more efficient than alloca....but also more inconvenient on the client code side (which must maintain the workArea memory).....i want to use this idiom for low-level math/dsp functions in rapt

RobinSchmidt commented 7 years ago

Libraries/JUCE/modules/rapt/Visualization/Graphics/ImageDrawer.cpp roundToInt undefined in 3 places

using rsRoundToInt now

RobinSchmidt commented 7 years ago

...soo the last one is setPreferredBusArrangement now?

elanhickler commented 7 years ago

yes, except rsRoundToInt is not found in mac osx... but no idea why. Can't give any suggetions.

elanhickler commented 7 years ago

I think your includes are somehow structured wrong. When I go to definition in MSVC or in XCode it goes to Breakpoint Modulator

D:_PROGRAMMING\RS-MET\Libraries\JUCE\modules\rapt\Modulators\Envelopes\BreakpointModulator.cpp

that's where it thinks it's defined.

elanhickler commented 7 years ago

when i hover my mouse over it in MSVC it says RAPT::roundToInt

wtfffffffff

elanhickler commented 7 years ago

I would get rid of RoindToInt in the breakpointmodulator and go from there

RobinSchmidt commented 7 years ago

oh! i get warnings (but not errors) related to that in windows/codeblocks, too

RobinSchmidt commented 7 years ago

yeah...i'll try to get rid of these "preliminary" implementations there

RobinSchmidt commented 7 years ago

ok - moved and templatized the rsRoundToInt function. compiles now without warning over here

elanhickler commented 7 years ago

ok, only issue is the setPreferredBusArrangement now

RobinSchmidt commented 7 years ago

this is really a weirdo. the function is clearly declared in juce::AudioProcessor...even implemented - i even call the baseclass implementation from my overriden implementation. ...so you say, the error goes away, when i just remove the "override" tag from the declaration?

elanhickler commented 7 years ago

remove override and remove the class namespace in the function call

RobinSchmidt commented 7 years ago

as i told you above: the baseclass qualifier in the function call is intentional and important. without it, it could run into an infinite recursion, i.e. give a stack-overflow runtime error

RobinSchmidt commented 7 years ago

not only "could" it, it actually does - i just tried it

RobinSchmidt commented 7 years ago

is there something ifdeffed in the baseclass or something? i just looked but found nothing

RobinSchmidt commented 7 years ago

what does the compiler error actually say?