Thread: String does not match what it should

  1. #1
    Registered User awsdert's Avatar
    Join Date
    Jan 2015
    Posts
    1,735

    String does not match what it should

    Output:
    Code:
    make debug=1 rebuild run
    ...
    cc -Wall -Wextra -fPIC -D USING=gnu.mak -O3 -fPIC -D _EXT_PFX=".linux.cc" -o obj/tests/extra/create.c.linux.cc.o -c src/tests/extra/create.c
    cc -Wall -Wextra -fPIC -D USING=gnu.mak -O3 -fPIC -D _EXT_PFX=".linux.cc" -o obj/tests/extra/debug.c.linux.cc.o -c src/tests/extra/debug.c
    cc -Wall -Wextra -fPIC -D USING=gnu.mak -O3 -fPIC -D _EXT_PFX=".linux.cc" -o obj/tests/extra/lib.c.linux.cc.o -c src/tests/extra/lib.c
    cc -Wall -Wextra -fPIC -D USING=gnu.mak -O3 -fPIC -D _EXT_PFX=".linux.cc" -o obj/tests/extra/main.c.linux.cc.o -c src/tests/extra/main.c
    cc -Wall -Wextra -fPIC -D USING=gnu.mak -ggdb -D _DEBUG -fPIC -D _EXT_PFX=".linux.cc.d" -o obj/tests/extra/create.c.linux.cc.d.o -c  src/tests/extra/create.c
    cc -Wall -Wextra -fPIC -D USING=gnu.mak -ggdb -D _DEBUG -fPIC -D _EXT_PFX=".linux.cc.d" -o obj/tests/extra/debug.c.linux.cc.d.o -c  src/tests/extra/debug.c
    cc -Wall -Wextra -fPIC -D USING=gnu.mak -ggdb -D _DEBUG -fPIC -D _EXT_PFX=".linux.cc.d" -o obj/tests/extra/lib.c.linux.cc.d.o -c  src/tests/extra/lib.c
    cc -Wall -Wextra -fPIC -D USING=gnu.mak -ggdb -D _DEBUG -fPIC -D _EXT_PFX=".linux.cc.d" -o obj/tests/extra/main.c.linux.cc.d.o -c  src/tests/extra/main.c
    cc -Wall -Wextra -fPIC -D USING=gnu.mak -pg -D PROFILING -fPIC -D _EXT_PFX=".linux.cc.p" -o obj/tests/extra/create.c.linux.cc.p.o -c   src/tests/extra/create.c
    cc -Wall -Wextra -fPIC -D USING=gnu.mak -pg -D PROFILING -fPIC -D _EXT_PFX=".linux.cc.p" -o obj/tests/extra/debug.c.linux.cc.p.o -c   src/tests/extra/debug.c
    cc -Wall -Wextra -fPIC -D USING=gnu.mak -pg -D PROFILING -fPIC -D _EXT_PFX=".linux.cc.p" -o obj/tests/extra/lib.c.linux.cc.p.o -c   src/tests/extra/lib.c
    cc -Wall -Wextra -fPIC -D USING=gnu.mak -pg -D PROFILING -fPIC -D _EXT_PFX=".linux.cc.p" -o obj/tests/extra/main.c.linux.cc.p.o -c   src/tests/extra/main.c
    cc -Wl,-rpath,. -O3 -fPIC -o bin/check_extra.linux.cc.elf obj/tests/extra/create.c.linux.cc.o obj/tests/extra/debug.c.linux.cc.o obj/tests/extra/lib.c.linux.cc.o obj/tests/extra/main.c.linux.cc.o -lextra.linux.cc -lbasic.linux.cc -lextra.linux.cc -lbasic.linux.cc
    cc -Wl,-rpath,. -ggdb -D _DEBUG -fPIC -o bin/check_extra.linux.cc.d.elf obj/tests/extra/create.c.linux.cc.d.o obj/tests/extra/debug.c.linux.cc.d.o obj/tests/extra/lib.c.linux.cc.d.o obj/tests/extra/main.c.linux.cc.d.o -lextra.linux.cc.d -lbasic.linux.cc.d -lextra.linux.cc.d -lbasic.linux.cc.d
    cc -Wl,-rpath,. -pg -D PROFILING -fPIC -o bin/check_extra.linux.cc.p.elf obj/tests/extra/create.c.linux.cc.p.o obj/tests/extra/debug.c.linux.cc.p.o obj/tests/extra/lib.c.linux.cc.p.o obj/tests/extra/main.c.linux.cc.p.o -lextra.linux.cc.p -lbasic.linux.cc.p -lextra.linux.cc.p -lbasic.linux.cc.p
    cd bin && ./check_extra.linux.cc.d.elf -D APP_DATA=../run
    Constructing name 'vfxglfw.1.cc.d'
    Constructing name 'vfxgl.1.cc.d'
    Opened module 'vfxglfw.1.cc.d'
    Opened module 'vfxgl.1.cc.d'
    src/basic/shared.c:169: EUNKNOWN
    dlopen() error: 'vfxglfw.1.cc.d: cannot open shared object file: No such file or directory'
    src/basic/shared.c:169: EUNKNOWN
    dlopen() error: 'vfxgl.1.cc.d: cannot open shared object file: No such file or directory'
    make: *** [gnu.mak:44: run] Segmentation fault (core dumped)
    Compilation failed.
    Results of a session wide search for EXT_PFX
    Code:
    main.h:15: #define EXT_PFX ACHS_C( _EXT_PFX )
    main.c:135: printf( "Constructing name 'vfx%s%s'\n", app.wai.name, EXT_PFX );
    main.c:138: ( &app, app.wai.File, "vfx%s%s", app.wai.name, EXT_PFX );
    main.c:140: printf( "Constructing name 'vfx%s%s'\n", app.vai.name, EXT_PFX );
    main.c:143: ( &app, app.vai.File, "vfx%s%s", app.vai.name, EXT_PFX );
    system.mak:235: cc__opts=$(CFLAGS) $($1_opts) $($2_opts) -D _EXT_PFX="$(ext_pfx)$($1_sfx)"
    Found 7 matches for "EXT_PFX".
    I see no valid reason for EXT_PFX to not be the expected .linux.cc.d, any ideas what's causing it to be different?

  2. #2
    Registered User awsdert's Avatar
    Join Date
    Jan 2015
    Posts
    1,735
    I found the culprit, it was the compiler, it must be doing something under the hood that happens to use the same string and replaced mine along with it's own, switching the "." character for "_" gave me the correct string

  3. #3
    Registered User awsdert's Avatar
    Join Date
    Jan 2015
    Posts
    1,735
    Another string related problem:
    Code:
    _2src=$(if $(filter $1,$1),$2,$(call _2src,$(basename $1),$(basename $2)))
    obj2src=$(patsubst $(OBJ_DIR)/%,$(SRC_DIR)/%,$(call _2src,$(basename $1),$1))
    $(info $$(call obj2src,$(a_o)) = $(call obj2src,$(a_o)))
    
    # variant, name
    cc__opts=$(CFLAGS) $($1_opts) $($2_opts) -D _EXT_PFX="$(ext_pfx)$($1_sfx)"
    # variant, name, object
    cc___obj=$(CC) $(call cc__opts,$1,$2) -o $3 -c $(call obj2src,$3)
    # variant, name, object
    cc__obj=$(if $(filter %$(call ext,$1).o,$3),$(call cc___obj,$1,$2,$3))
    # variant, name
    cc__exe=$(CC) $(exe_opts) $($1_opts) $($2_opts) $(call exe_out,$1,$2) $($2_link)
    cc__dll=$(CC) $(dll_opts) $($1_opts) $($2_opts) $(call dll_out,$1,$2) $($2_link)
    cc__lib=ar rcs $(call lib_out,$1,$2)
    
    # variant, name
    cc_exe=$(call cc__exe,$1,$2)
    cc_dll=$(call cc__dll,$1,$2)
    cc_lib=$(call cc__lib,$1,$2,$3)
    # name, obj
    cc_obj=$(foreach i,$(variants),$(call cc__obj,$i,$1,$2))
    Is given me this output:
    Code:
    make debug=1 rebuild run
    ...
    System believed to be linux/unix variant
    arch=x86_64
    cpu_pfx=.x86_64
    cpu_def=__X86_64__
    lib_pfx=lib
    lib_sfx=.a
    dll_sfx=.so
    exe_sfx=.elf
    sys_pfx=.linux
    $(call obj2src,./obj/a.c.x86_64.linux.cc.o) = ./src/a.c.x86_64.linux.cc.o
    include ./gnu.mak
    rm -f -r ./obj/*
    rm -f -r ./lib/*
    rm -f -r ./bin/*
    cc -Wall -Wextra -fPIC   -D USING=gnu.mak -D TOP_DIR=./ -O3  -D _EXT_PFX="" -o obj/basic/agedby.c.x86_64.linux.cc.o -c obj/basic/agedby.c.x86_64.linux.cc.o
    ...
    Compilation failed.
    As you can see by the last line and the test call of obj2src the object paths are not being converted back to the source file path, any ideas on how to fix this? FYI the reason I went with manual conversion back to source is to keep my targets simple further down the line like this:
    Code:
    $(basic_objs): $(basic_incs) $(basic_srcs)
    	$(call cc_obj,basic,$@)

  4. #4
    Registered User awsdert's Avatar
    Join Date
    Jan 2015
    Posts
    1,735
    Never mind, managed to resolve the object to source name issue

    Code:
    _onesfx=$(if $(suffix $2),$(call _onesfx,$2,$(basename $2)),$1)
    onesfx=$(foreach i,$1,$(call _onesfx,$i,$(basename $i)))
    obj2src=$(patsubst $(OBJ_DIR)/%,$(SRC_DIR)/%,$(call onesfx,$1))

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 03-15-2019, 12:57 PM
  2. Match sub string then copy to the end
    By robi in forum C Programming
    Replies: 2
    Last Post: 03-03-2012, 06:52 PM
  3. I can't get the string comparison to match all the words.
    By jeremy duncan in forum C Programming
    Replies: 3
    Last Post: 12-01-2011, 11:43 PM
  4. sscanf string match
    By ssharish2005 in forum C Programming
    Replies: 2
    Last Post: 01-25-2010, 10:27 PM
  5. Approximate string match
    By CodeMonkey in forum C++ Programming
    Replies: 1
    Last Post: 02-17-2008, 05:35 AM

Tags for this Thread