ld and clang error in RInside for Mac OSX - macos

I want to try out RInside for Mac OSX. I downloaded RInside from source using Terminal and then went into the /inst/examples/standard and tried to run make, as indicated in the answer to this thread: RInside on Mac OS X
However, the first error I received was fatal error: 'RInside.h' file not found. I manually found this file and put it into the /inst/examples/standard directory and ran make again. I received another fatal error for another .h file so I manually found the requisite file and inserted it into this standard directory. Anyway, after doing that a few more times, all dependencies were taken care of, then I ran make again and received the following very strange error:
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I also tried using clang++ -stdlib=libstdc++ in place of g++ (since RInside on Mac OS X says that g++ won't work), but it did not help either (i.e., I received the same architecture errors).
I am stuck here...
UPDATE:
As per Dirk Eddelbuettel's advice, I tried installing XTools (Run Windows X System on OSX), but I received the following error: "Xtools.pkg" is damaged and can't be opened. You should eject the disk image."
I am concerned that running a simple "hello world" script as provided on the RInside webpage (http://dirk.eddelbuettel.com/code/rinside.html) can be this convoluted on the Mac as to demand external installs and miscellaneous configurations. Hence, there must be a more straightforward way to run RInside on the Mac OS X.

Related

Error “ld: library not found for -lSystem” with GPS on MacOS

I'm programing ADA with GPS. The problem is that when I compile any code with GPS I get this error:
ld: library not found for -lSystem collect2: error: ld returned 1 exit status
I have updated and reinstalled everything (xcode, gcc), reinstalled GPS, and installed comand line tools.
That's what GPS show to me by terminal:
gprbuild -d -P/Users/pedromarti/Desktop/helloWorld/default.gpr /Users/pedromarti/Desktop/helloWorld/src/main.adb Bind [gprbind] main.bexch [Ada] main.ali Link [link] main.adb ld: library not found for -lSystem collect2: error: ld returned 1 exit status gprbuild: link of main.adb failed gprbuild: failed command was: /users/pedromarti/opt/gnat/2019/bin/gcc main.o b__main.o -L/Users/pedromarti/Desktop/helloWorld/obj/ -L/Users/pedromarti/Desktop/helloWorld/obj/ -L/users/pedromarti/opt/gnat/2019/lib/gcc/x86_64-apple-darwin17.7.0/8.3.1/adalib/ /users/pedromarti/opt/gnat/2019/lib/gcc/x86_64-apple-darwin17.7.0/8.3.1/adalib/libgnat.a -Wl,-rpath,#executable_path/ -Wl,-rpath,#executable_path/../../..//opt/gnat/2019/lib/gcc/x86_64-apple-darwin17.7.0/8.3.1/adalib -o main [2021-03-18 13:38:56] process exited with status 4, elapsed time: 02.57s
I don't know what more I can do. If anyone knows a solution, you are welcome!
You’re using GNAT Community Edition 2019. I can’t tell which OS release you’re running on, and in this case I don’t think it makes a difference.
The README from the download site says
== Mac OS: Xcode is now needed ==
On Mac OS, GNAT Community 2019 requires Xcode version 10 or above to be
installed. Once you do have Xcode installed, if you still observe an error
of the form:
ld: library not found for -lSystem
then you might have to execute the following:
xcode-select -s /Applications/Xcode.app/Contents/Developer
Xcode is large but free, and takes a while to download from the App Store (go to the Develop tab).
If your building system has a cache system, you need to clear the cache.
For example, if you are using cmake, remember to delete cmake build directory to avoid the cmakecache take it to the wrong link.

Where is the intel sgx psw and making intel sgx work with ubunut 18.04

I've tried following the intel instructions to install sgx, but it requires the sgx_linux_x64_psw_.bin file, which i cannot find anywhere. I've got the driver installer (sgx_linux_x64_driver_1.35.bin) and the sdk installer(sgx_linux_x64_sdk_2.10.100.2.bin), intel seems not to have a psw for linux? If so, how do i properly work with sgx? I tried simply executing the driver and sdk .bin files, but the sample code in the sdk would not compile (after make SGX_MODE=SIM), even after setting the sgxsdk directory to /opt/intel/sgxsdk. I'd get the following compile error:
/usr/bin/ld: warning: libsgx_uae_service_sim.so, needed by /opt/intel/sgxsdk/lib64/libsgx_urts_sim.so, not found (try using -rpath or -rpath-link)
/opt/intel/sgxsdk/lib64/libsgx_urts_sim.so: undefined reference to `get_launch_token'
collect2: error: ld returned 1 exit status
Makefile:235: recipe for target 'app' failed
make[1]: * [app] Error 1
make[1]: Leaving directory '/opt/intel/sgxsdk/SampleCode/SampleEnclave'
Makefile:180: recipe for target 'all' failed
make: * [all] Error 2
Any help with either issue would be much appreciated!
So at least in my case, it seems the issue was that I was A, using a virtual machine, which can ONLY run in simulation mode, so getting a fully working version of sgx is impossible. Secondly, I was using an outdated installation guide, for anyone else trying to use this stuff, make sure to get the installation guide from the intel download page along with the version you are downloading.
download source code from https://github.com/intel/linux-sgx, compile according to the instructions and then install psw.

Linking error while compiling opencv with cuda on high sierra

I am getting a linking error while compiling opencv with cuda on Mac OS X high Sierra (10.13.6).
Error message:
[ 21%] Linking CXX shared library ../../lib/libopencv_cudev.dylib
ld: warning: directory not found for option '-L/Users/unknownn/opencv/-Wl,-rpath,/usr/local/cuda'
ld: warning: directory not found for option '-L-Wl,-rpath,/usr/local/cuda'
ld: library not found for -llib
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [lib/libopencv_cudev.4.0.1.dylib] Error 1
make[1]: *** [modules/cudev/CMakeFiles/opencv_cudev.dir/all] Error 2
make: *** [all] Error 2
I have already tried pretty much every cuda (9, 9.2, 10) and opencv (3.4, 4.0.1) version. Also I am aware that every cuda version requires a specific Xcode version.
I have also tried various cmake versions
I checked for the correct cuda paths in ccmake.
I dont know why the ld warnings appear since /usr/local/cuda exist.
What is -llib?
I had the same problem as well, what's interesting is that the problem does not appear to be with OpenCV, but with cmake.
The FindCUDA that comes with cmake seems to be broken, producing that strange -llib. You can see it during the cmake run as well as:
Extra dependencies: cudart_static lib nppc nppial nppicc nppicom nppidei nppif nppig nppim nppist nppisu nppitc npps cublas cufft -L/usr/local/cuda/lib -L-Wl,-rpath,/usr/local/cuda
(Note the second element "lib", the last two -L... elements will cause problem when you do make install as well)
However, the opencv source package comes with FindCUDA.cmake files that seem to work.
Assuming:
cmake is in /usr/local/share/cmake
opencv source is in ~/opencv
Do the following first:
mv /usr/local/share/cmake/Modules/FindCUDA* /tmp # Or some other back up location
cp -r ~/opencv/cmake/FindCUDA* /usr/local/share/cmake/Modules
Then run your build steps as before (cmake ..., make ..., make install), and hopefully it will work this time (it did for me).
As far as I can tell, cmake has deprecated FindCUDA.cmake, so I'm guessing it won't get fixed any time soon.
Answer by Jack Leow was very usefull, but I had to make farther investigation, because indeed his solution doesn't work any more.
Finally I have found this answer on opencv github by alalek. If in short, he proposes to add following cmake definition:
-DOPENCV_CUDA_FORCE_BUILTIN_CMAKE_MODULE=ON
This solution works to me.
P.S.: Currently I managed to solve few more issues on my way to get awesome opencv build. But currently build is in progress (44%) hope it will be finished in next half an hour, haha!
sorry, although this workaround worked once with opencv-3.4.9 / XCode8.2 (Clang 8) / CMake 3.12, now the switching of the FindCUDA files does not work anymore with the combination
opencv-3.4.9 / XCode9.2 (Clang 9) / CMake 3.16 with the following error:
CMake Error at /Applications/CMake.app/Contents/share/cmake3.16/Modules/FindCUDA.cmake:416 (file):
file failed to open for writing (Permission denied):
/Users/filippo/opencv- 3.4.9/modules/core/CMakeFiles/cuda_compile.dir/src/cuda/cuda_compile_genera ted_gpu_mat.cu.o.depend
Call Stack (most recent call first):
/Applications/CMake.app/Contents/share/cmake-3.16/Modules/FindCUDA.cmake:1363 (cuda_include_nvcc_dependencies)
/Applications/CMake.app/Contents/share/cmake-3.16/Modules/FindCUDA.cmake:1650 (CUDA_WRAP_SRCS)
/Applications/CMake.app/Contents/share/cmake-3.16/Modules/FindCUDA.cmake:1663 (cuda_compile_base)
cmake/OpenCVDetectCUDA.cmake:262 (CUDA_COMPILE)
cmake/OpenCVUtils.cmake:1513 (ocv_cuda_compile)
cmake/OpenCVModule.cmake:927 (ocv_add_library)
cmake/OpenCVModule.cmake:848 (_ocv_create_module)
modules/core/CMakeLists.txt:81 (ocv_create_module)
I had to update XCode to the 9.2 because I had a "nullability" compiling error in the building opencv-3.4.9 probably caused by Clang.

Configuring wxWidgets for OS X 10.10

I am trying to build a program that relies on wxWidgets to run properly. I have the latest version of Xcode installed. I have tried building wxWidgets (both wxWidgets-3.0.2 and wxWidgets-2.9.4, the version originally used by the main program). However, in both cases, running the makefile for the main program gives the following error:
make: /Users/path to wxWidgets/wxWidgets-2.9.4/build-cocoa-release/utils/wxrc/wxrc: No such file or directory
As I understand it, I need to build wxrc to get my main program to build properly (I have tried this, but apparently some header files are missing). Is there any way to configure wxWidgets before this step that will automatically build wxrc as well? Or is that something I need to build separately? If it is separate, how would that be done?
I've pasted the code I originally used to configure wxWidgets below, with line breaks to make it easier to read:
../configure --with-osx_cocoa --with-macosx-version-min=10.7
--with-macosx-sdk=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk
--prefix="$(pwd)" --with-opengl CC=clang CXX=clang++ CXXFLAGS="-stdlib=libc++ -std=c++11"
OBJCXXFLAGS="-stdlib=libc++ -std=c++11" LDFLAGS=-stdlib=libc++
There is one error while building wxWidgets:
../src/osx/cocoa/utils.mm:250:28: error: cannot initialize a parameter of type 'id' with an lvalue of type
'wxNSAppController *'
[NSApp setDelegate:appcontroller];
When I go into the samples directory and enter "make", I get: ld: library not found for -lwx_osx_cocoau_xrc-2.9 clang: error: linker command failed with exit code 1 (use -v to see invocation) When entering "make" in demos, I get: ld: library not found for -lwx_osx_cocoau_core-2.9 clang: error: linker command failed with exit code 1 (use -v to see invocation)
If I missed any steps I should have taken before these (something with Xcode maybe?) please let me know. Thank you very much in advance.
Similar question. I have sugested a workaround proposed on a forum as follows: you can use --with-macosx-sdk=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/".

Fortran: Undefined symbols for architecture x86_64

I am using the gfortran compiler on mac osx mavericks. I have installed Xcode and command line tools. I am trying to compile a simple helloworld program with gfortran to test whether everything works, but unfortunately it doesn't work. The error message seems to suggest that I have no main function, but I don't see the error in the code:
program hello
print *, "Hello World!"
end program hello
But when i try to compile using
gfortran helloworld.f
I get the following error:
Undefined symbols for architecture x86_64:
"start", referenced from:
-u command line option
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
I do not understand what is wrong and I am on the verge of despair. I tried with gfortran 4.8.2 as well as gfortran 4.9.0, I tried reinstalling Xcode and Command Line Tools but nothing seems to work.
I am aware similar questions have been asked, but I was not able to find a solution to my problem. I would be happy even with a sloppy workaround, as long as I can get the compiler to run...
Oh my dear. Found the solution about a minute after staring the bounty. Rather than using the recommended installer from https://gcc.gnu.org/wiki/GFortranBinaries I just installed it with
brew install gcc
The gfortran now compiled without complaining.

Resources