MiguelMJ / MakeItPixel

Image processing tool to make images look like pixel art
MIT License
47 stars 6 forks source link

Unable to build on ARM #1

Open muuvmuuv opened 1 year ago

muuvmuuv commented 1 year ago

Seems like some symbols aren't compatible with ARM. SFML was installed with Homebrew, but I have also tried a release from GitHub.

This is the output g++ src/* -Iinclude -std=c++11 -o makeitpixel

In file included from src/Color.cpp:1:
include/Color.hpp:39:19: warning: anonymous non-C-compatible type given name for linkage purposes by typedef declaration; add a tag name here [-Wnon-c-typedef-for-linkage]
    typedef struct {
                  ^
                   HSV
include/Color.hpp:40:17: note: type is not C-compatible due to this default member initializer
        float h=0; /// Hue [0.0, 360.0)
                ^
include/Color.hpp:44:7: note: type is given name 'HSV' for linkage purposes by this typedef declaration
    } HSV;
      ^
1 warning generated.
In file included from src/Palette.cpp:1:
In file included from include/Palette.hpp:17:
include/Color.hpp:39:19: warning: anonymous non-C-compatible type given name for linkage purposes by typedef declaration; add a tag name here [-Wnon-c-typedef-for-linkage]
    typedef struct {
                  ^
                   HSV
include/Color.hpp:40:17: note: type is not C-compatible due to this default member initializer
        float h=0; /// Hue [0.0, 360.0)
                ^
include/Color.hpp:44:7: note: type is given name 'HSV' for linkage purposes by this typedef declaration
    } HSV;
      ^
1 warning generated.
In file included from src/Quantization.cpp:1:
In file included from include/Quantization.hpp:8:
In file included from include/Palette.hpp:17:
include/Color.hpp:39:19: warning: anonymous non-C-compatible type given name for linkage purposes by typedef declaration; add a tag name here [-Wnon-c-typedef-for-linkage]
    typedef struct {
                  ^
                   HSV
include/Color.hpp:40:17: note: type is not C-compatible due to this default member initializer
        float h=0; /// Hue [0.0, 360.0)
                ^
include/Color.hpp:44:7: note: type is given name 'HSV' for linkage purposes by this typedef declaration
    } HSV;
      ^
In file included from src/Quantization.cpp:1:
include/Quantization.hpp:50:19: warning: anonymous non-C-compatible type given name for linkage purposes by typedef declaration; add a tag name here [-Wnon-c-typedef-for-linkage]
    typedef struct{
                  ^
                   Matrix
include/Quantization.hpp:53:9: note: type is not C-compatible due to this member declaration
        int getHeight() const;
        ^~~~~~~~~~~~~~~~~~~~~
include/Quantization.hpp:56:7: note: type is given name 'Matrix' for linkage purposes by this typedef declaration
    } Matrix;
      ^
2 warnings generated.
In file included from src/main.cpp:14:
include/Color.hpp:39:19: warning: anonymous non-C-compatible type given name for linkage purposes by typedef declaration; add a tag name here [-Wnon-c-typedef-for-linkage]
    typedef struct {
                  ^
                   HSV
include/Color.hpp:40:17: note: type is not C-compatible due to this default member initializer
        float h=0; /// Hue [0.0, 360.0)
                ^
include/Color.hpp:44:7: note: type is given name 'HSV' for linkage purposes by this typedef declaration
    } HSV;
      ^
In file included from src/main.cpp:16:
include/Quantization.hpp:50:19: warning: anonymous non-C-compatible type given name for linkage purposes by typedef declaration; add a tag name here [-Wnon-c-typedef-for-linkage]
    typedef struct{
                  ^
                   Matrix
include/Quantization.hpp:53:9: note: type is not C-compatible due to this member declaration
        int getHeight() const;
        ^~~~~~~~~~~~~~~~~~~~~
include/Quantization.hpp:56:7: note: type is given name 'Matrix' for linkage purposes by this typedef declaration
    } Matrix;
      ^
src/main.cpp:34:12: warning: enumeration value 'PLAIN' not handled in switch [-Wswitch]
    switch(level){
           ^~~~~
src/main.cpp:34:12: note: add missing switch cases
    switch(level){
           ^
3 warnings generated.
Undefined symbols for architecture arm64:
  "sf::Color::Color(unsigned char, unsigned char, unsigned char, unsigned char)", referenced from:
      mipa::normalized(sf::Color const&, sf::Color const&, sf::Color const&) in Color-d04d9d.o
      mipa::grayScale(sf::Color const&) in Color-d04d9d.o
      mipa::lerp(sf::Color const&, sf::Color const&, float) in Color-d04d9d.o
      pixelize(sf::Image const&, unsigned int, unsigned int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in main-4c2867.o
      palette_to_file(std::__1::vector<sf::Color, std::__1::allocator<sf::Color> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int) in main-4c2867.o
      pixelize(sf::Image const&, unsigned int, unsigned int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::$_0::operator()(std::__1::vector<sf::Color, std::__1::allocator<sf::Color> > const&) const in main-4c2867.o
      main::$_7::operator()(sf::Color const&) const in main-4c2867.o
      ...
  "sf::Color::Color(unsigned int)", referenced from:
      mipa::operator>>(std::__1::basic_istream<char, std::__1::char_traits<char> >&, sf::Color&) in Color-d04d9d.o
      _main in main-4c2867.o
      main::$_4::operator()(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) const in main-4c2867.o
      main::$_5::operator()(std::__1::vector<sf::Color, std::__1::allocator<sf::Color> >) const in main-4c2867.o
  "sf::Color::Color()", referenced from:
      mipa::toRGB(mipa::HSV const&) in Color-d04d9d.o
      mipa::loadPalette(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in Palette-38c478.o
      void mipa::ditherOrdered<std::__1::function<sf::Color (sf::Color const&)> >(sf::Image&, std::__1::function<sf::Color (sf::Color const&)> const&, mipa::Matrix const&, double, float) in main-4c2867.o
  "sf::Image::loadFromFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
      _main in main-4c2867.o
  "sf::Image::create(unsigned int, unsigned int, sf::Color const&)", referenced from:
      pixelize(sf::Image const&, unsigned int, unsigned int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in main-4c2867.o
      palette_to_file(std::__1::vector<sf::Color, std::__1::allocator<sf::Color> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int) in main-4c2867.o
  "sf::Image::setPixel(unsigned int, unsigned int, sf::Color const&)", referenced from:
      pixelize(sf::Image const&, unsigned int, unsigned int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in main-4c2867.o
      normalize(sf::Image&) in main-4c2867.o
      palette_to_file(std::__1::vector<sf::Color, std::__1::allocator<sf::Color> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int) in main-4c2867.o
      void mipa::ditherFloydSteinberg<std::__1::function<sf::Color (sf::Color const&)> >(sf::Image&, std::__1::function<sf::Color (sf::Color const&)> const&, float) in main-4c2867.o
      void mipa::ditherOrdered<std::__1::function<sf::Color (sf::Color const&)> >(sf::Image&, std::__1::function<sf::Color (sf::Color const&)> const&, mipa::Matrix const&, double, float) in main-4c2867.o
      void mipa::directQuantize<std::__1::function<sf::Color (sf::Color const&)> >(sf::Image&, std::__1::function<sf::Color (sf::Color const&)> const&) in main-4c2867.o
      void mipa::ditherFloydSteinberg<std::__1::function<sf::Color (sf::Color const&)> >(sf::Image&, std::__1::function<sf::Color (sf::Color const&)> const&, float)::'lambda'(unsigned int, unsigned int, float)::operator()(unsigned int, unsigned int, float) const in main-4c2867.o
      ...
  "sf::Image::Image()", referenced from:
      pixelize(sf::Image const&, unsigned int, unsigned int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in main-4c2867.o
      palette_to_file(std::__1::vector<sf::Color, std::__1::allocator<sf::Color> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int) in main-4c2867.o
      _main in main-4c2867.o
  "sf::Image::~Image()", referenced from:
      pixelize(sf::Image const&, unsigned int, unsigned int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in main-4c2867.o
      palette_to_file(std::__1::vector<sf::Color, std::__1::allocator<sf::Color> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int) in main-4c2867.o
      _main in main-4c2867.o
  "sf::operator==(sf::Color const&, sf::Color const&)", referenced from:
      std::__1::__equal_to<sf::Color, sf::Color>::operator()(sf::Color const&, sf::Color const&) const in main-4c2867.o
  "sf::Color::toInteger() const", referenced from:
      mipa::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, sf::Color const&) in Color-d04d9d.o
  "sf::Image::saveToFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const", referenced from:
      palette_to_file(std::__1::vector<sf::Color, std::__1::allocator<sf::Color> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int) in main-4c2867.o
      _main in main-4c2867.o
  "sf::Image::getSize() const", referenced from:
      pixelize(sf::Image const&, unsigned int, unsigned int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in main-4c2867.o
      normalize(sf::Image&) in main-4c2867.o
      palette_to_file(std::__1::vector<sf::Color, std::__1::allocator<sf::Color> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int) in main-4c2867.o
      void mipa::ditherFloydSteinberg<std::__1::function<sf::Color (sf::Color const&)> >(sf::Image&, std::__1::function<sf::Color (sf::Color const&)> const&, float) in main-4c2867.o
      void mipa::ditherOrdered<std::__1::function<sf::Color (sf::Color const&)> >(sf::Image&, std::__1::function<sf::Color (sf::Color const&)> const&, mipa::Matrix const&, double, float) in main-4c2867.o
      void mipa::directQuantize<std::__1::function<sf::Color (sf::Color const&)> >(sf::Image&, std::__1::function<sf::Color (sf::Color const&)> const&) in main-4c2867.o
  "sf::Image::getPixel(unsigned int, unsigned int) const", referenced from:
      pixelize(sf::Image const&, unsigned int, unsigned int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in main-4c2867.o
      normalize(sf::Image&) in main-4c2867.o
      void mipa::ditherFloydSteinberg<std::__1::function<sf::Color (sf::Color const&)> >(sf::Image&, std::__1::function<sf::Color (sf::Color const&)> const&, float) in main-4c2867.o
      void mipa::ditherOrdered<std::__1::function<sf::Color (sf::Color const&)> >(sf::Image&, std::__1::function<sf::Color (sf::Color const&)> const&, mipa::Matrix const&, double, float) in main-4c2867.o
      void mipa::directQuantize<std::__1::function<sf::Color (sf::Color const&)> >(sf::Image&, std::__1::function<sf::Color (sf::Color const&)> const&) in main-4c2867.o
      void mipa::ditherFloydSteinberg<std::__1::function<sf::Color (sf::Color const&)> >(sf::Image&, std::__1::function<sf::Color (sf::Color const&)> const&, float)::'lambda'(unsigned int, unsigned int, float)::operator()(unsigned int, unsigned int, float) const in main-4c2867.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
MiguelMJ commented 1 year ago

Hello muuvmuuv Apart from the obvious problems with the code of MakeItPixel itself, there also seems to be a problem with symbols from SFML in the last part of the error message. Could you please tell me whether you are able to compile any other program that relies on SFML?

muuvmuuv commented 1 year ago

You are right, this seems to be SFML, created an issue there: https://github.com/SFML/SFML/issues/2204

MiguelMJ commented 1 year ago

Alright. I'm keeping this open to try to fix the other problems that do concern MIP. Thanks a lot for reporting!

muuvmuuv commented 1 year ago

I was finally able to build a simple program and ported it to MakeItPixel but still get a lot of errors. I also had to add -std=c++11 cause it tried to compile it with an old c++ std somehow.

g++ src/* -L/opt/homebrew/Cellar/sfml/2.5.1_2/lib -Iinclude -lsfml-graphics -std=c++11 -o makeitpixel
In file included from src/Color.cpp:1:
include/Color.hpp:39:19: warning: anonymous non-C-compatible type given name for linkage purposes by typedef declaration; add a tag name here [-Wnon-c-typedef-for-linkage]
    typedef struct {
                  ^
                   HSV
include/Color.hpp:40:17: note: type is not C-compatible due to this default member initializer
        float h=0; /// Hue [0.0, 360.0)
                ^
include/Color.hpp:44:7: note: type is given name 'HSV' for linkage purposes by this typedef declaration
    } HSV;
      ^
1 warning generated.
In file included from src/Palette.cpp:1:
In file included from include/Palette.hpp:17:
include/Color.hpp:39:19: warning: anonymous non-C-compatible type given name for linkage purposes by typedef declaration; add a tag name here [-Wnon-c-typedef-for-linkage]
    typedef struct {
                  ^
                   HSV
include/Color.hpp:40:17: note: type is not C-compatible due to this default member initializer
        float h=0; /// Hue [0.0, 360.0)
                ^
include/Color.hpp:44:7: note: type is given name 'HSV' for linkage purposes by this typedef declaration
    } HSV;
      ^
1 warning generated.
In file included from src/Quantization.cpp:1:
In file included from include/Quantization.hpp:8:
In file included from include/Palette.hpp:17:
include/Color.hpp:39:19: warning: anonymous non-C-compatible type given name for linkage purposes by typedef declaration; add a tag name here [-Wnon-c-typedef-for-linkage]
    typedef struct {
                  ^
                   HSV
include/Color.hpp:40:17: note: type is not C-compatible due to this default member initializer
        float h=0; /// Hue [0.0, 360.0)
                ^
include/Color.hpp:44:7: note: type is given name 'HSV' for linkage purposes by this typedef declaration
    } HSV;
      ^
In file included from src/Quantization.cpp:1:
include/Quantization.hpp:50:19: warning: anonymous non-C-compatible type given name for linkage purposes by typedef declaration; add a tag name here [-Wnon-c-typedef-for-linkage]
    typedef struct{
                  ^
                   Matrix
include/Quantization.hpp:53:9: note: type is not C-compatible due to this member declaration
        int getHeight() const;
        ^~~~~~~~~~~~~~~~~~~~~
include/Quantization.hpp:56:7: note: type is given name 'Matrix' for linkage purposes by this typedef declaration
    } Matrix;
      ^
2 warnings generated.
In file included from src/main.cpp:14:
include/Color.hpp:39:19: warning: anonymous non-C-compatible type given name for linkage purposes by typedef declaration; add a tag name here [-Wnon-c-typedef-for-linkage]
    typedef struct {
                  ^
                   HSV
include/Color.hpp:40:17: note: type is not C-compatible due to this default member initializer
        float h=0; /// Hue [0.0, 360.0)
                ^
include/Color.hpp:44:7: note: type is given name 'HSV' for linkage purposes by this typedef declaration
    } HSV;
      ^
In file included from src/main.cpp:16:
include/Quantization.hpp:50:19: warning: anonymous non-C-compatible type given name for linkage purposes by typedef declaration; add a tag name here [-Wnon-c-typedef-for-linkage]
    typedef struct{
                  ^
                   Matrix
include/Quantization.hpp:53:9: note: type is not C-compatible due to this member declaration
        int getHeight() const;
        ^~~~~~~~~~~~~~~~~~~~~
include/Quantization.hpp:56:7: note: type is given name 'Matrix' for linkage purposes by this typedef declaration
    } Matrix;
      ^
src/main.cpp:34:12: warning: enumeration value 'PLAIN' not handled in switch [-Wswitch]
    switch(level){
           ^
src/main.cpp:34:12: note: add missing switch cases
    switch(level){
           ^
3 warnings generated.