Strum / Strums_Mental_VCV_Modules

Strum's Mental Modules for VCV Rack
BSD 3-Clause "New" or "Revised" License
63 stars 15 forks source link

Compile problems on Mac on 0.4.0 source tree #18

Closed metaphorz closed 6 years ago

metaphorz commented 6 years ago

Strum: I just tried re-making this from your source but running into new issues. I'll include the make dump below in case you have ides on how to tweak the source:

$ make c++ -fPIC -I../../include -I../../dep/include -DVERSION=dev -DVERSION_dev -MMD -O3 -march=nocona -ffast-math -Wall -g -DARCH_MAC -mmacosx-version-min=10.7 -std=c++11 -stdlib=libc++ -c -o build/src/MentalABSwitches.cpp.o src/MentalABSwitches.cpp src/MentalABSwitches.cpp:45:23: error: no matching constructor for initialization of 'rack::Module' ...: Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS) {} ^ ~~~~~~~~~~~ ../../include/engine.hpp:43:2: note: candidate constructor not viable: requires 3 arguments, but 4 were provided Module(int numParams, int numInputs, int numOutputs) { ^ ../../include/engine.hpp:33:8: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 4 were provided struct Module { ^ ../../include/engine.hpp:41:2: note: candidate constructor not viable: requires 0 arguments, but 4 were provided Module() {} ^ src/MentalABSwitches.cpp:99:7: error: unknown type name 'lights'; did you mean 'Light'? lights[B_LEDS + i].value = 1.0; ^~ Light ../../include/app.hpp:162:8: note: 'Light' declared here struct Light : TransparentWidget { ^ src/MentalABSwitches.cpp:99:25: error: cannot use dot operator on a type lights[B_LEDS + i].value = 1.0; ^ src/MentalABSwitches.cpp:100:7: error: unknown type name 'lights'; did you mean 'Light'? lights[A_LEDS + i].value = 0.0; ^~ Light ../../include/app.hpp:162:8: note: 'Light' declared here struct Light : TransparentWidget { ^ src/MentalABSwitches.cpp:100:25: error: cannot use dot operator on a type lights[A_LEDS + i].value = 0.0; ^ src/MentalABSwitches.cpp:108:7: error: unknown type name 'lights'; did you mean 'Light'? lights[B_LEDS + i].value = 0.0; ^~ Light ../../include/app.hpp:162:8: note: 'Light' declared here struct Light : TransparentWidget { ^ src/MentalABSwitches.cpp:108:25: error: cannot use dot operator on a type lights[B_LEDS + i].value = 0.0; ^ src/MentalABSwitches.cpp:109:7: error: unknown type name 'lights'; did you mean 'Light'? lights[A_LEDS + i].value = 1.0; ^~ Light ../../include/app.hpp:162:8: note: 'Light' declared here struct Light : TransparentWidget { ^ src/MentalABSwitches.cpp:109:25: error: cannot use dot operator on a type lights[A_LEDS + i].value = 1.0; ^ src/MentalABSwitches.cpp:138:14: error: use of undeclared identifier 'createLight' addChild(createLight<MediumLight>(Vec(62, group_spacing ... ^ src/MentalABSwitches.cpp:138:38: error: use of undeclared identifier 'GreenLight' addChild(createLight<MediumLight>(Vec(62, group_spacing ... ^ src/MentalABSwitches.cpp:144:2: error: expected '}' } ^ src/MentalABSwitches.cpp:115:50: note: to match this '{' MentalABSwitchesWidget::MentalABSwitchesWidget() { ^ 12 errors generated. make: *** [build/src/MentalABSwitches.cpp.o] Error 1

Strum commented 6 years ago

@metaphorz try updating your rack code, or make a new copy if you want to keep your .04 code, the code in the repo now only works against the dev version.

I uploaded the code that should build under .04 in the /old_versions folder

metaphorz commented 6 years ago

@Strum: I've been building against this source-- tagged v0.4.0:

https://github.com/VCVRack/Rack/releases

so I am not using dev. Perhaps I should be.

I'll try the /old_versions and let you know what happens. Does this have the latest module(s) ?

Strum commented 6 years ago

yes the older version code in the zip file in the /old_version folder has the master clock, gate maker and patch notes and should build under .040

the new code will only work with the dev version and also has the new modules in it

metaphorz commented 6 years ago

Just tried building the old version. Still get errors. See if anything looks obvious from the dump:

src/MentalKnobs.cpp:79:21: error: call to 'abs' is ambiguous knob_value[i] = std::abs(knob_value[i]); ^~~~ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/stdlib.h:137:6: note: candidate function int abs(int) __pure2; ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/stdlib.h:115:44: note: candidate function inline _LIBCPP_INLINE_VISIBILITY long abs( long x) _NOEXCEPT ... ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/stdlib.h:117:44: note: candidate function inline _LIBCPP_INLINE_VISIBILITY long long abs(long long x) _NOEXCEPT ... ^ src/MentalKnobs.cpp:86:20: error: no member named 'round' in namespace 'std'; did you mean 'roundl'? octaves[i] = std::round(output_value[i]); ^~~~~~ roundl /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/math.h:491:20: note: 'roundl' declared here extern long double roundl(long double); ^ src/MentalKnobs.cpp:87:22: error: no member named 'round' in namespace 'std'; did you mean 'roundl'? semitones[i] = std::round((output_value[i] - octaves[i])*12); ^~~~~~ roundl /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/math.h:491:20: note: 'roundl' declared here extern long double roundl(long double); ^ src/MentalKnobs.cpp:94:30: error: no member named 'round' in namespace 'std'; did you mean 'roundl'? } else output_value[i] = std::round(output_value[i]); ^~~~~~ roundl /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/math.h:491:20: note: 'roundl' declared here extern long double roundl(long double); ^ src/MentalKnobs.cpp:97:22: error: no member named 'round' in namespace 'std'; did you mean 'roundl'? display_value[i] = std::round(output_value[i]); ^~~~~~ roundl /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/math.h:491:20: note: 'roundl' declared here extern long double roundl(long double); ^ 5 errors generated. make: *** [build/src/MentalKnobs.cpp.o] Error 1

Strum commented 6 years ago

sorry i don't have a mac or xcode, it's interpretation of the C++ standard is different from gcc i guess

just remove the std:: with a search and replace and use the suggested functions instead of the standard ones.

you could also install some shell tools and gcc and build it in a similar way you do for windows, there must be a mac system to do that.

metaphorz commented 6 years ago

Let me play around and see if I can get it to work. Yes, Gnu should be easily implementable.

metaphorz commented 6 years ago

Here is what I have right now. I removed std:: and that resolved several errors. I now get 2 errors, so getting closer! I ttried getting rid of std:: in front of getw or setw but now it complains of those functions or methods. Any suggested alternatives for getw or setw?

I checked with the group on the advsability of moving from Xcode to Gnu and was advised against it, so I'd like to see if I can compile this on the Mac using Xcode.

Let's see if we can work through this - it is close. ......

c++11 -stdlib=libc++ -c -o build/src/MentalKnobs.cpp.o src/MentalKnobs.cpp src/MentalKnobs.cpp:127:19: error: use of undeclared identifier 'setw'; did you mean 'getw'? to_display << setw(3) << value; ^~~~ getw /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/stdio.h:389:6: note: 'getw' declared here int getw(FILE ); ^ src/MentalKnobs.cpp:127:24: error: cannot initialize a parameter of type 'FILE ' (aka '__sFILE ') with an rvalue of type 'int' to_display << setw(3) << value; ^ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/stdio.h:389:17: note: passing argument to parameter here int getw(FILE ); ^ 2 errors generated.

metaphorz commented 6 years ago

I think I got it (for version 0.4.0 tagged source). Mainly it was a matter of removing a few things Strums_Mental_VCV_Modules_04h_source.zip

All 5 demo patches work

Strum commented 6 years ago

@metaphorz, good stuff, can you either make a pull request to add your build to the mac releases folder or upload it somewhere and I can add it?

metaphorz commented 6 years ago

Oops missed this one. I think if you click on that zip file, it is all there. It is unfortunately labeled "source" at the end, but it isn't the source-- it is the zip that Mac folks will need to download to run your modules on 0.4.0