[opensuse-programming] Need help fixing passing argument from incompatible pointer type error
Hi, I'm trying to build blender on build service and I am stuck with fixing the above problem. The offending section of BLI_bfile.c is :- /* Is this unpack&run? */ sprintf(temp, "%s/%d/environment", dirname(bprogname), BLENDER_VERSION); if(BLI_exist(temp)) { BLI_setenv_if_new("BLENDER_SHARE", dirname(bprogname)); This is the line that causes "|warning: passing argument 2 of 'BLI_setenv_if_new' from incompatible pointer type"| } else { BLI_setenv_if_new("BLENDER_SHARE", SHARED_DIRECTORY); } What I assume is the matching declaration from BLI_util.h :- void BLI_setenv_if_new(const char *env, const char* val); This is line 54 referred to below in note: The project is home:plater:branches:graphics blender and the output of the build log is :- |gcc -o /usr/src/packages/BUILD/build/linux2/source/blender/blenlib/intern/BLI_bfile.o -c -pthread -Wno-char-subscripts -Wdeclaration-after-statement -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -fno-strict-aliasing -fopenmp -O2 -Wall -fopenmp -I/usr/src/packages/BUILD/build/linux2/source/blender/blenlib -Isource/blender/blenlib -I/usr/src/packages/BUILD/build/linux2/source/blender/makesdna -Isource/blender/makesdna -I/usr/src/packages/BUILD/build/linux2/source/blender/blenkernel -Isource/blender/blenkernel -Iintern/guardedalloc -I/usr/src/packages/BUILD/build/linux2/source/blender/editors/include -Isource/blender/editors/include -I/usr/include -I/usr/include/freetype2 -I/usr/include -I/usr/src/packages/BUILD/build/linux2/extern/binreloc/include -Iextern/binreloc/include source/blender/blenlib/intern/BLI_bfile.c source/blender/blenlib/intern/BLI_bfile.c: In function 'BLI_bfile_init_vars': source/blender/blenlib/intern/BLI_bfile.c:248: warning: implicit declaration of function 'dirname' source/blender/blenlib/intern/BLI_bfile.c:248: warning: format '%s' expects type 'char *', but argument 3 has type 'int' source/blender/blenlib/intern/BLI_bfile.c:250: warning: passing argument 2 of 'BLI_setenv_if_new' from incompatible pointer type ||source/blender/blenlib/BLI_util.h:54: note: expected 'const char *' but argument is of type 'int' | Please excuse my ignorance, I'm still learning c and c++ but what better way to do it than fixing other peoples programming errors. The build completes but the build service outputs this error at the end: |E: blender 64bit-portability-issue source/blender/blenlib/intern/BLI_bfile.c:250 Thanks in advance Dave Plater | -- To unsubscribe, e-mail: opensuse-programming+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-programming+help@opensuse.org
Dave, Your error is burried a bit in the log... let me highlight what you're looking for:
On 11/20/2009 at 13:58, Dave Plater <davejplater@gmail.com> wrote: [...] source/blender/blenlib/intern/BLI_bfile.c:248: warning: implicit declaration of function 'dirname' [...] Please excuse my ignorance, I'm still learning c and c++ but what better way to do it than fixing other peoples programming errors. The build completes but the build service outputs this error at the end: |E: blender 64bit-portability-issue source/blender/blenlib/intern/BLI_bfile.c:250
Implicit declaration of funcrtion dirname. this is the culprit for you (and this always ends in this brp check.. so you can remember this). Most likely, what the original author missed, is a proper include, somerhing like: #include <libgen.h> This should solve your problem (and don't forget to send the patch upstream :) ) Dominique -- To unsubscribe, e-mail: opensuse-programming+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-programming+help@opensuse.org
On 11/20/2009 03:18 PM, Dominique Leuenberger wrote:
Dave,
Your error is burried a bit in the log... let me highlight what you're looking for:
On 11/20/2009 at 13:58, Dave Plater <davejplater@gmail.com> wrote:
[...]
source/blender/blenlib/intern/BLI_bfile.c:248: warning: implicit declaration of function 'dirname'
[...]
Please excuse my ignorance, I'm still learning c and c++ but what better way to do it than fixing other peoples programming errors. The build completes but the build service outputs this error at the end: |E: blender 64bit-portability-issue source/blender/blenlib/intern/BLI_bfile.c:250
Implicit declaration of funcrtion dirname. this is the culprit for you (and this always ends in this brp check.. so you can remember this).
Most likely, what the original author missed, is a proper include, somerhing like: #include <libgen.h>
This should solve your problem (and don't forget to send the patch upstream :) )
Dominique
Interesting thing I found "// #include <libgen.h>" at the top of BLI_bfile.c" conditional to a non win32 build I wonder why it's commented out? I've made a patch with it inserted further down the includes and I'll see if the build completes. Thanks Dave P -- To unsubscribe, e-mail: opensuse-programming+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-programming+help@opensuse.org
On 11/20/2009 03:36 PM, Dave Plater wrote:
On 11/20/2009 03:18 PM, Dominique Leuenberger wrote:
Dave,
Your error is burried a bit in the log... let me highlight what you're looking for:
On 11/20/2009 at 13:58, Dave Plater <davejplater@gmail.com> wrote:
[...]
source/blender/blenlib/intern/BLI_bfile.c:248: warning: implicit declaration of function 'dirname'
[...]
Please excuse my ignorance, I'm still learning c and c++ but what better way to do it than fixing other peoples programming errors. The build completes but the build service outputs this error at the end: |E: blender 64bit-portability-issue source/blender/blenlib/intern/BLI_bfile.c:250
Implicit declaration of funcrtion dirname. this is the culprit for you (and this always ends in this brp check.. so you can remember this).
Most likely, what the original author missed, is a proper include, somerhing like: #include <libgen.h>
This should solve your problem (and don't forget to send the patch upstream :) )
Dominique
Interesting thing I found "// #include <libgen.h>" at the top of BLI_bfile.c" conditional to a non win32 build I wonder why it's commented out? I've made a patch with it inserted further down the includes and I'll see if the build completes. Thanks Dave P
Thanks to all who replied, I will ask on the blender developers list about why #include <libgen.h> was commented out. Thanks again Dave P -- To unsubscribe, e-mail: opensuse-programming+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-programming+help@opensuse.org
Hi Dave, On Fri, 20 Nov 2009, 13:58:50 +0100, Dave Plater wrote:
Hi, I'm trying to build blender on build service and I am stuck with fixing the above problem. The offending section of BLI_bfile.c is :- /* Is this unpack&run? */ sprintf(temp, "%s/%d/environment", dirname(bprogname), BLENDER_VERSION);
BLI_bfile.c should include the proper header file declaring the function prototype for dirname; add this to it somewhere at the global level, but before dirname is actually used: #include <libgen.h> HTH, cheers. l8er manfred -- To unsubscribe, e-mail: opensuse-programming+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-programming+help@opensuse.org
participants (3)
-
Dave Plater
-
Dominique Leuenberger
-
Manfred Hollstein