golang编写的项目,使用alpine制作镜像遇到的一个问题解决

程空万里 · · 3313 次点击 · · 开始浏览    
这是一个创建于 的文章,其中的信息可能已经有所发展或是发生改变。

GraphicsMagick,一款高性能的图片处理工具,由于项目需要,用到它,自然而然用到了关于gm的第三方库https://github.com/gographics/gmagick这个库按照作者的提示,要安装GraphicsMagick-devel依赖。
项目写完了,接下来用alpine做为基础镜像,准备制作项目的镜像。
golang项目,是在ubuntu下编写的,编译成二进制文件了,只要把二进制文件放进镜像里即可,遇到的问题有2个
1 容器跑起来,一直报二进制文件no found
我认认真真的确认了文件,以及它的路径,确实是存在的,怎么会报文件找不到呢?!
原来是musl和glibc是兼容的问题,在Dockerfile里要加以下两步

mkdir /lib64
ln -s /lib/libc.musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2

2 Error loading shared library libGraphicsMagickWand-Q16.so.2: No such file or directory
明明按要求安装GraphicsMagick-devel依赖,为啥还报这种错

[root@bbbb xxxx-admin-api]# docker-compose up
Creating xxxx-admin ... done
Attaching to xxxx-admin
xxxx-admin    | Error loading shared library libGraphicsMagickWand-Q16.so.2: No such file or directory (needed by /app/xxxx-admin)
xxxx-admin    | Error loading shared library libGraphicsMagick-Q16.so.3: No such file or directory (needed by /app/xxxx-admin)
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawSetTextAntialias: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickGetImageHistogram: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDeconstructImages: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawClearException: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickMedianFilterImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawSetFillColor: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDescribeImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawGetException: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickSetImagePage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickGetImageFormat: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickSetImageGamma: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickBlackThresholdImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawGetFillRule: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawBezier: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: PixelGetBlue: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: PixelGetRedQuantum: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickLevelImageChannel: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickGetImageColormapColor: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawGetTextDecoration: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickGetImageMatteColor: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickGetImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickSetImageResolution: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickSetImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickRollImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickSetImageInterlaceScheme: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickQueryFontMetrics: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickBlurImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: PixelSetRed: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawSetStrokeAntialias: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickResampleImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawSetFontWeight: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickSetImageType: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickSetImageIterations: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawSetClipRule: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawSetStrokeDashOffset: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: PixelGetMagentaQuantum: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickCompositeImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickFxImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: PixelSetYellow: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawPopClipPath: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickMinifyImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: PixelSetMagenta: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickGetImageGamma: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickGetReleaseDate: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickGetImageHeight: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickShaveImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickGetImageDispose: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickOilPaintImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawPolygon: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickGetImageSignature: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickMosaicImages: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickGammaImageChannel: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickQuantizeImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickGetImageWidth: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawGetClipRule: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickRaiseImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: PixelGetYellow: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickChopImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickLevelImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawSetClipPath: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawPathCurveToAbsolute: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: PixelSetRedQuantum: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawPathCurveToSmoothAbsolute: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawPopPattern: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickCommentImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickRemoveImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickSetImageDelay: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawGetFontStyle: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickGetImageBluePrimary: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickCompareImageChannels: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickSetImageColormapColor: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: DestroyPixelWand: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickGetImagePage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickGetResourceLimit: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickGetImageChannelDepth: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickSetImageBorderColor: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: PixelGetCyanQuantum: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickFrameImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawRotate: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawPathMoveToAbsolute: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickSetResourceLimit: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickAddNoiseImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawPathLineToHorizontalAbsolute: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickLabelImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickWriteImageFile: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickGetNumberImages: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawGetStrokeDashArray: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawComposite: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickQueryFormats: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: PixelGetGreenQuantum: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickFlopImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawSetStrokeLineCap: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawGetTextEncoding: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawGetGravity: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickNegateImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawComment: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickSetFormat: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: ClonePixelWand: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickSetImageScene: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawGetStrokeMiterLimit: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickGetImageWhitePoint: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickSetImageColorspace: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickResizeImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickHaldClutImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: PixelSetGreen: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickSetImageGravity: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawPushClipPath: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickResetIterator: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickEqualizeImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickTintImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawRectangle: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawPathCurveToQuadraticBezierSmoothRelative: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickMorphImages: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickNextImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawPathLineToVerticalAbsolute: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickGammaImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickSetImageRedPrimary: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawSetTextDecoration: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawPathCurveToSmoothRelative: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickAverageImages: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickCoalesceImages: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickClipImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: DestroyMagickWand: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickAffineTransformImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickSetImageAttribute: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickSetResolution: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawSetStrokeWidth: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickSetImageMatteColor: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawPathLineToRelative: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickSetImageGreenPrimary: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickCompareImages: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickSetImageRenderingIntent: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawPathClose: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: PixelGetBlack: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickEdgeImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: PixelSetQuantumColor: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawGetFontSize: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickReduceNoiseImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickWhiteThresholdImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawPathEllipticArcAbsolute: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickMapImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickGetImageIndex: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: PixelSetYellowQuantum: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickGetImageBorderColor: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickCycleColormapImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: PixelSetCyanQuantum: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickSeparateImageChannel: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: PixelGetBlackQuantum: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickSetImageCompose: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickSetImageSavedType: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickNewDrawingWand: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickSetImageDispose: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickTextureImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawPopDefs: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawCircle: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: PixelSetColorCount: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickTransparentImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickReadImageBlob: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawPathCurveToRelative: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickWriteImageBlob: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickSetImageUnits: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawSetViewbox: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickUnsharpMaskImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawGetFillOpacity: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickSetPassphrase: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawSetFillOpacity: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawPolyline: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickHasPreviousImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickGetException: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickModulateImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickThresholdImageChannel: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickSetImageDepth: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickSteganoImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawSetStrokeOpacity: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickGetPackageName: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickWriteImages: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawMatte: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawSetFont: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawGetFontFamily: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickSolarizeImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickRelinquishMemory: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickGetSize: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawSetTextEncoding: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: PixelGetCyan: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawGetFont: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawGetStrokeAntialias: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickGetImageAttribute: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickSetImageFormat: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawSetFontStyle: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawSetStrokeMiterLimit: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: PixelSetMagentaQuantum: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickMontageImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickExtentImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickGetVersion: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickSetImageFilename: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickSetImageCompression: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickGetImageColors: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickSampleImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickCharcoalImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickMagnifyImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawSkewY: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickRemoveImageProfile: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickNormalizeImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickSetImageBluePrimary: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickNegateImageChannel: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawRoundRectangle: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: PixelGetBlueQuantum: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawGetStrokeColor: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawGetClipUnits: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: PixelSetBlue: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickShearImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickGetImageChannelMean: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: PixelSetBlueQuantum: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawSetStrokeColor: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickSetImageIndex: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawPathLineToVerticalRelative: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: PixelGetColorAsString: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: PixelGetRed: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickThresholdImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickSetImageBackgroundColor: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickSetSamplingFactors: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickSetImageChannelDepth: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickWaveImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickFxImageChannel: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickGetImageColorspace: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: PixelGetYellowQuantum: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickSetResolutionUnits: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawEllipse: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickGetHomeURL: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawGetStrokeOpacity: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickSpreadImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawPushPattern: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawPathCurveToQuadraticBezierRelative: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawGetStrokeLineCap: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawGetClipPath: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickWriteImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickGetImageFuzz: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawArc: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawSkewX: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawSetFillRule: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickMotionBlurImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: PixelSetOpacity: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickSetInterlaceScheme: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: PixelSetColor: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawPathLineToAbsolute: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawTranslate: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickReadImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickGetImageCompose: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawSetGravity: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickQueryFonts: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickGetImageRedPrimary: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawPathCurveToQuadraticBezierAbsolute: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickScaleImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickStereoImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickWriteImagesFile: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawGetTextAntialias: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickSetImageWhitePoint: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickSharpenImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickSetSize: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawScale: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawSetClipUnits: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: PixelGetGreen: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawAnnotation: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickAdaptiveThresholdImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawPoint: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickGetImageInterlaceScheme: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawPathFinish: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawSetTextUnderColor: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickFlipImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: PixelGetOpacityQuantum: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDisplayImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickContrastImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawPathMoveToRelative: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickGetSamplingFactors: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawLine: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickColorizeImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: PixelSetOpacityQuantum: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickTransformImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickStripImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDespeckleImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickGetImageGeometry: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawGetStrokeDashOffset: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawSetFontStretch: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickGetImageDelay: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickPreviousImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickAnimateImages: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickSetImageFuzz: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickEnhanceImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: PixelSetBlack: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawSetStrokeDashArray: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickEmbossImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawGetFillColor: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickGetCopyright: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: CloneMagickWand: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: PixelSetBlackQuantum: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawGetTextUnderColor: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickRotateImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickSetImageMatte: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawSetStrokeLineJoin: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawPathLineToHorizontalRelative: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickSetImageVirtualPixelMethod: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: PixelSetCyan: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: NewPixelWand: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickGetImageSavedType: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickGetImageCompression: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawPathCurveToQuadraticBezierSmoothAbsolute: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickGetImageResolution: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickCloneDrawingWand: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickGetImageBackgroundColor: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickPingImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: PixelGetQuantumColor: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDisplayImages: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: PixelGetColorCount: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickGetImageDepth: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickConvolveImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawGetStrokeLineJoin: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickGetImageGreenPrimary: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickSetCompressionQuality: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickAddImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: NewMagickWand: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawPathStart: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickSwirlImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickCropImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawGetStrokeWidth: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickImplodeImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawPathEllipticArcRelative: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawSetStrokePatternURL: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickReadImageFile: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickAnnotateImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDestroyDrawingWand: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickTrimImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawAffine: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickGetFilename: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickHasNextImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickBorderImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: PixelGetMagenta: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawSetFontFamily: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawColor: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawSetFontSize: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawSetFillPatternURL: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickGetQuantumDepth: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickGetImageGravity: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickPreviewImages: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawPushDefs: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: InitializeMagick: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickGetImageIterations: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawGetFontWeight: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickGetImageUnits: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickAppendImages: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: DestroyMagick: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: PixelGetOpacity: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickOpaqueImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: PixelSetGreenQuantum: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickDrawGetFontStretch: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickQuantizeImages: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickGetImageFilename: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickMatteFloodfillImage: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickGetImageType: symbol not found
xxxx-admin    | Error relocating /app/xxxx-admin: MagickRadialBlurImage: symbol not found

于是想到了,是不是也要ln做一下软链接呢?于是学着上面的样子在Dockerfile里补上

&& ln -s /usr/lib/libGraphicsMagickWand.so.2.9.4 /lib64/libGraphicsMagickWand-Q16.so.2 \
&& ln -s /usr/lib/libGraphicsMagick.so.3.21.0 /lib64/libGraphicsMagick-Q16.so.3

再跑,问题依旧,莫非是软连接的地址写错了!回到开发的电脑上用ldd命令查看一下

xx@xx-Lenovo:~/projects/golang/xxxx-admin$ ldd xxxx-admin 
    linux-vdso.so.1 (0x00007ffcf1753000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f22be37a000)
    libGraphicsMagickWand-Q16.so.2 => /lib/libGraphicsMagickWand-Q16.so.2 (0x00007f22be348000)
    libGraphicsMagick-Q16.so.3 => /lib/libGraphicsMagick-Q16.so.3 (0x00007f22be065000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f22bde73000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f22be3b5000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f22bdd24000)
    libjbig.so.0 => /lib/x86_64-linux-gnu/libjbig.so.0 (0x00007f22bdb16000)
    libwebp.so.6 => /lib/x86_64-linux-gnu/libwebp.so.6 (0x00007f22bd8ab000)
    libwebpmux.so.3 => /lib/x86_64-linux-gnu/libwebpmux.so.3 (0x00007f22bd6a1000)
    liblcms2.so.2 => /lib/x86_64-linux-gnu/liblcms2.so.2 (0x00007f22bd646000)
    libtiff.so.5 => /lib/x86_64-linux-gnu/libtiff.so.5 (0x00007f22bd5c5000)
    libfreetype.so.6 => /lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007f22bd506000)
    libjpeg.so.8 => /lib/x86_64-linux-gnu/libjpeg.so.8 (0x00007f22bd481000)
    libpng16.so.16 => /lib/x86_64-linux-gnu/libpng16.so.16 (0x00007f22bd447000)
    libwmflite-0.2.so.7 => /lib/x86_64-linux-gnu/libwmflite-0.2.so.7 (0x00007f22bd426000)
    libXext.so.6 => /lib/x86_64-linux-gnu/libXext.so.6 (0x00007f22bd411000)
    libX11.so.6 => /lib/x86_64-linux-gnu/libX11.so.6 (0x00007f22bd2d4000)
    libbz2.so.1.0 => /lib/x86_64-linux-gnu/libbz2.so.1.0 (0x00007f22bd2c1000)
    libxml2.so.2 => /lib/x86_64-linux-gnu/libxml2.so.2 (0x00007f22bd107000)
    libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f22bd0e9000)
    libzstd.so.1 => /lib/x86_64-linux-gnu/libzstd.so.1 (0x00007f22bd040000)
    libgomp.so.1 => /lib/x86_64-linux-gnu/libgomp.so.1 (0x00007f22bcffe000)
    liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007f22bcfd7000)
    libxcb.so.1 => /lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f22bcfad000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f22bcfa5000)
    libicuuc.so.66 => /lib/x86_64-linux-gnu/libicuuc.so.66 (0x00007f22bcdbf000)
    libXau.so.6 => /lib/x86_64-linux-gnu/libXau.so.6 (0x00007f22bcdb9000)
    libXdmcp.so.6 => /lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007f22bcdb1000)
    libicudata.so.66 => /lib/x86_64-linux-gnu/libicudata.so.66 (0x00007f22bb2f0000)
    libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f22bb10d000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f22bb0f2000)
    libbsd.so.0 => /lib/x86_64-linux-gnu/libbsd.so.0 (0x00007f22bb0d8000)

果然,编译后的二进制文件依赖路径是/lib,而不是/lib64

libGraphicsMagickWand-Q16.so.2 => /lib/libGraphicsMagickWand-Q16.so.2 (0x00007f22be348000)
libGraphicsMagick-Q16.so.3 => /lib/libGraphicsMagick-Q16.so.3 (0x00007f22be065000)

于是,修改Dockerfile里的写法

&& ln -s /usr/lib/libGraphicsMagickWand.so.2.9.4 /lib/libGraphicsMagickWand-Q16.so.2 \
&& ln -s /usr/lib/libGraphicsMagick.so.3.21.0 /lib/libGraphicsMagick-Q16.so.3

问题解决,开心:)


有疑问加站长微信联系(非本文作者)

本文来自:简书

感谢作者:程空万里

查看原文:golang编写的项目,使用alpine制作镜像遇到的一个问题解决

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

3313 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传