Virtual-environments: ld: warning: URGENT: building for OSX, but linking against dylib (/usr/lib/libc++.dylib) built for (unknown).

Created on 9 Mar 2020  路  13Comments  路  Source: actions/virtual-environments

Describe the bug

After selecting Xcode version (/Applications/Xcode_9.4.1.app) on macOS-10.14 image according to https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops#xcode guide the error

ld: warning: URGENT: building for OSX, but linking against dylib (/usr/lib/libc++.dylib) built for (unknown). Note: This will be an error in the future.
ld: warning: URGENT: building for OSX, but linking against dylib (/usr/lib/libSystem.dylib) built for (unknown). Note: This will be an error in the future.

started to appear. Everything was OK before Mar 6, 2020.

Area for Triage:

C/C++
Xcode
Apple
Question, Bug, or Feature?:

Bug
Virtual environments affected

  • [ ] macOS 10.15
  • [ ] Ubuntu 16.04 LTS
  • [ ] Ubuntu 18.04 LTS
  • [ ] Windows Server 2016 R2
  • [ ] Windows Server 2019

Expected behavior

No error message during linking stage.
Actual behavior

Refer to https://github.com/microsoft/LightGBM/issues/2889.

  1. https://github.com/microsoft/LightGBM/blob/6b6709b9b3ae302d4a085aadb327540792a502f0/.vsts-ci.yml#L104-L107
  2. https://github.com/microsoft/LightGBM/blob/6b6709b9b3ae302d4a085aadb327540792a502f0/.ci/setup.sh#L3-L8
  3. https://github.com/microsoft/LightGBM/blob/6b6709b9b3ae302d4a085aadb327540792a502f0/.ci/test.sh#L142-L146
Apple macOS awaiting-deployment bug

Most helpful comment

@StrikerRUS we've identified the root cause and will update the VM image next week.

All 13 comments

Hi @StrikerRUS! We assume that it can be caused by Vcpkg, which is installed on Mojave with some workarounds:

# Install missing headers to fix macOS Mojave issue with brew gcc https://github.com/microsoft/vcpkg/issues/7585
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /

How urgent is this issue? Is it possible to wait for next week's image rollout?

@miketimofeev Hey!

Thank you very much for the prompt response! It's cool that you have some thoughts about possible fixes already! I think we can wait a week or so for next image rollout to not break your dev cycles.

cc @guolinke

@StrikerRUS thanks for the update!
I'll let you know when the new image has been rolled out.

@StrikerRUS could you please provide a bit more logs? I can't reproduce it for some reason, sudo xcode-select -s /Applications/Xcode_9.4.1.app/Contents/Developer works fine for me, without any warnings. I guess there are some additional steps that may cause such an issue.

@miketimofeev

I'll let you know when the new image has been rolled out.

Many thanks!

could you please provide a bit more logs? I can't reproduce it for some reason, sudo xcode-select -s /Applications/Xcode_9.4.1.app/Contents/Developer works fine for me, without any warnings. I guess there are some additional steps that may cause such an issue.

Sure! I confirm that simple command of changing Xcode version works fine and really changes the compiler. Warning is shown when you try to compile something after executing that line.

Here is the minimal reproducible example:
https://github.com/microsoft/LightGBM/blob/StrikerRUS-patch-1/.vsts-ci.yml
https://github.com/microsoft/LightGBM/blob/StrikerRUS-patch-1/.ci/test.sh

And the corresponding logs with warnings:
https://dev.azure.com/lightgbm-ci/lightgbm-ci/_build/results?buildId=5369&view=logs&j=a5e52b91-c83f-5429-4a68-c246fc63a4f7&t=00f564b5-c6ae-5329-43c9-96bc79a72ec9

@miketimofeev Even simpler example with Hello world! C++ program and without openmp.

  1. https://github.com/microsoft/LightGBM/blob/StrikerRUS-patch-2/.vsts-ci.yml
  2. https://github.com/microsoft/LightGBM/blob/StrikerRUS-patch-2/.ci/test.sh
  3. https://github.com/microsoft/LightGBM/blob/StrikerRUS-patch-2/CMakeLists.txt
  4. https://github.com/microsoft/LightGBM/blob/StrikerRUS-patch-2/src/main.cpp

And the logs:
https://dev.azure.com/lightgbm-ci/lightgbm-ci/_build/results?buildId=5373&view=logs&j=a5e52b91-c83f-5429-4a68-c246fc63a4f7&t=00f564b5-c6ae-5329-43c9-96bc79a72ec9

-- The C compiler identification is AppleClang 9.1.0.9020039
-- The CXX compiler identification is AppleClang 9.1.0.9020039
-- Check for working C compiler: /Applications/Xcode_9.4.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode_9.4.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode_9.4.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode_9.4.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Warning (dev) in CMakeLists.txt:
  No cmake_minimum_required command is present.  A line of code such as

    cmake_minimum_required(VERSION 3.16)

  should be added at the top of the file.  The version specified may be lower
  if you wish to support older CMake versions for this project.  For more
  information run "cmake --help-policy CMP0000".
This warning is for project developers.  Use -Wno-dev to suppress it.
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/runner/runners/2.165.0/work/1/s/build
Scanning dependencies of target lightgbm
[ 50%] Building CXX object CMakeFiles/lightgbm.dir/src/main.o
[100%] Linking CXX executable lightgbm
ld: warning: URGENT: building for OSX, but linking against dylib (/usr/lib/libc++.dylib) built for (unknown). Note: This will be an error in the future.
ld: warning: URGENT: building for OSX, but linking against dylib (/usr/lib/libSystem.dylib) built for (unknown). Note: This will be an error in the future.
[100%] Built target lightgbm

@StrikerRUS thanks a lot with such detailed examples. It will definitely help us testing the changes!

@StrikerRUS we've identified the root cause and will update the VM image next week.

@miketimofeev Sounds awesome! Thanks for the heads-up!

@StrikerRUS we've finished with the rollout. Could you check one more time, please?

@miketimofeev Thank you very much! I can confirm that our main pipeline and that toy C++ example work fine as before without any warnings!

@StrikerRUS we've identified the root cause and will update the VM image next week.

Hi, I've stumbled across the same warning in our CI setup. Can you tell me what the root cause is and/or point me to the commit which solved this? Thanks a lot!

Hi @Spacechild1!
It was caused by the installation of missing headers on the macOS Mojave. After removing this line, everything started to work fine:
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mikeharder picture mikeharder  路  26Comments

traversaro picture traversaro  路  26Comments

kaylangan picture kaylangan  路  56Comments

pixyzehn picture pixyzehn  路  30Comments

AlenaSviridenko picture AlenaSviridenko  路  68Comments