Opened 13 years ago

Closed 12 years ago

#28906 closed defect (fixed)

gforth 0.7.0 can't find libcc.h

Reported by: vladimir.kupcov@… Owned by: arto.bendiken@…
Priority: Normal Milestone:
Component: ports Version: 1.9.2
Keywords: Cc: ryandesign (Ryan Carsten Schmidt)
Port: gforth

Description

There was no errors during compilation, but I can't use C functions interface. When I'm trying to call C function I see bunch of error messages. Here is the example:

/Users/vladkupcov/.gforth/libcc-tmp/gforth_c_1010588C8.c:1:32: error: gforth/0.7.0/libcc.h: No such file or directory
/Users/vladkupcov/.gforth/libcc-tmp/gforth_c_1010588C8.c: In function 'gforth_c_1010588C8_LTX_gforth_c_initscr__v':
/Users/vladkupcov/.gforth/libcc-tmp/gforth_c_1010588C8.c:5: error: 'Cell' undeclared (first use in this function)
/Users/vladkupcov/.gforth/libcc-tmp/gforth_c_1010588C8.c:5: error: (Each undeclared identifier is reported only once
/Users/vladkupcov/.gforth/libcc-tmp/gforth_c_1010588C8.c:5: error: for each function it appears in.)
/Users/vladkupcov/.gforth/libcc-tmp/gforth_c_1010588C8.c:5: error: expected ';' before 'MAYBE_UNUSED'
/Users/vladkupcov/.gforth/libcc-tmp/gforth_c_1010588C8.c:6: error: 'Float' undeclared (first use in this function)
/Users/vladkupcov/.gforth/libcc-tmp/gforth_c_1010588C8.c:6: error: expected ';' before 'MAYBE_UNUSED'
/Users/vladkupcov/.gforth/libcc-tmp/gforth_c_1010588C8.c: In function 'gforth_c_1010588C8_LTX_gforth_c_printw_a_n':
/Users/vladkupcov/.gforth/libcc-tmp/gforth_c_1010588C8.c:11: error: 'Cell' undeclared (first use in this function)
/Users/vladkupcov/.gforth/libcc-tmp/gforth_c_1010588C8.c:11: error: expected ';' before 'MAYBE_UNUSED'
/Users/vladkupcov/.gforth/libcc-tmp/gforth_c_1010588C8.c:12: error: 'Float' undeclared (first use in this function)
/Users/vladkupcov/.gforth/libcc-tmp/gforth_c_1010588C8.c:12: error: expected ';' before 'MAYBE_UNUSED'
/Users/vladkupcov/.gforth/libcc-tmp/gforth_c_1010588C8.c:13: error: 'sp' undeclared (first use in this function)
/Users/vladkupcov/.gforth/libcc-tmp/gforth_c_1010588C8.c: In function 'gforth_c_1010588C8_LTX_gforth_c_refresh__v':
/Users/vladkupcov/.gforth/libcc-tmp/gforth_c_1010588C8.c:17: error: 'Cell' undeclared (first use in this function)
/Users/vladkupcov/.gforth/libcc-tmp/gforth_c_1010588C8.c:17: error: expected ';' before 'MAYBE_UNUSED'
/Users/vladkupcov/.gforth/libcc-tmp/gforth_c_1010588C8.c:18: error: 'Float' undeclared (first use in this function)
/Users/vladkupcov/.gforth/libcc-tmp/gforth_c_1010588C8.c:18: error: expected ';' before 'MAYBE_UNUSED'
/Users/vladkupcov/.gforth/libcc-tmp/gforth_c_1010588C8.c: In function 'gforth_c_1010588C8_LTX_gforth_c_getch__n':
/Users/vladkupcov/.gforth/libcc-tmp/gforth_c_1010588C8.c:23: error: 'Cell' undeclared (first use in this function)
/Users/vladkupcov/.gforth/libcc-tmp/gforth_c_1010588C8.c:23: error: expected ';' before 'MAYBE_UNUSED'
/Users/vladkupcov/.gforth/libcc-tmp/gforth_c_1010588C8.c:24: error: 'Float' undeclared (first use in this function)
/Users/vladkupcov/.gforth/libcc-tmp/gforth_c_1010588C8.c:24: error: expected ';' before 'MAYBE_UNUSED'
/Users/vladkupcov/.gforth/libcc-tmp/gforth_c_1010588C8.c:25: error: 'sp' undeclared (first use in this function)
/Users/vladkupcov/.gforth/libcc-tmp/gforth_c_1010588C8.c:26: error: 'gforth_SP' undeclared (first use in this function)
/Users/vladkupcov/.gforth/libcc-tmp/gforth_c_1010588C8.c: In function 'gforth_c_1010588C8_LTX_gforth_c_endwin__v':
/Users/vladkupcov/.gforth/libcc-tmp/gforth_c_1010588C8.c:30: error: 'Cell' undeclared (first use in this function)
/Users/vladkupcov/.gforth/libcc-tmp/gforth_c_1010588C8.c:30: error: expected ';' before 'MAYBE_UNUSED'
/Users/vladkupcov/.gforth/libcc-tmp/gforth_c_1010588C8.c:31: error: 'Float' undeclared (first use in this function)
/Users/vladkupcov/.gforth/libcc-tmp/gforth_c_1010588C8.c:31: error: expected ';' before 'MAYBE_UNUSED'

in file included from *OS command line*:-1
test.fs:10: libtool compile failed
>>>initscr<<<
Backtrace:
$101004990 throw 
$101040500 c(abort") 
$101040C70 compile-wrapper-function 

First string in temporary C source code is

#include <gforth/0.7.0/libcc.h>

That's what "see compile-wrapper-function1" says:

see compile-wrapper-function1  
: compile-wrapper-function1  
  lib-handle 0= 
  IF     c-source-file close-file throw 0 c-source-file-id ! s\" glibtool --tag=CC --silent --mode=compile /usr/bin/gcc-4.2 -I /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_gforth/w
         ork/destroot/opt/local/include" s\"  -O -c " s+ lib-filename 2@ append s\" .c -o " append lib-filename 2@ append s\" .lo" append 2dup system drop free throw $? 
         IF     c" libtool compile failed" c(abort") 
         THEN 
         s\" glibtool --tag=CC --silent --mode=link /usr/bin/gcc-4.2 -module -rpath " lib-filename 2@ dirname replace-rpath s+ s\"  " append lib-filename 2@ append s\" .lo -o " append lib-filename 2@ append s\" .la" append c-libs @ 
         4311994800 list-map 2dup system drop free throw $? 
         IF     c" libtool link failed" c(abort") 
         THEN 
         open-wrappers dup 0= 
         IF     .lib-error -1 
                IF     c" open-lib failed" c(abort") 
                THEN 
         THEN 
         lib-handle-addr @ ! 
  THEN 
  lib-filename 2@ drop free throw 0 0 lib-filename 2! ; ok

Looks like gforth trying to find "gforth/0.7.0/libcc.h" in "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_gforth/work/destroot/opt/local/include", which is not exist. I guess it's temporary directory which was created by MacPorts and removed after gforth was installed. Is there any way to fix it? I think correct path should be "/opt/local/include".

Thank you,

Vlad Kupcov

Attachments (1)

gforth.diff (675 bytes) - added by ryandesign (Ryan Carsten Schmidt) 13 years ago.
proposed patch

Download all attachments as: .zip

Change History (7)

comment:1 Changed 13 years ago by ryandesign (Ryan Carsten Schmidt)

Keywords: gforth libcc.h removed
Owner: changed from macports-tickets@… to arto.bendiken@…

comment:2 Changed 13 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: ryandesign@… added

What do I need to type to reproduce this problem? I'm not familiar with gforth.

comment:3 Changed 13 years ago by vladimir.kupcov@…

In my example there was few functions from ncurses.h, but you can try to call any C function. Here is what you need to type to call abs from stdlib.h:

\c #include <stdlib.h>
c-function stdlib_abs abs n -- n
-3 stdlib_abs .

gforth should show "3 ok", but instead there will be error messages saying "gforth/0.7.0/libcc.h: No such file or directory" and "libtool compile failed". If you save this code to test.fs and run "gforth test.fs", you'll get something like this:

/Users/vladkupcov/.gforth/libcc-tmp/gforth_c_1010588D0.c:1:32: error: gforth/0.7.0/libcc.h: No such file or directory
/Users/vladkupcov/.gforth/libcc-tmp/gforth_c_1010588D0.c: In function 'gforth_c_1010588D0_LTX_gforth_c_abs_n_n':
/Users/vladkupcov/.gforth/libcc-tmp/gforth_c_1010588D0.c:5: error: 'Cell' undeclared (first use in this function)
/Users/vladkupcov/.gforth/libcc-tmp/gforth_c_1010588D0.c:5: error: (Each undeclared identifier is reported only once
/Users/vladkupcov/.gforth/libcc-tmp/gforth_c_1010588D0.c:5: error: for each function it appears in.)
/Users/vladkupcov/.gforth/libcc-tmp/gforth_c_1010588D0.c:5: error: expected ';' before 'MAYBE_UNUSED'
/Users/vladkupcov/.gforth/libcc-tmp/gforth_c_1010588D0.c:6: error: 'Float' undeclared (first use in this function)
/Users/vladkupcov/.gforth/libcc-tmp/gforth_c_1010588D0.c:6: error: expected ';' before 'MAYBE_UNUSED'
/Users/vladkupcov/.gforth/libcc-tmp/gforth_c_1010588D0.c:7: error: 'sp' undeclared (first use in this function)

in file included from *OS command line*:-1
test.fs:3: libtool compile failed
-3 >>>stdlib_abs<<< .
Backtrace:
$101004990 throw 
$101040500 c(abort") 
$101040C70 compile-wrapper-function 

And if you type

see compile-wrapper-function1

gforth will show you piece of Forth code with path to C include files for libtool, just like in my first message. I think this path should be "/opt/local/include".

Hopefully this will help.

Thank you,

Vlad Kupcov

Changed 13 years ago by ryandesign (Ryan Carsten Schmidt)

Attachment: gforth.diff added

proposed patch

comment:4 Changed 13 years ago by ryandesign (Ryan Carsten Schmidt)

Thanks, Vlad. The fix is attached. Arto, may I commit it?

comment:5 Changed 13 years ago by vladimir.kupcov@…

Thank you, Ryan.

comment:6 Changed 12 years ago by jmroot (Joshua Root)

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.