-1

I am using guile (version 2.0) in my C code (compiled in gcc version 4.8.5 and OS centos 6).

My makefile looks like this.

CC=gcc
CFLAGS=-Wall -march=native -O2 -pipe -ffast-math -I/usr/include/guile/2.0
LDFLAGS=-lm -lguile -lgc -lpthread -lfftw3f -llapack

.PHONY: all 

all: server mdclient_ash client

mdclient_ash: mdclient_ash.o

client: client.o mdlib.o ipp.o

mdmd: mdlib.o ${PROC_OBJS} mdmd.o ipp.o

mdmd.o: mdmd.c tsdmd.h

clean:  
    rm -rf *~ *.o sp/*.o sp/*~ pp/ff/*.o pp/fr/*~ pp/sf/*.o pp/st/*~  

pp/rte/*.o pp/rte/*.~  server mdclient_ash client 

The compilation process warns for certain guile related errors, such as:

scm_int2num is deprecated (declared at /usr/include/guile/2.0/libguile/deprecated.h:667) [-Wdeprecated-declarations]

 element = scm_list_ref(retval,scm_int2num(1));

It has no errors. Upon executing my C file (main file i.e. server.c), I get the following error:

Some deprecated features have been used. Set the environment variable GUILE_WARN_DEPRECATED to "detailed" and rerun the program to get more information. Set it to "no" to suppress this message.

How and where do I set the environment variable GUILE_WARN_DEPRECATED appropriately?

apaderno
  • 28,547
  • 16
  • 75
  • 90

1 Answers1

1

You don't execute C files like server.c; you compile them into a program like server and then run that!

Since the message appears when the program is run, you need to set the environment variable when you run the program. I'm assuming you use a POSIX shell derivative such as bash; the syntax is different for C shell derivatives such as tcsh.

You can use:

  1. GUILE_WARN_DEPRECATED=detailed server to set the environment variable for just this invocation of the program.

  2. export GUILE_WARN_DEPRECATED=detailed; server sets and exports the environment variable and doesn't need to be reset again until you start a new shell in a new window, or something similar.

  3. Add export GUILE_WARN_DEPRECATED=detailed to your profile (~/.profile, or ~/.bash_profile, or perhaps ~/.bashrc file). This will now be set when you login or create a new window with a login shell.

There are some other ways to do these operations — they're minor variants on the options above. Check your shell manual for which files are processed when it starts up.

Clearly, it is best to stop using the deprecated functions, so the detailed warning is the most appropriate setting to use. However, you probably want to ignore the warning you're being given, not caring that your program will break in the future, and therefore you'll do the silly thing and use GUILE_WARN_DEPRECATED=no instead. I can't overstate how silly that would be — do not use deprecated functions. Edit the code and fix it to use the preferred replacement(s).

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
  • I am compiling them into an output file like server (didn't mention that in the question). And I am using the tcsh shell. I wanted to correct the depricated functions and am will be setting the variable to "detailed". Also, is there a way of setting the environment variable GUILE_WARN_DEPRECATED if I dont have root privileges. – Met_radar_Novice Sep 01 '17 at 00:27
  • Using `tcsh`, you need to use `setenv GUILE_DEPRECATED_WARN detailed` to set the variable to the best choice. You shouldn't do development work as root — you don't need to be root to compile. However, you set the environment the same regardless of whether you have root privileges or not (so `setenv`). There are other ways to add that to the build environment (there's usually more than one way to do anything) if necessary, but simply using `setenv` at the terminal should be adequate. – Jonathan Leffler Sep 01 '17 at 00:33