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

sharp - G_STATIC_ASSERT error #3

Open
gmaclennan opened this issue Oct 2, 2018 · 3 comments
Open

sharp - G_STATIC_ASSERT error #3

gmaclennan opened this issue Oct 2, 2018 · 3 comments

Comments

@gmaclennan
Copy link

sharp is a fast low-memory image resizer that uses libvips. The error when compiling is in GNOME glib, it does look like some work has been done in glib for Android.

I created a minimal repo to repro the error, which is:

In file included from ../src/common.cc:25:
In file included from /usr/local/include/vips/vips8:35:
In file included from /usr/local/Cellar/glib/2.56.0/include/glib-2.0/glib-object.h:23:
In file included from /usr/local/Cellar/glib/2.56.0/include/glib-2.0/gobject/gbinding.h:28:
In file included from /usr/local/Cellar/glib/2.56.0/include/glib-2.0/glib.h:30:
In file included from /usr/local/Cellar/glib/2.56.0/include/glib-2.0/glib/galloca.h:32:
/usr/local/Cellar/glib/2.56.0/include/glib-2.0/glib/gtypes.h:423:3: error: '_GStaticAssertCompileTimeAssertion_0' declared as an array with a negative size
  G_STATIC_ASSERT(sizeof (unsigned long long) == sizeof (guint64));
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/Cellar/glib/2.56.0/include/glib-2.0/glib/gmacros.h:241:103: note: expanded from macro 'G_STATIC_ASSERT'
#define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1] G_GNUC_UNUSED
                                                                                                      ^~~~~~~~~~~~~~~
../src/common.cc:374:25: warning: comparison 'int' > 2147483647 is always false [-Wtautological-constant-compare]
      if (image.width() > 2147483647 || image.height() > 2147483647) {
          ~~~~~~~~~~~~~ ^ ~~~~~~~~~~
../src/common.cc:374:56: warning: comparison 'int' > 2147483647 is always false [-Wtautological-constant-compare]
      if (image.width() > 2147483647 || image.height() > 2147483647) {
                                        ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~
2 warnings and 1 error generated.
make: *** [Release/obj.target/sharp/src/common.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
@jaimecbernardo
Copy link
Collaborator

Hi @gmaclennan , Thank you for sharing the build error in this module.

From the errors presented, it sounds like there's a static assert that's failing when trying to build for Android 32 bits: /usr/local/Cellar/glib/2.56.0/include/glib-2.0/glib/gtypes.h:423:3 error.

Also, if you're using a system installed library as a dependency for the module, it might not work, since it needs to be a library that's able to run in Android. A local version of the library that's able to support Android could be needed.

Please let us know if you're able to make this module work.

@gmaclennan
Copy link
Author

gmaclennan commented Oct 30, 2018

This is now fixed in glib 2.58.1 and this part of the build works. I am now hitting another error:

/Users/gregor/Dev/DdDev/nodejs-mobile-sharp/android/build/standalone-toolchains/arm-linux-androideabi/bin/arm-linux-androideabi-clang++ '-DNODE_GYP_MODULE_NAME=sharp' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DNODE_ENGINE="v8"' '-DNODE_ENGINE_V8' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DBUILDING_NODE_EXTENSION' '-D_GLIBCXX_USE_C99_MATH' -I/Users/gregor/Dev/DdDev/nodejs-mobile-sharp/node_modules/nodejs-mobile-react-native/android/libnode/include/node -I/Users/gregor/Dev/DdDev/nodejs-mobile-sharp/node_modules/nodejs-mobile-react-native/android/libnode/src -I/Users/gregor/Dev/DdDev/nodejs-mobile-sharp/node_modules/nodejs-mobile-react-native/android/libnode/deps/uv/include -I/Users/gregor/Dev/DdDev/nodejs-mobile-sharp/node_modules/nodejs-mobile-react-native/android/libnode/deps/v8/include -I../node_modules/nan -I/usr/local/include -I/usr/include/libxml2 -I/usr/local/Cellar/vips/8.7.0_1/include -I/usr/local/Cellar/libgsf/1.14.44/include/libgsf-1 -I/usr/local/Cellar/fftw/3.3.8/include -I/usr/local/Cellar/graphicsmagick/1.3.30/include/GraphicsMagick -I/usr/local/Cellar/orc/0.4.28/include/orc-0.4 -I/usr/local/Cellar/little-cms2/2.9/include -I/usr/local/Cellar/poppler/0.70.1/include/poppler/glib -I/usr/local/Cellar/poppler/0.70.1/include/poppler -I/usr/local/Cellar/librsvg/2.44.8/include/librsvg-2.0 -I/usr/local/Cellar/gdk-pixbuf/2.38.0/include/gdk-pixbuf-2.0 -I/usr/local/Cellar/cairo/1.16.0/include/cairo -I/usr/local/Cellar/pixman/0.34.0_1/include/pixman-1 -I/usr/local/Cellar/webp/1.0.0/include -I/usr/local/Cellar/pango/1.42.4/include/pango-1.0 -I/usr/local/Cellar/harfbuzz/2.0.2/include/harfbuzz -I/usr/local/Cellar/graphite2/1.3.12/include -I/usr/local/Cellar/fribidi/1.0.5/include/fribidi -I/usr/local/Cellar/fontconfig/2.13.1/include -I/usr/local/opt/freetype/include/freetype2 -I/usr/local/Cellar/libtiff/4.0.9_4/include -I/usr/local/Cellar/libpng/1.6.35/include/libpng16 -I/usr/local/Cellar/jpeg/9c/include -I/usr/local/Cellar/libexif/0.6.21/include -I/usr/local/Cellar/glib/2.58.1/include/glib-2.0 -I/usr/local/Cellar/glib/2.58.1/lib/glib-2.0/include -I/usr/local/opt/gettext/include  -Wall -Wextra -Wno-unused-parameter -O3 -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++0x -std=c++0x -fexceptions -Wall -O3 -MMD -MF ./Release/.deps/Release/obj.target/sharp/src/sharp.o.d.raw   -c -o Release/obj.target/sharp/src/sharp.o ../src/sharp.cc
/Users/gregor/Dev/DdDev/nodejs-mobile-sharp/android/build/standalone-toolchains/arm-linux-androideabi/bin/arm-linux-androideabi-clang++ '-DNODE_GYP_MODULE_NAME=sharp' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DNODE_ENGINE="v8"' '-DNODE_ENGINE_V8' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DBUILDING_NODE_EXTENSION' '-D_GLIBCXX_USE_C99_MATH' -I/Users/gregor/Dev/DdDev/nodejs-mobile-sharp/node_modules/nodejs-mobile-react-native/android/libnode/include/node -I/Users/gregor/Dev/DdDev/nodejs-mobile-sharp/node_modules/nodejs-mobile-react-native/android/libnode/src -I/Users/gregor/Dev/DdDev/nodejs-mobile-sharp/node_modules/nodejs-mobile-react-native/android/libnode/deps/uv/include -I/Users/gregor/Dev/DdDev/nodejs-mobile-sharp/node_modules/nodejs-mobile-react-native/android/libnode/deps/v8/include -I../node_modules/nan -I/usr/local/include -I/usr/include/libxml2 -I/usr/local/Cellar/vips/8.7.0_1/include -I/usr/local/Cellar/libgsf/1.14.44/include/libgsf-1 -I/usr/local/Cellar/fftw/3.3.8/include -I/usr/local/Cellar/graphicsmagick/1.3.30/include/GraphicsMagick -I/usr/local/Cellar/orc/0.4.28/include/orc-0.4 -I/usr/local/Cellar/little-cms2/2.9/include -I/usr/local/Cellar/poppler/0.70.1/include/poppler/glib -I/usr/local/Cellar/poppler/0.70.1/include/poppler -I/usr/local/Cellar/librsvg/2.44.8/include/librsvg-2.0 -I/usr/local/Cellar/gdk-pixbuf/2.38.0/include/gdk-pixbuf-2.0 -I/usr/local/Cellar/cairo/1.16.0/include/cairo -I/usr/local/Cellar/pixman/0.34.0_1/include/pixman-1 -I/usr/local/Cellar/webp/1.0.0/include -I/usr/local/Cellar/pango/1.42.4/include/pango-1.0 -I/usr/local/Cellar/harfbuzz/2.0.2/include/harfbuzz -I/usr/local/Cellar/graphite2/1.3.12/include -I/usr/local/Cellar/fribidi/1.0.5/include/fribidi -I/usr/local/Cellar/fontconfig/2.13.1/include -I/usr/local/opt/freetype/include/freetype2 -I/usr/local/Cellar/libtiff/4.0.9_4/include -I/usr/local/Cellar/libpng/1.6.35/include/libpng16 -I/usr/local/Cellar/jpeg/9c/include -I/usr/local/Cellar/libexif/0.6.21/include -I/usr/local/Cellar/glib/2.58                                                         .1/include/glib-2.0 -I/usr/local/Cellar/glib/2.58.1/lib/glib-2.0/include -I/usr/local/opt/gettext/include  -Wall -Wextra -Wno-unused-parameter -O3 -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++0x -std=c++0x -fexceptions -Wall -O3 -MMD -MF ./Release/.deps/Release/obj.target/sharp/src/utilities.o.d.raw   -c -o Release/obj.target/sharp/src/utilities.o ../src/utilities.cc
/Users/gregor/Dev/DdDev/nodejs-mobile-sharp/android/build/standalone-toolchains/arm-linux-androideabi/bin/arm-linux-androideabi-clang++ -shared -rdynamic -fPIC  -Wl,-soname=sharp.node -o Release/obj.target/sharp.node -Wl,--start-group Release/obj.target/sharp/src/common.o Release/obj.target/sharp/src/metadata.o Release/obj.target/sharp/src/stats.o Release/obj.target/sharp/src/operations.o Release/obj.target/sharp/src/pipeline.o Release/obj.target/sharp/src/sharp.o Release/obj.target/sharp/src/utilities.o -Wl,--end-group -L/usr/local/Cellar/vips/8.7.0_1/lib -L/usr/local/Cellar/glib/2.58.1/lib -L/usr/local/opt/gettext/lib -lvips-cpp -lvips -lgobject-2.0 -lglib-2.0 -lintl -Wl,-framework -Wl,CoreFoundation -llog /Users/gregor/Dev/DdDev/nodejs-mobile-sharp/node_modules/nodejs-mobile-react-native/android/libnode//bin/armeabi-v7a/libnode.so
/Users/gregor/Dev/DdDev/nodejs-mobile-sharp/android/build/standalone-toolchains/arm-linux-androideabi/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot open CoreFoundation: No such file or directory
/Users/gregor/Dev/DdDev/nodejs-mobile-sharp/android/build/standalone-toolchains/arm-linux-androideabi/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: vips-cpp: no archive symbol table (run ranlib)
/Users/gregor/Dev/DdDev/nodejs-mobile-sharp/android/build/standalone-toolchains/arm-linux-androideabi/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: vips: no archive symbol table (run ranlib)
/Users/gregor/Dev/DdDev/nodejs-mobile-sharp/android/build/standalone-toolchains/arm-linux-androideabi/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: gobject-2.0: no archive symbol table (run ranlib)
/Users/gregor/Dev/DdDev/nodejs-mobile-sharp/android/build/standalone-toolchains/arm-linux-androideabi/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: glib-2.0: no archive symbol table (run ranlib)
/Users/gregor/Dev/DdDev/nodejs-mobile-sharp/android/build/standalone-toolchains/arm-linux-androideabi/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: intl: no archive symbol table (run ranlib)
clang60++: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Release/obj.target/sharp.node] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/gregor/Dev/DdDev/nodejs-mobile-sharp/node_modules/nodejs-mobile-gyp/lib/build.js:258:23)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Darwin 18.0.0
gyp ERR! command "/Users/gregor/.nvm/versions/node/v8.12.0/bin/node" "/Users/gregor/Dev/DdDev/nodejs-mobile-sharp/node_modules/nodejs-mobile-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/gregor/Dev/DdDev/nodejs-mobile-sharp/android/build/nodejs-native-assets-temp-build/nodejs-native-assets-armeabi-v7a/nodejs-project/node_modules/sharp
gyp ERR! node -v v8.12.0
gyp ERR! node-gyp -v v0.2.0
gyp ERR! not ok
npm verb lifecycle sharp@0.20.8~install: unsafe-perm in lifecycle true
npm verb lifecycle sharp@0.20.8~install: PATH: /Users/gregor/.nvm/versions/node/v8.12.0/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/gregor/Dev/DdDev/nodejs-mobile-sharp/android/build/nodejs-native-assets-temp-build/nodejs-native-assets-armeabi-v7a/nodejs-project/node_modules/sharp/node_modules/.bin:/Users/gregor/Dev/DdDev/nodejs-mobile-sharp/android/build/nodejs-native-assets-temp-build/nodejs-native-assets-armeabi-v7a/nodejs-project/node_modules/.bin:/Users/gregor/Dev/DdDev/nodejs-mobile-sharp/android/../nodejs-assets/nodejs-project/node_modules/.bin:/usr/local/opt/gdal2/bin:/usr/local/bin/google-cloud-sdk/bin:/Users/gregor/.rvm/gems/ruby-2.2.1/bin:/Users/gregor/.rvm/gems/ruby-2.2.1@global/bin:/Users/gregor/.rvm/rubies/ruby-2.2.1/bin:/Users/gregor/.nvm/versions/node/v8.12.0/bin:~/Library/Android/sdk/tools:~/Library/Android/sdk/platform-tools:/usr/local/bin:/usr/local/sbin:/usr/local/share/npm/bin:~/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Users/gregor/go/bin:/usr/local/opt/go/libexec/bin:/Users/gregor/.rvm/bin
npm verb lifecycle sharp@0.20.8~install: CWD: /Users/gregor/Dev/DdDev/nodejs-mobile-sharp/android/build/nodejs-native-assets-temp-build/nodejs-native-assets-armeabi-v7a/nodejs-project/node_modules/sharp
npm info lifecycle sharp@0.20.8~install: Failed to exec install script
npm verb stack Error: sharp@0.20.8 install: `(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)`
npm verb stack Exit status 1
npm verb stack     at EventEmitter.<anonymous> (/Users/gregor/.nvm/versions/node/v8.12.0/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
npm verb stack     at emitTwo (events.js:126:13)
npm verb stack     at EventEmitter.emit (events.js:214:7)
npm verb stack     at ChildProcess.<anonymous> (/Users/gregor/.nvm/versions/node/v8.12.0/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
npm verb stack     at emitTwo (events.js:126:13)
npm verb stack     at ChildProcess.emit (events.js:214:7)
npm verb stack     at maybeClose (internal/child_process.js:915:16)
npm verb stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
npm verb pkgid sharp@0.20.8
npm verb cwd /Users/gregor/Dev/DdDev/nodejs-mobile-sharp/android/build/nodejs-native-assets-temp-build/nodejs-native-assets-armeabi-v7a/nodejs-project
npm verb Darwin 18.0.0
npm verb argv "/Users/gregor/.nvm/versions/node/v8.12.0/bin/node" "/Users/gregor/.nvm/versions/node/v8.12.0/bin/npm" "--verbose" "rebuild" "--build-from-source"
npm verb node v8.12.0
npm verb npm  v6.4.1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sharp@0.20.8 install: `(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sharp@0.20.8 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm verb exit [ 1, true ]
npm timing npm Completed in 28770ms

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/gregor/.npm/_logs/2018-10-30T00_44_41_034Z-debug.log
:nodejs-mobile-react-native:BuildNpmModulesarmeabi-v7a FAILED

FAILURE: Build failed with an exception.

@jaimecbernardo
Copy link
Collaborator

The error seems to be that the linker is not finding the symbol table on the object files it's trying to build with.
This might be because the plugin is trying to use libraries that are installed on the system instead of libraries that are built for Android.

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

No branches or pull requests

2 participants