Hello currently I tried to set -rpath with pkg-config for golang, however I always get the following:
ld: -rpath can only be used when creating a dynamic final linked image
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Is there any way to fix it?
I tried to use LDFLAGS with -Wl,rpath and I have a pkg-config with -rpath both are failing with the same error.
I also stumbled on github on this: https://github.com/golang/go/issues/7293
Which means that it should work?
Related
I'm trying to build boost 1.57.0 with gcc 4.0 on mac. I first found this website, but I got a number of linker errors when I tried that. I then found this question which allowed me to fix those linker errors, but I'm still getting more that I can't solve. Here's a snippet of the boost build output that demonstrates the problem.
...failed gcc.compile.c++ bin.v2/libs/context/build/gcc-4.0.1/release/threading-multi/unsupported.o...
...skipped <p/boost_1_57_0/lib>libboost_context.dylib for lack of <pbin.v2/libs/context/build/gcc-4.0.1/release/threading-multi>unsupported.o...
gcc.link.dll /boost_1_57_0/lib/libboost_thread.dylib
ld: can't map file, errno=22 file '/System/Library/Frameworks/Python.framework/Versions/2.7/lib' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
"g++" -Wl,"/System/Library/Frameworks/Python.framework/Versions/2.7/lib" -Wl,"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config" -o "/boost_1_57_0/lib/libboost_thread.dylib" -shared "bin.v2/libs/thread/build/gcc-4.0.1/release/threading-multi/pthread/thread.o" "bin.v2/libs/thread/build/gcc-4.0.1/release/threading-multi/pthread/once.o" "bin.v2/libs/thread/build/gcc-4.0.1/release/threading-multi/future.o" "bin.v2/libs/system/build/gcc-4.0.1/release/threading-multi/libboost_system.dylib" "bin.v2/libs/atomic/build/gcc-4.0.1/release/threading-multi/libboost_atomic.dylib"
...failed gcc.link.dll /boost_1_57_0/lib/libboost_thread.dylib...
...skipped <pbin.v2/libs/context/build/gcc-4.0.1/release/threading-multi>libboost_context.dylib for lack of <pbin.v2/libs/context/build/gcc-4.0.1/release/threading-multi>unsupported.o...
...skipped <p/boost_1_57_0/lib>libboost_coroutine.dylib for lack of <pbin.v2/libs/context/build/gcc-4.0.1/release/threading-multi>libboost_context.dylib...
gcc.link.dll /boost_1_57_0/lib/libboost_date_time.dylib
ld: can't map file, errno=22 file '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
"g++" -Wl,"/System/Library/Frameworks/Python.framework/Versions/2.7/lib" -Wl,"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config" -o "/boost_1_57_0/lib/libboost_date_time.dylib" -shared "bin.v2/libs/date_time/build/gcc-4.0.1/release/threading-multi/gregorian/greg_month.o" "bin.v2/libs/date_time/build/gcc-4.0.1/release/threading-multi/gregorian/greg_weekday.o" "bin.v2/libs/date_time/build/gcc-4.0.1/release/threading-multi/gregorian/date_generators.o"
...failed gcc.link.dll /boost_1_57_0/lib/libboost_date_time.dylib...
gcc.link.dll /boost_1_57_0/lib/libboost_filesystem.dylib
ld: can't map file, errno=22 file '/System/Library/Frameworks/Python.framework/Versions/2.7/lib' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I believe something is wrong with the g++ commands, but I don't know what. Does anyone know how to fix this?
The linker, ld is being led to believe that
/System/Library/Frameworks/Python.framework/Versions/2.7/lib
is an input file in the linkage that it must read. Which it isn't;
it's a directory, so the attempt to read it as a file fails.
It's being led to believe this because this bit of your g++ linkage command:
-Wl,"/System/Library/Frameworks/Python.framework/Versions/2.7/lib"
tells it so. The g++ option:
-Wl,...
means: pass ... straight through to the linker. So the pathname is passed
though to the linker. Any pathname in the ld commandline is construed
as the name of an input file if not prefixed by any linker option to
indicate otherwise.
The same error is made immediately following with:
-Wl,"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config"
It seems likely that you want to tell g++ that the directories
/System/Library/Frameworks/Python.framework/Versions/2.7/lib
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config
are ones in which the linker can find libraries required by the linkage. (At least,
that's very likely what you want with the first one. I'm not so such about the
second).
To do that, pass g++ the options:
-L/System/Library/Frameworks/Python.framework/Versions/2.7/lib -L/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config
instead.
I am trying to create an Xcode project with wxWidgets applications.
I follow the manual of wxwidgets:
....
-lz -stdlib=libstdc++ -lwx_osx_cocoa_static -Xlinker -dependency_info -Xlinker
....
ld: library not found for -lwx_osx_cocoa_static
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Any idea how to fix this?
If I look for the library the name is: "libwx_osx_cocoa_static.a"
Amazing! so simple: I added the library path (to libwx_osx_cocoa_static.a) and compilation succeeded! Add to Library search Pathes: $(WXROOT)/build/osx/build/Debug/
Getting a link failure when trying to push the latest Ensembles podspec. The spec is unchanged, but Cocoapods was updated to 0.39.0. Xcode no doubt changed too, which is likely the culprit, but I can't interpret the error.
-> Ensembles (1.4.3)
- ERROR | [Ensembles/Dropbox] xcodebuild: Returned an unsuccessful exit code.
- NOTE | [Ensembles/Dropbox] xcodebuild: clang: error: linker command failed with exit code 1 (use -v to see invocation)
- NOTE | [iOS] [Ensembles/Dropbox] xcodebuild: fatal error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: can't open input file: /var/folders/73/p30wh95r8xjgmv001s6rxw080000gr/T/CocoaPods/Lint/build/Pods.build/Release-iphonesimulator/Ensembles.build/Objects-normal/i386/Ensembles (No such file or directory)
- NOTE | [iOS] [Ensembles/Dropbox] xcodebuild: error: cannot parse the debug map for "/var/folders/73/p30wh95r8xjgmv001s6rxw080000gr/T/CocoaPods/Lint/build/Release-iphonesimulator/Ensembles.framework/Ensembles": No such file or directory
I'm not sure if a link failure is causing the other errors, or that the lipo error is causing the link failure. I can't find any more info about the linker exit failure.
Anyone have any idea what might cause this, and what a solution could be?
Update
I did manage to find what I think is the root error:
Ld /var/folders/73/p30wh95r8xjgmv001s6rxw080000gr/T/CocoaPods/Lint/build/Pods.build/Release-iphonesimulator/Ensembles.build/Objects-normal/x86_64/Ensembles normal x86_64
cd /var/folders/73/p30wh95r8xjgmv001s6rxw080000gr/T/CocoaPods/Lint/Pods
export IPHONEOS_DEPLOYMENT_TARGET=6.0
... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -dynamiclib -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.1.sdk -L/var/folders/73/p30wh95r8xjgmv001s6rxw080000gr/T/CocoaPods/Lint/build/Release-iphonesimulator -F/var/folders/73/p30wh95r8xjgmv001s6rxw080000gr/T/CocoaPods/Lint/build/Release-iphonesimulator -filelist /var/folders/73/p30wh95r8xjgmv001s6rxw080000gr/T/CocoaPods/Lint/build/Pods.build/Release-iphonesimulator/Ensembles.build/Objects-normal/x86_64/Ensembles.LinkFileList -install_name #rpath/Ensembles.framework/Ensembles -Xlinker -rpath -Xlinker #executable_path/Frameworks -Xlinker -rpath -Xlinker #loader_path/Frameworks -mios-simulator-version-min=6.0 -Xlinker -objc_abi_version -Xlinker 2 -framework CoreData -fobjc-arc -fobjc-link-runtime -framework CoreData -framework Foundation -single_module -compatibility_version 1 -current_version 1 -Xlinker -dependency_info -Xlinker /var/folders/73/p30wh95r8xjgmv001s6rxw080000gr/T/CocoaPods/Lint/build/Pods.build/Release-iphonesimulator/Ensembles.build/Objects-normal/x86_64/Ensembles_dependency_info.dat -o /var/folders/73/p30wh95r8xjgmv001s6rxw080000gr/T/CocoaPods/Lint/build/Pods.build/Release-iphonesimulator/Ensembles.build/Objects-normal/x86_64/Ensembles
ld: warning: embedded dylibs/frameworks only run on iOS 8 or later
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_DBRestClient", referenced from:
objc-class-ref in CDEDropboxCloudFileSystem.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
It looks like Cocoapods is trying to create a dynamic library, and that is somehow not working with the oldish Dropbox library for the iPhone simulator architectures. Anyone know of changes in this area, and perhaps a way to prevent Cocoapods using dynamic libraries?
I found the problem: It seems that Cocoapods has started building dynamic frameworks instead of static libraries by default. Apparently linking to the old Dropbox pod I am using was a problem.
To use static libraries instead, you just pass --use-libraries to the pod trunk push or pod lib lint command you are running.
pod lib lint command will check the options in *.podspec file. In my case the problem showed like this :
-> MySDK git:(master) ✗ pod lib lint --allow-warnings
-> MySDK (0.0.1)
- WARN | description: The description is shorter than the summary.
- ERROR | [OSX] xcodebuild: Returned an unsuccessful exit code. You can use `--verbose` for more information.
- NOTE | [OSX] xcodebuild: clang: error: linker command failed with exit code 1 (use -v to see invocation)
The [OSX] flag showed that pod lib lint command tried to build a project according your *.podspec file but when building the project in OSX platform something wrong happened.
My solution is add the s.platform = :ios, "5.0" in podspec file.
After that, run pod lib lint everything turned OK.
I want to create Xcode plugin, and I choose Xcode Plugin Template from Alcatraz, then i close project add Podfile open workspace and try to build i get ann error every time:
ld: library not found for -lDTXcodeUtils
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Here is a full output:
Ld /Users/jakubmazur/Library/Application\
Support/Developer/Shared/Xcode/Plug-ins/CreateFilesPlugin.xcplugin/Contents/MacOS/CreateFilesPlugin
normal x86_64
cd /Users/jakubmazur/Developer/CreateFilesPlugin
export MACOSX_DEPLOYMENT_TARGET=10.10
/Users/jakubmazur/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-arch x86_64 -bundle -isysroot /Users/jakubmazur/Desktop/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk
-L/Users/jakubmazur/Library/Developer/Xcode/DerivedData/CreateFilesPlugin-dmzpluimftctcqhbkndjiknqtjnz/Build/Products/Debug
-F/Users/jakubmazur/Library/Developer/Xcode/DerivedData/CreateFilesPlugin-dmzpluimftctcqhbkndjiknqtjnz/Build/Products/Debug
-filelist /Users/jakubmazur/Library/Developer/Xcode/DerivedData/CreateFilesPlugin-dmzpluimftctcqhbkndjiknqtjnz/Build/Intermediates/CreateFilesPlugin.build/Debug/CreateFilesPlugin.build/Objects-normal/x86_64/CreateFilesPlugin.LinkFileList
-mmacosx-version-min=10.10 -ObjC -lDTXcodeUtils -lXcodeEditor -fobjc-arc -fobjc-link-runtime -framework AppKit -framework Foundation -lPods -Xlinker -dependency_info -Xlinker /Users/jakubmazur/Library/Developer/Xcode/DerivedData/CreateFilesPlugin-dmzpluimftctcqhbkndjiknqtjnz/Build/Intermediates/CreateFilesPlugin.build/Debug/CreateFilesPlugin.build/Objects-normal/x86_64/CreateFilesPlugin_dependency_info.dat
-o /Users/jakubmazur/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins/CreateFilesPlugin.xcplugin/Contents/MacOS/CreateFilesPlugin
ld: library not found for -lDTXcodeUtils clang: error: linker command
failed with exit code 1 (use -v to see invocation)
Any idea what should i set to do this?
Podfile:
source 'https://github.com/CocoaPods/Specs.git'
platform :osx
pod "DTXcodeUtils"
Do the following steps. Its a work around.
Remove all the scheme and add by clicking auto create schemes.(The pods schemes will be checked once its recreated, need it checked for working it).
Then remove the scheme file from copy bundle resources(is it shows an error).
Deep clean and run
Its building without any error for me, Not sure whether it shows any run time errors/ exceptions
This is a follow-up to the question at Element-Wise Matrix Multiplication in Rcpp
I have been getting a number of different kinds of errors with RcppArmadillo since upgrading to Mavericks. I have Xcode 5.0.2 and Command Line Tools installed. Also, gfortran from Homebrew. But I keep encountering the error below --
> cppFunction("arma::mat schur(arma::mat& a, arma::mat& b)
{ return(a % b); }", depends="RcppArmadillo")
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [sourceCpp_18474.so] Error 1
clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include - I"/Library/Frameworks/R.framework/Versions/3.0/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.0/Resources/library/RcppArmadillo/include" -fPIC "-mtune=native -g -O2 -Wall -pedantic -Wconversion" -c fileaf992bfb8f84.cpp -o fileaf992bfb8f84.o clang++ -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/lib -L/usr/local/lib -o sourceCpp_18474.so fileaf992bfb8f84.o -L/Library/Frameworks/R.framework/Resources/lib -lRlapack -L/Library/Frameworks/R.framework/Resources/lib -lRblas -lgfortran /Library/Frameworks/R.framework/Versions/3.0/Resources/library/Rcpp/lib/libRcpp.a -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
Error in sourceCpp(code = code, env = env, rebuild = rebuild, showOutput = showOutput, :
Error 1 occurred building shared library.
WARNING: The tools required to build C++ code for R were not found.
Please install Command Line Tools for XCode (or equivalent).
# Contents of Makevars
$ cat ~/.R/Makevars
CC=clang
CXX=clang++
CXXFLAGS="-mtune=native -g -O2 -Wall -pedantic -Wconversion"
FLIBS=-lgfortran
Commenting FLIBS=-lgfortran does not help and results in even more error messages --
> cppFunction("arma::mat schur(arma::mat& a, arma::mat& b) { return(a % b); }", depends="RcppArmadillo")
ld: warning: directory not found for option '-L/usr/local/lib/gcc/i686-apple-darwin8/4.2.3/x86_64'
ld: warning: directory not found for option '-L/usr/local/lib/x86_64'
ld: warning: directory not found for option '-L/usr/local/lib/gcc/i686-apple-darwin8/4.2.3'
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [sourceCpp_50381.so] Error 1
Thanks in advance.
Update
Following suggestions from response from Kevin and Dirk below, I re-installed Rcpp, RcppArmadillo and inline from source and updated FLIBS to point to the actual directory. This solved the issue.
# Update FLIBS in ~/.R/Makevars
FLIBS=-L/usr/local/Cellar/gfortran/4.8.2/gfortran
#Re-Install from source
install.packages(c("Rcpp","RcppArmadillo","inline"),type="source")
#Restart R
EDIT: If you're a Homebrew user, you now instead need to use brew install gcc (gfortran is no longer provided separate of gcc), and you can then follow the instructions here to get set up.
You have to symlink the libraries to /usr/local/lib manually:
ln -s /usr/local/Cellar/gfortran/4.8.2/gfortran/lib/libgfortran.* /usr/local/lib/
I thought brew link gfortran would handle this, but apparently it only symlinks the gfortran program and not the actual libraries. So, unfortunately, you have to do it yourself.
(Replace 4.8.2 with whichever version of gfortran you're using from homebrew.)
Alternatively, if you want to keep from modifying /usr/local/lib, you can use
FLIBS=-L/usr/local/Cellar/gfortran/4.8.2/gfortran
in your ~/.R/Makevars file instead, so R knows where to find the gfortran libraries.
I can only suggest you study the numerous threads on the r-sig-mac list, the different answers here on SO as well as the posts on the rcpp-devel list.
As your error comes from the failed Fortran linking, maybe also review the standard page by Simon U. as well as the tools page it points too. AFAIK you should use the (older) gfortran 4.2.* from that page with R -- but then I am not an OS X user.
Edit in late 2016: We now have more detailed instructions in section 2.16 of the Rcpp FAQ.