lf-lang / lingua-franca

Intuitive concurrent programming in any language
https://www.lf-lang.org
Other
238 stars 63 forks source link

files target parameter no longer finds library files #694

Open edwardalee opened 3 years ago

edwardalee commented 3 years ago

Some recent change broke the mechanism using the target files parameter. Try this:

> cd example/C/
> lfc src/Rhythm/Rhythm.lf 
Generating code for: file:/Users/eal/lingua-franca-master/git/lingua-franca/example/C/src/Rhythm/Rhythm.lf
******** mode: STANDALONE
******** source file: /Users/eal/lingua-franca-master/git/lingua-franca/example/C/src/Rhythm/Rhythm.lf
******** generated sources: /Users/eal/lingua-franca-master/git/lingua-franca/example/C/src-gen/Rhythm/Rhythm
******** generated binaries: /Users/eal/lingua-franca-master/git/lingua-franca/example/C/bin
WARNING: Failed to find file /lib/C/util/sensor_simulator.c
WARNING: Failed to find file /lib/C/util/sensor_simulator.h
WARNING: Failed to find file /lib/C/util/wave_file_reader.c
WARNING: Failed to find file /lib/C/util/wave_file_reader.h
WARNING: Failed to find file /lib/C/util/audio_loop_mac.c
WARNING: Failed to find file /lib/C/util/audio_loop.h
WARNING: Failed to find file /lib/C/util/audio_loop_linux.c
WARNING: Failed to find file /lib/C/util/sensor_simulator.cmake
lfc: error: Failed to find cmake-include file /lib/C/util/sensor_simulator.cmake
 --> (unknown file):null:1 - Failed to find cmake-include file /lib/C/util/sensor_simulator.cmake

lfc: error: Failed to find file /lib/C/util/audio_loop.hspecified in the files target property.
 --> (unknown file):null:1 - Failed to find file /lib/C/util/audio_loop.hspecified in the files target property.

lfc: error: Failed to find file /lib/C/util/audio_loop_linux.cspecified in the files target property.
 --> (unknown file):null:1 - Failed to find file /lib/C/util/audio_loop_linux.cspecified in the files target property.

lfc: error: Failed to find file /lib/C/util/audio_loop_mac.cspecified in the files target property.
 --> (unknown file):null:1 - Failed to find file /lib/C/util/audio_loop_mac.cspecified in the files target property.

lfc: error: Failed to find file /lib/C/util/sensor_simulator.cspecified in the files target property.
 --> (unknown file):null:1 - Failed to find file /lib/C/util/sensor_simulator.cspecified in the files target property.

lfc: error: Failed to find file /lib/C/util/sensor_simulator.hspecified in the files target property.
 --> (unknown file):null:1 - Failed to find file /lib/C/util/sensor_simulator.hspecified in the files target property.

lfc: error: Failed to find file /lib/C/util/wave_file_reader.cspecified in the files target property.
 --> (unknown file):null:1 - Failed to find file /lib/C/util/wave_file_reader.cspecified in the files target property.

lfc: error: Failed to find file /lib/C/util/wave_file_reader.hspecified in the files target property.
 --> (unknown file):null:1 - Failed to find file /lib/C/util/wave_file_reader.hspecified in the files target property.

lfc: fatal error: Aborting due to 8 previous errors
lhstrh commented 3 years ago

Looks like a problem with hard-coded paths that weren't adjusted... Since we no longer compiler examples, this didn't show up in tests...

Soroosh129 commented 3 years ago

I think the new path is /lib/c/reactor-c/util/.

edwardalee commented 3 years ago

Oh, this is a strange path. This gives yet further motivation for overhauling how we pull in library components.

Fixing this will be a fair amount of work. This properly belongs as part of the task of moving things around. In this case, there is code documentation, wiki pages, and quite a few files attributes in .lf files that need to be updated. Meanwhile, many of our examples will fail.

An alternative (and probably a better approach when moving things around) is to make the change backward compatible. In Ptolemy II, whenever something moved that might be used by application code, a table was updated that remapped the old address to the new. This could be made part of the handling of the files attribute.

lhstrh commented 3 years ago

Seems easy enough to a regex string replace, no? I can take this as an action item...