How to run hello world FUSE program on Xcode - xcode

I would like to know the configurations to run this Hello World program on Xcode. I have installed MacOSXFUSE.
With the command
gcc -Wall hello.c `pkg-config osxfuse --cflags --libs` -o hello
and then with
./hello outputdrive -f -s
I am able to successfully mount the drive outputdrive.
I have environmental variable declare set as -x PKG_CONFIG_PATH="/usr/local/lib/pkgconfig"
MacOSXFUSE is installed in /usr/local/include/osxfuse/
More information:
/usr/local/lib/pkgconfig/osxfuse.pc
data in this file is
prefix=/usr/local
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: fuse
Description: OSXFUSE
Version: 2.7.3
Libs: -L${libdir} -losxfuse -pthread -liconv
Cflags: -I${includedir}/osxfuse/fuse -D_FILE_OFFSET_BITS=64 -D_DARWIN_USE_64_BIT_INODE
A little progress,
I did this on terminal,
pkg-config osxfuse --cflags --libs
Pasted the below result in "other c flags" in xocde
-D_FILE_OFFSET_BITS=64 -D_DARWIN_USE_64_BIT_INODE -I/usr/local/include/osxfuse/fuse -L/usr/local/lib -losxfuse -pthread -liconv
Now I get the below error,
Undefined symbols for architecture i386:
"_fuse_main_real", referenced from:
_main in main.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Please let me know if more details is required.

You need to put the /usr/local/lib in the "Library search paths" and the library "libosxfuze" to the "Linked Frameworks and Libraries".
does it compile from command line?
g++ hello.c -I/usr/local/include/osxfuse/fuse -D_FILE_OFFSET_BITS=64 -v -L/usr/local/lib -losxfuse

Related

libgomp and MacOsx

I am using MacOS Mojave version 10.14.16 and I am trying to install http://www.rpl2.net/index.php (a programming language using Reverse Polish Notation as found on some HP calculators like the 48GX), supposed to work on MacOSX (they say "MacOS X (Xcode 3.1.4 + gfortran 4.5)").
So I have downloaded the latest stable release, cd to the folder, and wanted to run
./configure
make
make install
But the ./configure is failing due to "configure: error: Can not find libgomp !". There is no libgomp package I can install with brew (I already installed gcc which comes with gfortran and thought it would provide libgomp but apparently not).
Could someone help a poor applied mathematician trying to install a software on its macbook?
Thanks
EDIT
in my config.log I have this, maybe it will help:
configure:7433: checking for vim
configure:7449: found /usr/bin/vim
configure:7461: result: yes
configure:7507: checking for main in -lm
configure:7526: gcc -o conftest -g -O2 -O2 -fno-strict-overflow conftest.c -lm >&5
configure:7526: $? = 0
configure:7535: result: yes
configure:7548: checking for pthread_mutex_init in -lc
configure:7573: gcc -o conftest -g -O2 -O2 -fno-strict-overflow conftest.c -lc -lm >&5
configure:7573: $? = 0
configure:7582: result: yes
configure:7687: checking for omp_get_num_procs in -lgomp
configure:7712: gcc -o conftest -g -O2 -O2 -fno-strict-overflow conftest.c -lgomp -lc -lm >&5
ld: library not found for -lgomp
clang: error: linker command failed with exit code 1 (use -v to see invocation)
configure:7712: $? = 1
You don't say how you installed GCC. If you did it using homebrew, and
brew install gcc
you should be able to see:
/usr/local/Cellar/gcc/10.2.0/lib/gcc/10/libgomp.dylib
which would mean you need to compile with:
gcc ... -L /usr/local/Cellar/gcc/10.2.0/lib/gcc/10 -l gomp ...
Failing that, you can always search for libgomp with:
find /usr -name "lib*gomp*lib"
You can test which gcc you are using with:
type gcc

Set include directory for linker (ld) on OSX

I have a problem with linking a compiled program (see github repo for details).
The osx specific makefile section is here:
CFLAGS = -v -arch x86_64 -Wall -fPIC -O2 -I./include $(OPTS)
LDFLAGS = -v -arch x86_64 -lpthread /usr/local/lib/libportaudio.a -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework Carbon
EXECUTABLE ?= squeezelite-osx
include Makefile
The compilation works fine, but during the linking it fails with:
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.2.0
Thread model: posix
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.11.0 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -o squeezelite-osx main.o slimproto.o buffer.o stream.o utils.o output.o output_alsa.o output_pa.o output_stdout.o output_pack.o decode.o flac.o pcm.o mad.o vorbis.o faad.o mpg.o dsd.o dop.o dsd2pcm/dsd2pcm.o process.o resample.o -lpthread /usr/local/lib/libportaudio.a -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework Carbon -lFLAC -lmad -lvorbisfile -lfaad -lmpg123 -lsoxr -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.2/lib/darwin/libclang_rt.osx.a
ld: library not found for -lFLAC
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [squeezelite-osx] Error 1
The library which is not found is in the folder /usr/local/include and I think I have to add this path to the include path of the linker.
How can I add the path /usr/local/include to the include path of the linker?
The linker doesn't use include files; that's the compiler (actually the pre-processor, but let's keep it simple).
Instead you need to tell the linker that it should look in /usr/local/lib using the -L option:
-L/usr/local/lib
Note: you can provide more than one -L option to the linker.

Building GCC-4.9.2 on OS X Yosemite

Ok, I'm having trouble building gcc-4.9.2 on Apple's new OS X Yosemite. I'm not sure if I need to be building a gnu-gcc compiler on OS X, as most other software has compiled fine, apart from tesseract-3.0.1 and some of my own wxWidgets applications. Are there certain programs/code features that clang can't compile?
My build steps are as follows:
cd build-gcc
../gcc-4.9.1/configure --program-prefix="gnu-" --prefix="/usr/local/gcc-4.9.1" --with-gmp="/usr/local" --with-mpfr="/usr/local" --with-mpc="/usr/local" CC=clang CXX=clang++
make
My build path and gcc source paths do not contain any whitespace, and I have installed GMP, MPFR and MPC in /usr/local.
My build outputs are:
clang++ -g -DIN_GCC -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common -DHAVE_CONFIG_H -Wl,-no_pie -o cc1 c/c-lang.o c-family/stub-objc.o attribs.o c/c-errors.o c/c-decl.o c/c-typeck.o c/c-convert.o c/c-aux-info.o c/c-objc-common.o c/c-parser.o c/c-array-notation.o c-family/c-common.o c-family/c-cppbuiltin.o c-family/c-dump.o c-family/c-format.o c-family/c-gimplify.o c-family/c-lex.o c-family/c-omp.o c-family/c-opts.o c-family/c-pch.o c-family/c-ppoutput.o c-family/c-pragma.o c-family/c-pretty-print.o c-family/c-semantics.o c-family/c-ada-spec.o c-family/c-cilkplus.o c-family/array-notation-common.o c-family/cilk.o c-family/c-ubsan.o i386-c.o darwin-c.o \
cc1-checksum.o libbackend.a main.o tree-browser.o libcommon-target.a libcommon.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a libcommon.a ../libcpp/libcpp.a ./../intl/libintl.a -liconv ../libbacktrace/.libs/libbacktrace.a ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a -L/usr/local/lib -L/usr/local/lib -L/usr/local/lib -lmpc -lmpfr -lgmp -L../zlib -lz
ld: warning: ld: warning: ld: warning: ignoring file libbackend.a, file was built for archive which is not the architecture being linked (x86_64): libbackend.aignoring file libcommon-target.a, file was built for archive which is not the architecture being linked (x86_64): libcommon-target.aignoring file ../libdecnumber/libdecnumber.a, file was built for archive which is not the architecture being linked (x86_64): ../libdecnumber/libdecnumber.a
ld: warning: ignoring file ../zlib/libz.a, file was built for archive which is not the architecture being linked (x86_64): ../zlib/libz.a
Undefined symbols for architecture x86_64:
... (Lots of symbols)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [cc1] Error 1
make[2]: *** [all-stage1-gcc] Error 2
make[1]: *** [stage1-bubble] Error 2
make: *** [all] Error 2
Configure outputs the build type as: x86_64-apple-darwin14.0.0, so I don't understand why this is happening.
Thank You in advance for any help.
Turns out that I had a broken ranlib in /usr/local/bin - maybe GNU Binutils don't work on OS X? All I needed to do to fix the problem was to:
sudo mv /usr/local/bin/ranlib /usr/local/ranlib_old
and then make, and now I have a working GCC!

compile rJava with jdk1.8.0_05

I am trying to compile rJava using on OSX 10.7.5
install.packages("rJava",type="source")
The motive is this. I am using code compiled with jdk1.8.0_05 and call it using rJava. When I do this there is a mismatch between the class file version of code compiled with jdk1.8.0_05 and the class files rJava recognizes.
llvm-gcc-4.2 -arch x86_64 -std=gnu99 -c -o rjava.o rjava.c -g -Iinclude -DRIF_HAS_CSTACK
-DRIF_HAS_RSIGHAND -mtune=core2 -g -O2 -
I/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/jre/../include -
I/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/jre/../include/darwin -
fno-common -
I/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/jre/../include -
I/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/jre/../include/darwin
llvm-gcc-4.2 -arch x86_64 -std=gnu99 -o libjri.jnilib Rengine.o jri.o Rcallbacks.o Rinit.o
globals.o rjava.o -dynamiclib -framework JavaVM -F/Library/Frameworks/R.framework/.. -
framework R -llzma -licucore -lm -liconv
ld: library not found for -llzma
collect2: ld returned 1 exit status
make[2]: *** [libjri.jnilib] Error 1
make[1]: *** [src/JRI.jar] Error 2
make: *** [jri] Error 2
ERROR: compilation failed for package ‘rJava’
I have installed xz using homebrew but that didn't help.
Can I not use rJava to call code compiled with jdk1.8.0_05 ?
rJava binaries are installed and working properly. It is the source compilation that causes this.
I have executed R CMD javareconf.
Java interpreter : /usr/bin/java
Java version : 1.8.0_05
Java home path : /Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/jre
Java compiler : /usr/bin/javac
Java headers gen.: /usr/bin/javah
Java archive tool: /usr/bin/jar
Non-system Java on OS X
trying to compile and link a JNI progam
detected JNI cpp flags : -I$(JAVA_HOME)/../include -I$(JAVA_HOME)/../include/darwin
detected JNI linker flags : -L$(JAVA_HOME)/lib/server -ljvm
llvm-gcc-4.2 -arch x86_64 -std=gnu99 -I/Library/Frameworks/R.framework/Resources/include -
DNDEBUG -I/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/jre/../include -
I/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/jre/../include/darwin -
I/usr/local/include -fPIC -mtune=core2 -g -O2 -c conftest.c -o conftest.o
llvm-gcc-4.2 -arch x86_64 -std=gnu99 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/lib -L/usr/local/lib -o conftest.so conftest.o -L/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/jre/lib/server -ljvm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
JAVA_HOME : /Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/jre
Java library path: $(JAVA_HOME)/lib/server
JNI cpp flags : -I$(JAVA_HOME)/../include -I$(JAVA_HOME)/../include/darwin
JNI linker flags : -L$(JAVA_HOME)/lib/server -ljvm
Updating Java configuration in /Library/Frameworks/R.framework/Resources
Done.
You need a library: "library not found for -llzma"
Try download and install XZ 5.0.7: http://macpkg.sourceforge.net/

ld: unknown option: -reexported_symbols_list when building libc++ on mac os x 10.6.8

Any suggestions for resolving the following error (unknown option passed to ld) will be highly appreciated. The "buildit" script is the one from http://libcxx.llvm.org/ with the line
export TRIPLE=-apple-
added to it.
Thanks in advance
System Version: Mac OS X 10.6.8 (10K549)
$ clang++ -v
clang version 3.4 (trunk 192978) (llvm/trunk 192977)
Target: x86_64-apple-darwin10.8.0
Thread model: posix
/usr/local/libcxx/lib: sudo ./buildit
for FILE in '../src/*.cpp'
clang++ -c -g -Os -arch i386 -arch x86_64 -nostdinc++ -std=c++11 -fstrict-aliasing -Wall -Wextra -Wshadow -Wconversion -Wpadded -Wstrict-aliasing=2 -Wstrict-overflow=4 -U__STRICT_ANSI__ -I../include ../src/algorithm.cpp
for FILE in '../src/*.cpp'
...
clang algorithm.o bind.o chrono.o condition_variable.o debug.o exception.o future.o hash.o ios.o iostream.o locale.o memory.o mutex.o new.o optional.o random.o regex.o shared_mutex.o stdexcept.o string.o strstream.o system_error.o thread.o typeinfo.o utility.o valarray.o -arch i386 -arch x86_64 -o libc++.1.dylib -dynamiclib -nodefaultlibs -current_version 1 -compatibility_version 1 -install_name /usr/lib/libc++.1.dylib -lSystem -Wl,-unexported_symbols_list,libc++unexp.exp /usr/lib/libc++abi.dylib -Wl,-reexported_symbols_list,libc++abi.exp -Wl,-force_symbols_not_weak_list,notweak.exp -Wl,-force_symbols_weak_list,weak.exp -nostdinc++ -std=c++11 -fstrict-aliasing -Wall -Wextra -Wshadow -Wconversion -Wpadded -Wstrict-aliasing=2 -Wstrict-overflow=4 -U__STRICT_ANSI__
clang: warning: argument unused during compilation: '-nostdinc++'
clang: warning: argument unused during compilation: '-std=c++11'
ld: unknown option: -reexported_symbols_list
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I've been struggling for days with the same problem, but eventually got it compiled.
Before running the build script, try setting the following environment variables:
export TRIPLE=-apple-
export MACOSX_DEPLOYMENT_TARGET=10.6

Resources