Linking: get_scale_factor not resolved (apple)

Get help with compiling or installing the game, and discuss announcements of new official releases.

Moderator: Forum Moderators

Post Reply
daMark
Posts: 7
Joined: October 20th, 2015, 9:45 pm

Linking: get_scale_factor not resolved (apple)

Post by daMark »

Code: Select all

Undefined symbols for architecture x86_64:
  "desktop::apple::get_scale_factor(int)", referenced from:
      CVideo::get_dpi() const in libwesnoth-game.a(video.o)
ld: symbol(s) not found for architecture x86_64
This is the error message I get while compiling wesnoth 1.16.6 on MacOS 1.14.6
Is there another Library I am missing? I added the tools and libraries mentioned in INSTALL.md using HomeBrew ans scons generated this command to link the code

Code: Select all

g++ -o wesnoth \
-fPIE -Wl,-pie \
-L/usr/local/Cellar/openssl@3/3.0.7/lib -lcrypto -lssl \
-Wl,-force_load build/release/libwesnoth-widgets.a build/release/wesnoth.o build/release/libwesnoth-client.a build/release/liblua.a build/release/libwesnoth-core.a build/release/libwesnoth-game.a build/release/libwesnoth-sdl.a build/release/libwesnoth-client.a build/release/macosx/SDLMain.o \
-L/usr/local/lib -L/usr/local/Cellar/cairo/1.16.0_5/lib -L/usr/local/Cellar/pango/1.50.12/lib -L/usr/local/Cellar/glib/2.74.3/lib -L/usr/local/opt/gettext/lib -L/usr/local/Cellar/harfbuzz/5.3.1/lib -L/usr/local/Cellar/fontconfig/2.14.1/lib -L/usr/local/opt/freetype/lib \
-lboost_regex-mt -lboost_filesystem-mt -lboost_locale-mt -lboost_thread-mt -lboost_coroutine-mt -lboost_context-mt -lboost_system-mt -lboost_random-mt -lboost_program_options-mt -lboost_iostreams-mt -lpthread -lSDL2 -lSDL2_mixer -lSDL2_image -lvorbisfile -lpangocairo-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lintl -lharfbuzz -lcairo -lfontconfig -lfreetype -lX11 \
-framework Cocoa -framework Security -framework IOKit -framework CoreGraphics
The result is the missing routine from the beginning.

Regards daMark.
User avatar
Pentarctagon
Project Manager
Posts: 5565
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Linking: get_scale_factor not resolved (apple)

Post by Pentarctagon »

That'd be in src/desktop/apple_video.hpp/src/desktop/apple_video.mm.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
daMark
Posts: 7
Joined: October 20th, 2015, 9:45 pm

Re: Linking: get_scale_factor not resolved (apple)

Post by daMark »

Thanks Pentarctagon. (2 times)
Adding apple_video.mm to SConscript was helpful.

wesnoth and wesnothd exist in the root-directory now. But something is wrong. If I try to start
./wesnoth --help
from the command line nothing happens. The process is running but thats it.
Any idea where to look for the problem?
User avatar
Pentarctagon
Project Manager
Posts: 5565
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Linking: get_scale_factor not resolved (apple)

Post by Pentarctagon »

I don't. For Wesnoth's CI builds, we haven't used scons on macOS for at least a few years.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
daMark
Posts: 7
Joined: October 20th, 2015, 9:45 pm

Re: Linking: get_scale_factor not resolved (apple)

Post by daMark »

Pentarctagon wrote: December 28th, 2022, 7:33 pm I don't. For Wesnoth's CI builds, we haven't used scons on macOS for at least a few years.
What is used on macOS for building the executeables?
( I also tested ./wesnothd -V and this worked so far while ./wesnoth -v does not.)
User avatar
Pentarctagon
Project Manager
Posts: 5565
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Linking: get_scale_factor not resolved (apple)

Post by Pentarctagon »

xcodebuild is called from the command line: https://github.com/wesnoth/wesnoth/blob ... #L210-L244

scons is still used for building the translations, but not Wesnoth itself.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
User avatar
egallager
Posts: 583
Joined: November 19th, 2020, 7:27 pm
Location: Concord, New Hampshire
Contact:

Re: Linking: get_scale_factor not resolved (apple)

Post by egallager »

you could also try using cmake like MacPorts does, but I had trouble with that last time I tried that: https://trac.macports.org/ticket/65885
daMark
Posts: 7
Joined: October 20th, 2015, 9:45 pm

Re: Linking: get_scale_factor not resolved (apple)

Post by daMark »

Pentarctagon wrote: December 29th, 2022, 5:19 pm xcodebuild is called from the command line: https://github.com/wesnoth/wesnoth/blob ... #L210-L244
Just a quick update. It took me some time to get xcodebuild running on my VM. Now it just says that the directory does not contain a Xcode project and
I hope I now can go through the steps in the yml-file you mentioned above. Is this file for use with Ansible?
User avatar
Pentarctagon
Project Manager
Posts: 5565
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Linking: get_scale_factor not resolved (apple)

Post by Pentarctagon »

Probably the error is due to needing to be the xcode projectfile directory - line 235: working-directory: projectfiles/Xcode.

It's used for Github Actions. You can see the output of our CI using this configuration at https://github.com/wesnoth/wesnoth/acti ... i-main.yml
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
daMark
Posts: 7
Joined: October 20th, 2015, 9:45 pm

Re: Linking: get_scale_factor not resolved (apple)

Post by daMark »

It was not the working directory. I called xcodebuild without parameters to test the command.
Now I was able to check it with parameters.
I never worked witch Xcode before and maybe I have to configure it somehow to get it working. What must be changed here?

Code: Select all

$ cd ${GitRep}/projectfiles/Xcode
$ xcodebuild ARCHS=x86_64 -project "The Battle for Wesnoth.xcodeproj" -target "The Battle for Wesnoth" -target "unit_tests" -configuration "Release"
Build settings from command line:
    ARCHS = x86_64

note: Using new build system
note: Planning build
note: Constructing build description
error: No signing certificate "Developer ID Application" found: No "Developer ID Application" signing certificate matching team ID "N5CYW96P9T" with a private key was found. (in target 'The Battle for Wesnoth' from project 'The Battle for Wesnoth')
warning: Traditional headermap style is no longer supported; please migrate to using separate headermaps and set 'ALWAYS_SEARCH_USER_PATHS' to NO. (in target 'The Battle for Wesnoth' from project 'The Battle for Wesnoth')
warning: Traditional headermap style is no longer supported; please migrate to using separate headermaps and set 'ALWAYS_SEARCH_USER_PATHS' to NO. (in target 'unit_tests' from project 'The Battle for Wesnoth')
error: No signing certificate "Developer ID Application" found: No "Developer ID Application" signing certificate matching team ID "N5CYW96P9T" with a private key was found. (in target 'wesnothd' from project 'The Battle for Wesnoth')
warning: Traditional headermap style is no longer supported; please migrate to using separate headermaps and set 'ALWAYS_SEARCH_USER_PATHS' to NO. (in target 'wesnothd' from project 'The Battle for Wesnoth')

** BUILD FAILED **

$
User avatar
Pentarctagon
Project Manager
Posts: 5565
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Linking: get_scale_factor not resolved (apple)

Post by Pentarctagon »

Which version are you building?
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
daMark
Posts: 7
Joined: October 20th, 2015, 9:45 pm

Re: Linking: get_scale_factor not resolved (apple)

Post by daMark »

Good question.
I try to compile wesnoth because of the issue 6943 I opened for the 1.17-branch. I want to see if I can reproduce the issue. To do this I want to compile version 1.16.6 and 1.17.10 but because of the problems to do this I stepped back to 1.14.17. The posted output is from this version. I stepped back to 1.14 because some years ago I successfully compiled this version.

Now I ...
tried to compile 1.17.10 and it started but some include files are missing.
tried to compile 1.16.6 and the output is similar to the posted output. I found that I have to change some values for Xcode. (ProvisioningStyle = Automatic; CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic;) After this I have a similar result to the 1.17 variant.

Code: Select all

${GitRep}/src/utils/variant.hpp:32:10: fatal error: 'boost/variant.hpp' file not found
I'll try to find and check the options for the search paths for include files.
User avatar
Pentarctagon
Project Manager
Posts: 5565
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Linking: get_scale_factor not resolved (apple)

Post by Pentarctagon »

Did you run the Fix_Xcode_Dependencies script in the xcode projectfiles folder?
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
daMark
Posts: 7
Joined: October 20th, 2015, 9:45 pm

Re: Linking: get_scale_factor not resolved (apple)

Post by daMark »

You are right. With 1.14.17 I ran Fix_Xcode_Dependencies. With 1.16 and 1.17. I didn't. Now I know why I need it.

Compilation of 1.16.6 succeeded. But how do I start it? If I try i get:

Code: Select all

$ cd ${GitRep}/projectfiles/Xcode/build/Release/The Battle for Wesnoth.app/Contents/MacOS
$ ./The\ Battle\ for\ Wesnoth 
dyld: Library not loaded: @rpath/libreadline.8.1.dylib
  Referenced from: ${GitRep}/projectfiles/Xcode/build/Release/The Battle for Wesnoth.app/Contents/MacOS/./The Battle for Wesnoth
  Reason: no suitable image found.  Did find:
	${GitRep}/projectfiles/Xcode/build/Release/The Battle for Wesnoth.app/Contents/MacOS/../Frameworks/libreadline.8.1.dylib: code signature in (${GitRep}/projectfiles/Xcode/build/Release/The Battle for Wesnoth.app/Contents/MacOS/../Frameworks/libreadline.8.1.dylib) not valid for use in process using Library Validation: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?)
	${GitRep}/projectfiles/Xcode/build/Release/The Battle for Wesnoth.app/Contents/MacOS/../Frameworks/libreadline.8.1.dylib: stat() failed with errno=1
	${GitRep}/projectfiles/Xcode/build/Release/The Battle for Wesnoth.app/Contents/MacOS/../Frameworks/libreadline.8.1.dylib: code signature in (${GitRep}/projectfiles/Xcode/build/Release/The Battle for Wesnoth.app/Contents/MacOS/../Frameworks/libreadline.8.1.dylib) not valid for use in process using Library Validation: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?)
	${GitRep}/projectfiles/Xcode/build/Release/The Battle for Wesnoth.app/Contents/MacOS/../Frameworks/libreadline.8.1.dylib: stat() failed with errno=1
Abort trap: 6
Is something more to do? Is something wrong?
User avatar
Pentarctagon
Project Manager
Posts: 5565
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Linking: get_scale_factor not resolved (apple)

Post by Pentarctagon »

For 1.16 you likely need to build as it's done at https://github.com/wesnoth/wesnoth/blob ... cos.sh#L16 (CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO).

For 1.17, signing is disabled for the Release target and instead a SignedRelease target was created.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
Post Reply