Giter VIP home page Giter VIP logo

Comments (11)

beechung avatar beechung commented on August 21, 2024

It seems that your compiler or R might not have been set up properly. Would you please try whether you can properly compile any C code using R CMD SHLIB?

Many thanks!
Bee-Chung

from latent-factor-models.

guozhizou avatar guozhizou commented on August 21, 2024

It works well using R CMD SHLIB to compile C code.

Appreciated!
guozhi.zou

from latent-factor-models.

beechung avatar beechung commented on August 21, 2024

Could you copy paste the output of a successful run of R CMD SHLIB of any C code?
Could you try R CMD SHLIB src/C/util.c?

from latent-factor-models.

guozhizou avatar guozhizou commented on August 21, 2024

nalideMacBook-Pro:C nali$ R CMD SHLIB util.c
clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o util.so util.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation

It runs well with R CMD SHLIB src/C/util.c

Thanks!
guozhi.zou

from latent-factor-models.

guozhizou avatar guozhizou commented on August 21, 2024

It's so weird! I can compile util.c or factor_model_util.c under directory src/C, but it got a error when Under root directory.

from latent-factor-models.

guozhizou avatar guozhizou commented on August 21, 2024

Got it! Editing R Makeconf to specify your own compiler directory.

from latent-factor-models.

hbudyanto avatar hbudyanto commented on August 21, 2024

Hi @xinyuwuhenZZ , I got the same issue compiling C in Terminal Program. Would you mind expanding a bit more how you sorting out this error?

from latent-factor-models.

guozhizou avatar guozhizou commented on August 21, 2024

I edited R Makeconf (/Library/Frameworks/R.framework/Versions/3.3/Resources/etc/Makeconf ) to my own gcc name (CC = gcc-5 )

Good luck!

from latent-factor-models.

hbudyanto avatar hbudyanto commented on August 21, 2024

I am not sure what I did wrong - I tried compiling the program under directory src/C, it runs well. Yet, it doesn't work under top level directory (following is error shown up from the Terminal:)

ld: warning: directory not found for option '-L/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2'
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [lib/c_funcs.so] Error 1
make: *** [c_funcs] Error 1

i have made changes in R makeconf from like

# configure
...
'CC=clang' 'CXX=clang++' 'OBJC=clang' 'F77=gfortran-4.8' 'FC=gfortran-4.8' 'CFLAGS=-Wall -mtune=core2 -g -O2' 'CXXFLAGS=-Wall -mtune=core2 -g -O2' 'OBJCFLAGS=-Wall -mtune=core2 -g -O2' 'FCFLAGS=-Wall -g -O2' 'F77FLAGS=-Wall -g -O2' '--with-system-zlib' '--enable-memory-profiling' 'CPPFLAGS=-I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include' '--x-libraries=/opt/X11/lib' '--x-includes=/usr/local/include' '--enable-R-framework'/
....
CC = clang

to become as follows

# configure
...
'CC=gcc-6.1.0' 'CXX=clang++' 'OBJC=clang' 'F77=gfortran-4.8' 'FC=gfortran-4.8' 'CFLAGS=-Wall -mtune=core2 -g -O2' 'CXXFLAGS=-Wall -mtune=core2 -g -O2' 'OBJCFLAGS=-Wall -mtune=core2 -g -O2' 'FCFLAGS=-Wall -g -O2' 'F77FLAGS=-Wall -g -O2' '--with-system-zlib' '--enable-memory-profiling' 'CPPFLAGS=-I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include' '--x-libraries=/opt/X11/lib' '--x-includes=/usr/local/include' '--enable-R-framework'/
....
CC = gcc-6.1.0

Yet it still could not compile the C program. This is my setup gcc:

gcc: stable 6.1.0 (bottled), HEAD
GNU compiler collection
https://gcc.gnu.org

and my systems :

ProductName: Mac OS X
ProductVersion: 10.11.1
BuildVersion: 15B42

from latent-factor-models.

guozhizou avatar guozhizou commented on August 21, 2024

CXX=gcc++-6.1.0

from latent-factor-models.

hbudyanto avatar hbudyanto commented on August 21, 2024

finally thanks @xinyuwuhenZZ , it did work now. Really appreciate ur help!

from latent-factor-models.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.