Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

geojsonvt.o is not an object file (not allowed in a library) #2348

Closed
mikemorris opened this issue Sep 16, 2015 · 10 comments · Fixed by #2349
Closed

geojsonvt.o is not an object file (not allowed in a library) #2348

mikemorris opened this issue Sep 16, 2015 · 10 comments · Fixed by #2349
Labels
Android Mapbox Maps SDK for Android build macOS Mapbox Maps SDK for macOS

Comments

@mikemorris
Copy link
Contributor

When running V=1 make android on OS X, the geojsonvt mason build fails with the following errors:

17:09:17 mikemorris:~/Projects/mapbox-gl-native/mason_packages/.build/geojson-vt-cpp-1.1.0/build (master)$ ./gyp-mac-tool filter-libtool libtool -static -o Release/libgeojsonvt.a Release/obj.target/geojsonvt/src/geojsonvt.o Release/obj.target/geojsonvt/src/geojsonvt_clip.o Release/obj.target/geojsonvt/src/geojsonvt_convert.o Release/obj.target/geojsonvt/src/geojsonvt_simplify.o Release/obj.target/geojsonvt/src/geojsonvt_tile.o -arch_only armv7
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: Release/obj.target/geojsonvt/src/geojsonvt.o is not an object file (not allowed in a library)
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: Release/obj.target/geojsonvt/src/geojsonvt_clip.o is not an object file (not allowed in a library)
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: Release/obj.target/geojsonvt/src/geojsonvt_convert.o is not an object file (not allowed in a library)
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: Release/obj.target/geojsonvt/src/geojsonvt_simplify.o is not an object file (not allowed in a library)
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: Release/obj.target/geojsonvt/src/geojsonvt_tile.o is not an object file (not allowed in a library)

I noticed that some compiler args seem to be duplicated compared to the make osx build, which sounds like a similar issue to CocoaPods/CocoaPods#826

V=1 make osx

  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ '-DNDEBUG' -I../include  -fasm-blocks -mpascal-strings -O3 -g
dwarf-2 -isystem /Users/mikemorris/Projects/mapbox-gl-native/mason_packages/.build/geojson-vt-cpp-1.1.0/mason_packages/headers/variant/1.0/include -I/Users/mi
kemorris/Projects/mapbox-gl-native/mason_packages/.build/geojson-vt-cpp-1.1.0/mason_packages/headers/variant/1.0/include -I/Users/mikemorris/Projects/mapbox-g
l-native/mason_packages/.build/geojson-vt-cpp-1.1.0/mason_packages/headers/rapidjson/1.0.2/include -std=c++1y -MMD -MF ./Release/.deps/Release/obj.target/geoj
sonvt/src/geojsonvt.o.d.raw -fPIC -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk -arch x86_64 -
mmacosx-version-min=10.8 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk -arch x86_64 -mmacosx-v
ersion-min=10.8 -fvisibility-inlines-hidden -stdlib=libc++ -std=c++11 -c -o Release/obj.target/geojsonvt/src/geojsonvt.o ../src/geojsonvt.cpp

V=1 make android

  arm-linux-androideabi-clang++ '-DNDEBUG' -I../include  -fasm-blocks -mpascal-strings -O3 -gdwarf-2 -isystem /Users/mikemorris/Projects/mapbox-gl-native/maso
n_packages/.build/geojson-vt-cpp-1.1.0/mason_packages/headers/variant/1.0/include -I/Users/mikemorris/Projects/mapbox-gl-native/mason_packages/.build/geojson-
vt-cpp-1.1.0/mason_packages/headers/variant/1.0/include -I/Users/mikemorris/Projects/mapbox-gl-native/mason_packages/.build/geojson-vt-cpp-1.1.0/mason_package
s/headers/rapidjson/1.0.2/include -std=c++1y -MMD -MF ./Release/.deps/Release/obj.target/geojsonvt/src/geojsonvt.o.d.raw -fPIC -target armv7-none-linux-androi
deabi -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=softfp -D_LITTLE_ENDIAN -fpic -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-pref
ixes -fno-integrated-as -O2 -g -DNDEBUG -fomit-frame-pointer -fstrict-aliasing -Wno-invalid-command-line-argument -Wno-unused-command-line-argument -target ar
mv7-none-linux-androideabi -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=softfp -D_LITTLE_ENDIAN -fpic -ffunction-sections -funwind-tables -fstack-protector-stro
ng -no-canonical-prefixes -fno-integrated-as -O2 -g -DNDEBUG -fomit-frame-pointer -fstrict-aliasing -Wno-invalid-command-line-argument -Wno-unused-command-lin
e-argument -c -o Release/obj.target/geojsonvt/src/geojsonvt.o ../src/geojsonvt.cpp

From https://developer.android.com/ndk/guides/standalone_toolchain.html#wwc (which looks like a useful resource, but a bit over my head):

These scripts invoke the real clang binary with default target architecture flags.

The .o files themselves look okay...

file mason_packages/.build/geojson-vt-cpp-1.1.0/build/Release/obj.target/geojsonvt/src/geojsonvt.o
ELF 32-bit LSB relocatable, ARM, version 1 (SYSV), not stripped
@mikemorris mikemorris added build macOS Mapbox Maps SDK for macOS Android Mapbox Maps SDK for Android labels Sep 16, 2015
@incanus
Copy link
Contributor

incanus commented Sep 16, 2015

Refs #2344

@jfirebaugh
Copy link
Contributor

I'm suspicious of two things:

  • Why does something like geojsonvt.o even exist? Mason should be picking up a prebuilt geojsonvt binary.
  • Why does the V=1 make android output refer to libtool from Xcode? IIRC, the android build should be entirely using android NDK build toolchain (arm-linux-androideabi-clang++ and so forth).

@mikemorris
Copy link
Contributor Author

Why does something like geojsonvt.o even exist? Mason should be picking up a prebuilt geojsonvt binary.

This was patched to build geojsonvt from source specifically because of C++ stdlib conflicts. We could possibly limit that to only gcc builds I suppose?

Why does the V=1 make android output refer to libtool from Xcode? IIRC, the android build should be entirely using android NDK build toolchain (arm-linux-androideabi-clang++ and so forth).

It sounds like the "bundled" build tools are just script wrappers around the Xcode tools?

This operation also installs two scripts, named clang and clang++, under /bin/@. These scripts invoke the real clang binary with default target architecture flags. In other words, they should work without any modification, and you should be able to use them in your own builds by just setting the CC and CXX environment variables to point to them.

@jfirebaugh
Copy link
Contributor

@mikemorris The command you ran was ./gyp-mac-tool ...? Where did that come from?

@ljbade
Copy link
Contributor

ljbade commented Sep 16, 2015

@mikemorris ah building mason from source on android. I would say we don't support that currently.

All mason Android modules have ever been built from Travis on Linux.

I'd say the mason build scripts need modifications to check if they are running on OSX and implement some work around.

This smells like a PATH issue by the way. Picking up the wrong commands.

@mikemorris
Copy link
Contributor Author

./gyp-mac-tool

From mason_packages/.build/geojson-vt-cpp-1.1.0/build/ @jfirebaugh

@lucaswoj
Copy link
Contributor

@jfirebaugh explained the fundamental issue:

... there is an issue with using prebuilt ​_C++_​ libraries with mason that so far we don't have a solution for: C++ libraries that use C++ standard library objects in their APIs then have an ​_ABI_​ dependency on the C++ standard library they were build with. They can't be linked into a program that uses a different C++ standard library. But precompiled mason libraries are ​_not namespaced by C++ stdlib_​.

In other words: ​_mason is not currently safe to use with C++ libraries_​.

Unless you force it to build from source.

the majority of libraries we use mason for are ​_C_​ libraries, not ​_C++_​ libraries

While we do force geojsonvt to build from source, we don't use the correct toolchain for Android builds, building with the host system's C++ standard library instead of the target system's C++ standard library building with XCode's libtool instead of Android NDK's libtool.

The planned short-term resolution is

@jfirebaugh
Copy link
Contributor

@lucaswoj Correct, except for "building with the host system's C++ standard library instead of the target system's C++ standard library". The build issue on android is unrelated to C++ standard libraries; instead it appears to be caused by using Xcode's libtool rather than the libtool provided by the android NDK.

@incanus
Copy link
Contributor

incanus commented Sep 16, 2015

add Travis build matrix coverage for Android on OS X

#2344

@springmeyer
Copy link
Contributor

The build issue on android is unrelated to C++ standard libraries; instead it appears to be caused by using Xcode's libtool rather than the libtool provided by the android NDK.

👍 Want to highlight this. When I first read this ticket it seemed like stdlib issues were related, but its not so. Also over at #2237 (comment) we've ruled out stdlib issue (mostly) as well.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android build macOS Mapbox Maps SDK for macOS
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants