Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile error #232

Open
DavidSagan opened this issue Dec 7, 2023 · 9 comments
Open

Compile error #232

DavidSagan opened this issue Dec 7, 2023 · 9 comments

Comments

@DavidSagan
Copy link

On compiling on Mac using gcc 12.3.0 I get the following error. What is the best way around this?

MAC:~/Bmad/xraylib> make
/Applications/Xcode.app/Contents/Developer/usr/bin/make  all-recursive
Making all in include
make[2]: Nothing to be done for `all'.
Making all in src
  CC       prdata-pr_data.o
  CC       libprdata_la-xrayvars.lo
  CC       libprdata_la-xrayglob.lo
  CC       libprdata_la-xrayfiles.lo
xrayfiles.c: In function 'XRayInitFromPath':
xrayfiles.c:59:45: error: implicit declaration of function 'xrl_strdup'; did you mean 'strdup'? [-Werror=implicit-function-declaration]
   59 |                 MendelArraySorted[i].name = xrl_strdup(MendelArray[i].name);
      |                                             ^~~~~~~~~~
      |                                             strdup
xrayfiles.c:59:43: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
   59 |                 MendelArraySorted[i].name = xrl_strdup(MendelArray[i].name);
      |                                           ^
xrayfiles.c:301:32: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
  301 |                 error_lines[0] = xrl_strdup(line_name);
      |                                ^
xrayfiles.c:314:53: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
  314 |                         error_lines[nerror_lines-1] = xrl_strdup(line_name);
      |                                                     ^
xrayfiles.c:350:32: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
  350 |                 error_lines[0] = xrl_strdup(shell_name);
      |                                ^
xrayfiles.c:363:53: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
  363 |                         error_lines[nerror_lines-1] = xrl_strdup(shell_name);
      |                                                     ^
xrayfiles.c:461:32: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
  461 |                 error_lines[0] = xrl_strdup(line_name);
      |                                ^
xrayfiles.c:474:53: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
  474 |                         error_lines[nerror_lines-1] = xrl_strdup(line_name);
      |                                                     ^
xrayfiles.c:517:32: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
  517 |                 error_lines[0] = xrl_strdup(auger_name);
      |                                ^
xrayfiles.c:530:53: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
  530 |                         error_lines[nerror_lines-1] = xrl_strdup(auger_name);
      |                                                     ^
cc1: some warnings being treated as errors
make[2]: *** [libprdata_la-xrayfiles.lo] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

@tschoonj
Copy link
Owner

tschoonj commented Dec 7, 2023

Hi David, good to hear from you!

I am not sure how you ran into that: looking at the code, this is only possible if the SWIG pre-processor macro is defined. Could you attach the config.log file please? Thanks

@DavidSagan
Copy link
Author

And good to know that xraylib is alive and well. I use it all the time! -- Cheers, David

config.log

@tschoonj
Copy link
Owner

tschoonj commented Dec 7, 2023

Not seeing anything unusual in there at first glance.

Could you re-run your build with make V=1? This should show the full compiler invocations.

Do you have a CFLAGS or CPPFLAGS environment variable set?

@DavidSagan
Copy link
Author

I don't have these flags set.

MAC:~/Bmad/xraylib> make V=1
/Applications/Xcode.app/Contents/Developer/usr/bin/make  all-recursive
Making all in include
make[2]: Nothing to be done for `all'.
Making all in src
/bin/sh ../libtool  --tag=CC   --mode=compile /opt/local/bin/gcc -DHAVE_CONFIG_H -I. -I..  -I../include -I../include -I..    -Werror=deprecated -Werror=deprecated-declarations -Werror=implicit -Werror=unused-function -Werror=parentheses -Werror=unused-result -g -O2 -MT libprdata_la-xrayfiles.lo -MD -MP -MF .deps/libprdata_la-xrayfiles.Tpo -c -o libprdata_la-xrayfiles.lo `test -f 'xrayfiles.c' || echo './'`xrayfiles.c
libtool: compile:  /opt/local/bin/gcc -DHAVE_CONFIG_H -I. -I.. -I../include -I../include -I.. -Werror=deprecated -Werror=deprecated-declarations -Werror=implicit -Werror=unused-function -Werror=parentheses -Werror=unused-result -g -O2 -MT libprdata_la-xrayfiles.lo -MD -MP -MF .deps/libprdata_la-xrayfiles.Tpo -c xrayfiles.c  -fno-common -DPIC -o .libs/libprdata_la-xrayfiles.o
xrayfiles.c: In function 'XRayInitFromPath':
xrayfiles.c:59:45: error: implicit declaration of function 'xrl_strdup'; did you mean 'strdup'? [-Werror=implicit-function-declaration]
   59 |                 MendelArraySorted[i].name = xrl_strdup(MendelArray[i].name);
      |                                             ^~~~~~~~~~
      |                                             strdup
xrayfiles.c:59:43: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
   59 |                 MendelArraySorted[i].name = xrl_strdup(MendelArray[i].name);
      |                                           ^
xrayfiles.c:301:32: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
  301 |                 error_lines[0] = xrl_strdup(line_name);
      |                                ^
xrayfiles.c:314:53: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
  314 |                         error_lines[nerror_lines-1] = xrl_strdup(line_name);
      |                                                     ^
xrayfiles.c:350:32: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
  350 |                 error_lines[0] = xrl_strdup(shell_name);
      |                                ^
xrayfiles.c:363:53: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
  363 |                         error_lines[nerror_lines-1] = xrl_strdup(shell_name);
      |                                                     ^
xrayfiles.c:461:32: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
  461 |                 error_lines[0] = xrl_strdup(line_name);
      |                                ^
xrayfiles.c:474:53: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
  474 |                         error_lines[nerror_lines-1] = xrl_strdup(line_name);
      |                                                     ^
xrayfiles.c:517:32: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
  517 |                 error_lines[0] = xrl_strdup(auger_name);
      |                                ^
xrayfiles.c:530:53: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
  530 |                         error_lines[nerror_lines-1] = xrl_strdup(auger_name);
      |                                                     ^
cc1: some warnings being treated as errors
make[2]: *** [libprdata_la-xrayfiles.lo] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

@tschoonj
Copy link
Owner

tschoonj commented Dec 8, 2023

I am unable to reproduce this, sorry.

If you remove #ifndef SWIG and one of the #endifs in include/xraylib-aux.h, does compilation succeed then?

@DavidSagan
Copy link
Author

No change with #ifndef SWIG removed.

@DavidSagan
Copy link
Author

Note: This is a recent issue for Mac since in the past I have not had a problem. I am using OS 14.1.2 with Xcode 15.0.1.

@DavidSagan
Copy link
Author

If I remove the #ifndef _XRAYLIB_AUX_H the compile gets further.

@tschoonj
Copy link
Owner

I have been unable to reproduce this. AFAICT this looks like an issue with the preprocessor. Does switching to a different version of GCC (or LLVM/clang) make a difference?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants