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

Error when building for MacCatalyst: ld: symbol(s) not found for architecture x86_64 #447

Open
yoKurt94 opened this issue Jan 10, 2022 · 8 comments

Comments

@yoKurt94
Copy link

yoKurt94 commented Jan 10, 2022

I try to build freeTDS for MacCatalyst but I am getting an error in my terminal saying:

ld: building for macOS, but linking in object file built for Mac Catalyst, file '.libs/ct.o' for architecture x86_64

I cannot explain how this can be since my configure does not seem to build for MacOS:

 $ ./configure --prefix=/Users/yannik/Documents/Development/FreeTDS-iOS/build_ios/freetds/x86_64 --host=aarch64-apple-darwin21.2.0 --target=x86_64-apple-ios15.2-macabi --with-tdsver=7.3 --with-odbc-nodm=/usr/local CFLAGS=-arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk -target x86_64-apple-ios15.2-macabi

I noticed in my config.log that there are some ld errors:

Undefined symbols for architecture x86_64:
  "_shl_load", referenced from:
      _main in conftest-d16912.o
ld: symbol(s) not found for architecture x86_64

What is the issue with these symbols? I feel like my configure should be set up correctly.

config.log

@freddy77
Copy link
Contributor

It's normal that there are errors in config.log. One purpose of configure is to detect features (like function in this case) of the used system. Simply it tried to find shl_load and it didn't find it. FreeTDS does not use it directly but I suppose it's needed by libtool.

For the ld: building for macOS, but linking in object file built for Mac Catalyst, file '.libs/ct.o' for architecture x86_64 error maybe you have previous object files present? Try to do a find . -name '*.o' -delete (maybe -delete option is GNU specific, in this case you can try find . -name '*.o' | xargs rm)

@yoKurt94
Copy link
Author

Unfortunately, deleting all object files did not help. I deleted all the object files inside this path (there is a folder also which is defined as my prefix path). I also made it part of my routine to delete the freeTDS folder after each build and then unzipping a new copy to make sure there are no leftovers.

@yoKurt94
Copy link
Author

yoKurt94 commented Jan 18, 2022

I ran my script on a Mac Catalina with lower OS versions, but I get the same error. Should I also delete such files from my /usr/local/lib even if my prefix points to another directory?

@yoKurt94
Copy link
Author

I found the issue, it was a silly one. Target and build were swapped.

@yoKurt94 yoKurt94 reopened this Jan 19, 2022
@yoKurt94
Copy link
Author

Okay, I can't really confirm that this issue was resolved because I couldn't generate the library (output was only a libsybdb.la and not libsybdb.a file) and I am not sure whether I am building for the correct target now. I apologize. You said that It's normal that there are errors in config.log. One purpose of configure is to detect features (like function in this case) of the used system. but how do I know whether not finding sql_load is a problem or not?

@yoKurt94
Copy link
Author

yoKurt94 commented Jan 19, 2022

As it turns out, target and build were not swapped.

BUILD="x86_64-apple-darwin21.2.0"
TARGET="x86_64-apple-ios15.2-macabi"

which is correct (I guess). The initial issue isn't fixed yet. The output was a .la file because my build script didn't run make install.
I feel like it is weird that the error says building for MacOS. I can see in this entry of the mailing list, that target should be correct. The questioner also shared his build script with me, so there shouldn't be too big differences and he did manage to build for MacCatalyst.

@JzwOnly
Copy link

JzwOnly commented Mar 22, 2022

@yoKurt94
Is this problem solved? Can you share the script for compiling Mac Catalyst?

@yoKurt94
Copy link
Author

yoKurt94 commented Oct 11, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants