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

BUG: MacOS support libraries end up into res://build/* #52

Open
clemens-tolboom opened this issue Jan 29, 2021 · 6 comments
Open

BUG: MacOS support libraries end up into res://build/* #52

clemens-tolboom opened this issue Jan 29, 2021 · 6 comments
Labels
bug Something isn't working build-release Related to the build and release pipeline. help wanted Extra attention is needed macos Specific to Mac OS

Comments

@clemens-tolboom
Copy link
Contributor

clemens-tolboom commented Jan 29, 2021

After #33 lands we still face:

The MacOS build process results in the supporting files into res://build/ directory.

image

Fiddling removing /build makes them required in res:// aka the root of the demo project. Which is worse.

diff --git a/SConstruct b/SConstruct
index 1eeae22..9f7172a 100644
--- a/SConstruct
+++ b/SConstruct
@@ -18,11 +18,11 @@ cpp_bindings_path = "godot-cpp/"
 cpp_library = "libgodot-cpp"
 
 rte_cpp_path = "src/raster-tile-extractor/"
-rte_libpath = "src/raster-tile-extractor/build/"
+rte_libpath = "src/raster-tile-extractor/"
 rte_library = "libRasterTileExtractor"
 
 vector_cpp_path = "src/vector-extractor/"
-vector_libpath = "src/vector-extractor/build/"
+vector_libpath = "src/vector-extractor/"
 vector_library = "libVectorExtractor"
 
 demo_path = "demo/addons/geodot/"

and the other(s) too

diff --git a/src/vector-extractor/SConstruct b/src/vector-extractor/SConstruct
index bda7203..fa67298 100644
--- a/src/vector-extractor/SConstruct
+++ b/src/vector-extractor/SConstruct
@@ -25,9 +25,9 @@ if env['p'] != '':
 
-env['target_path'] = 'build/'
+env['target_path'] = './'
 env['target_name'] = 'libVectorExtractor'

We do not understand this dynamics on MacOS. Help needed.

@clemens-tolboom
Copy link
Contributor Author

clemens-tolboom commented Jan 29, 2021

Making the link arguments more explicit we are building into the Godot dir but grab the sub libraries from the src/*/build/

g++
  -o demo/addons/geodot/osx/libgeodot.dylib <========== into demo

  -arch x86_64
  -dynamiclib
  src/gdlibrary.os
  src/geodata.os
  src/geodot.os
  src/geofeatures.os src/geoimage.os

  -Lgodot-cpp/bin <================ why is this behaving 'normal' ?
  -Lsrc/raster-tile-extractor/build <====== causing trouble
  -Lsrc/vector-extractor/build  <====== causing trouble
  -L/usr/local/Cellar/gdal/3.2.1/lib <==== System required

  -lgodot-cpp.osx.release.64
  -lRasterTileExtractor
  -lVectorExtractor
  -lgdal

So what would happen when building local then copy into demo/**?

@kb173 kb173 added bug Something isn't working build-release Related to the build and release pipeline. help wanted Extra attention is needed labels Jan 29, 2021
@clemens-tolboom
Copy link
Contributor Author

clemens-tolboom commented Jan 29, 2021

Some more info about dynlib

https://lessons.livecode.com/m/4071/l/15029-linking-an-osx-external-bundle-with-a-dylib-library
https://stackoverflow.com/questions/33333628/how-can-i-bundle-a-dylib-within-a-mac-app-bundle-in-qt

otool -L /usr/local/Cellar/gdal/3.2.1/lib/libgdal.dylib

and

otool -L demo/addons/geodot/osx/libgeodot.dylib 
demo/addons/geodot/osx/libgeodot.dylib:
	demo/addons/geodot/osx/libgeodot.dylib (compatibility version 0.0.0, current version 0.0.0)
	build/libRasterTileExtractor.dylib (compatibility version 0.0.0, current version 0.0.0)
	build/libVectorExtractor.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/local/opt/gdal/lib/libgdal.28.dylib (compatibility version 29.0.0, current version 29.1.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 904.4.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292.60.1)

@clemens-tolboom
Copy link
Contributor Author

We can run the same on Godot

otool /Applications/Godot_v3.2.4-rc1_osx.universal.app/Contents/MacOS/Godot -L
/Applications/Godot_v3.2.4-rc1_osx.universal.app/Contents/MacOS/Godot:
	/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 23.0.0)
	/System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 164.0.0)
	/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
	/System/Library/Frameworks/AGL.framework/Versions/A/AGL (compatibility version 1.0.0, current version 1.0.0)
	/System/Library/Frameworks/AudioUnit.framework/Versions/A/AudioUnit (compatibility version 1.0.0, current version 1.0.0)
	/System/Library/Frameworks/CoreAudio.framework/Versions/A/CoreAudio (compatibility version 1.0.0, current version 1.0.0)
	/System/Library/Frameworks/CoreMIDI.framework/Versions/A/CoreMIDI (compatibility version 1.0.0, current version 69.0.0)
	/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11)
	/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
	/System/Library/Frameworks/ForceFeedback.framework/Versions/A/ForceFeedback (compatibility version 1.0.0, current version 1.0.2)
	/System/Library/Frameworks/AVFoundation.framework/Versions/A/AVFoundation (compatibility version 1.0.0, current version 2.0.0)
	/System/Library/Frameworks/CoreMedia.framework/Versions/A/CoreMedia (compatibility version 1.0.0, current version 1.0.0)
	/System/Library/Frameworks/CoreVideo.framework/Versions/A/CoreVideo (compatibility version 1.2.0, current version 1.5.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 904.4.0)
	/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 2022.0.0)
	/System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 54.0.0)
	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1770.106.0)
	/System/Library/Frameworks/CoreGraphics.framework/Versions/A/CoreGraphics (compatibility version 64.0.0, current version 1463.0.0)
	/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 1122.4.0)
	/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1770.106.0)
	/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)

@clemens-tolboom
Copy link
Contributor Author

So in short

otool /Applications/Godot_v3.2.4-rc1_osx.universal.app/Contents/MacOS/Godot -L

helps a little for understanding and

otool demo/addons/geodot/osx/libgeodot.dylib -L
otool demo/build/libVectorExtractor.dylib 
otool demo/build/libVectorExtractor.dylib  -L
otool /usr/local/opt/gdal/lib/libgdal.dylib -L

shows ways to fix stuff hopefully.

@clemens-tolboom
Copy link
Contributor Author

Remarks

otool -L demo/addons/geodot/osx/libgeodot.dylib
demo/addons/geodot/osx/libgeodot.dylib

this is the wrong answer as it probably should be relative to the project root /addons

cd demo/addons/geodot/osx
install_name_tool -change demo/addons/geodot/osx/libgeodot.dylib  "addons/geodot/osx/libgeodot.dylib" libgeodot.dylib

This is not working ... it should be in an application context I guess?

@clemens-tolboom
Copy link
Contributor Author

clemens-tolboom commented Jan 30, 2021

Export game

If I export the game to MacOS App we get (too few files but what can we do here)

find ./Demo.app -type f
./Demo.app/Contents/MacOS/Demo
./Demo.app/Contents/Resources/icon.icns
./Demo.app/Contents/Resources/Demo.pck
./Demo.app/Contents/Frameworks/libgeodot.dylib
./Demo.app/Contents/Frameworks/libRasterTileExtractor.dylib
./Demo.app/Contents/Info.plist
./Demo.app/Contents/PkgInfo

Check path

otool -L ./Demo.app/Contents/Frameworks/libgeodot.dylib
./Demo.app/Contents/Frameworks/libgeodot.dylib:
	demo/addons/geodot/osx/libgeodot.dylib (compatibility version 0.0.0, current version 0.0.0)
...

Change path

Invalidates signature so that is not how should be done

install_name_tool -change demo/addons/geodot/osx/libgeodot.dylib  "@executable_path/../Frameworkslibgeodot.dylib" Demo.app/Contents/MacOS/Demo

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool: warning: changes being made to the file will invalidate the code signature in: Demo.app/Contents/MacOS/Demo (for architecture arm64)

Recheck path

Name is not changed ... arg

otool -L ./Demo.app/Contents/Frameworks/libgeodot.dylib
./Demo.app/Contents/Frameworks/libgeodot.dylib:
	demo/addons/geodot/osx/libgeodot.dylib (compatibility version 0.0.0, current version 0.0.0)
...

ARM64?

Demo.app/Contents/MacOS/Demo (for architecture arm64)

Wot?!?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working build-release Related to the build and release pipeline. help wanted Extra attention is needed macos Specific to Mac OS
Projects
None yet
Development

No branches or pull requests

2 participants