mousebird-consulting-inc / WhirlyGlobe

WhirlyGlobe Development
Other
830 stars 255 forks source link

Error building develop via CocoaPods: duplicate symbol 'lodepng_crc32(unsigned char const*, unsigned long)' #1552

Closed akovalov closed 2 years ago

akovalov commented 2 years ago

Error building develop via CocoaPods: duplicate symbol 'lodepng_crc32(unsigned char const*, unsigned long)'

duplicate symbol 'lodepng_crc32(unsigned char const*, unsigned long)' in:
    /Users/alexkovalov/Library/Developer/Xcode/DerivedData/App-frfjptbqnbzpcjcqtkfctgpmopjn/Build/Intermediates.noindex/Pods.build/Development-Debug-iphoneos/WhirlyGlobe.build/Objects-normal/arm64/lodepng.o
    /Users/alexkovalov/Library/Developer/Xcode/DerivedData/App-frfjptbqnbzpcjcqtkfctgpmopjn/Build/Intermediates.noindex/Pods.build/Development-Debug-iphoneos/WhirlyGlobe.build/Objects-normal/arm64/RawPNGImage.o
ld: 1 duplicate symbol for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Looks like lodepng_crc32 in RawPNGImage is not used and can be removed.

unsigned lodepng_crc32(const unsigned char* buffer, size_t length)
{
    return crc32_z(crc32(0L, Z_NULL, 0), buffer, length);
}
sjg-wdw commented 2 years ago

Can you take a look at this @TimSylvester

TimSylvester commented 2 years ago

Ah, right, the preprocessor definitions listed in that file also need to be applied when building that cpp file, particularly LODEPNG_NO_COMPILE_CRC. I never found a good way to do that in the podspec, but I guess it should be fine to apply them to everything, I'll try it...

TimSylvester commented 2 years ago

I pulled develop into a project via pod and was surprised to find that it built without error. You're referencing develop, right? Are you using frameworks in the podfile?

paulgee31 commented 2 years ago

I had the same issue and yep was using frameworks.

I reverted back to using the source instead.

TimSylvester commented 2 years ago

See if referencing topic/pod works.

paulgee31 commented 2 years ago

Yep switching to topic/pod builds fine.